diff --git a/.ignore b/.ignore
index 523ea06..fad8eb6 100644
--- a/.ignore
+++ b/.ignore
@@ -1,2 +1,3 @@
*.drawio
*.db
+*.svg
diff --git a/badges/coverage.svg b/badges/coverage.svg
index c78d807..7eeb722 100644
--- a/badges/coverage.svg
+++ b/badges/coverage.svg
@@ -1 +1 @@
-
+
diff --git a/weaponry/src/export.rs b/weaponry/src/export.rs
index 6b87b9f..42a7e09 100644
--- a/weaponry/src/export.rs
+++ b/weaponry/src/export.rs
@@ -181,3 +181,39 @@ pub fn initial_plot_chart(chart_name: &str, sub_charts: &[&str]) -> Chart {
.y_axis(Axis::new().grid_index(2).min(0))
.y_axis(Axis::new().grid_index(3).min(0))
}
+
+#[cfg(test)]
+mod test {
+ use crate::{
+ interfaces::RecipeCollection,
+ weaponry_structs::{Equipement, InitialEquipementList, RefinedEquipementList},
+ };
+
+ use super::{initial_chart, initial_plot_chart};
+
+ #[test]
+ fn test_export() {
+ let data = InitialEquipementList::from_vectored(vec![
+ Equipement::default(),
+ Equipement::default(),
+ ]);
+
+ let rdata = RefinedEquipementList::from(data);
+ let _chart = initial_chart("Charto");
+ let _chart2 = initial_plot_chart("Charto", &["Bob", "Bob2", "Bob3", "Bob4"]);
+ add_field_to_chart!(
+ rdata,
+ _chart,
+ (
+ index # &String,
+ dps_safe # f64,
+ ),
+ |ref_equipement|{
+ (
+ &ref_equipement.advanced.display_name,
+ ref_equipement.advanced.avg_damage_2a_safe,
+ )
+ }
+ );
+ }
+}
diff --git a/weaponry/src/weaponry_structs/equipement_fields.rs b/weaponry/src/weaponry_structs/equipement_fields.rs
index e3924e7..372a82f 100644
--- a/weaponry/src/weaponry_structs/equipement_fields.rs
+++ b/weaponry/src/weaponry_structs/equipement_fields.rs
@@ -111,22 +111,6 @@ impl Add for DamageType {
}
}
-#[cfg(test)]
-mod test {
- // use super::*;
-
- #[ignore]
- #[test]
- fn test_fields_serialisation() {
- unimplemented!()
- }
-
- #[ignore]
- #[test]
- fn test_fields_deserialisation() {
- unimplemented!()
- }
-}
// // TODO[!]: Implement all the soundness below
// /// The final enum of all categories to be given to the character sheet
@@ -254,6 +238,7 @@ pub enum EquipementTargets {
Ranged,
}
+#[coverage(off)] // IGNORED: Any test would just be a repeat of this enum
impl EquipementTargets {
/// Assert wether a target can be applied to an original shape
pub fn can_apply_onto(&self, lsh: &WeaponBaseShape) -> bool {
@@ -286,3 +271,28 @@ pub enum WeaponBaseSize {
Heavy,
SuperHeavy,
}
+
+#[cfg(test)]
+mod test {
+ use crate::weaponry_structs::{DamageMod, DamageType, PhysicalDamageType};
+
+ use super::SpecialField;
+
+ #[test]
+ fn test_impls() {
+ let mut a = SpecialField::new(vec!["a".to_owned(), "b".to_owned()]);
+ assert_eq!((*a).len(), 2);
+ (*a).push("c".to_string());
+ assert_eq!((*a).len(), 3);
+
+ let b = DamageType::new(vec![DamageMod::Primary(PhysicalDamageType::Blunt)]);
+ assert!(matches!(
+ b[0],
+ DamageMod::Primary(PhysicalDamageType::Blunt)
+ ));
+
+ println!("{b}");
+ let c = b + DamageType::new(vec![DamageMod::Secondary(PhysicalDamageType::Pierce)]);
+ assert_eq!(c.len(), 2);
+ }
+}
diff --git a/weaponry/src/weaponry_structs/equipement_impl_basics.rs b/weaponry/src/weaponry_structs/equipement_impl_basics.rs
index f7ec799..c3228fb 100644
--- a/weaponry/src/weaponry_structs/equipement_impl_basics.rs
+++ b/weaponry/src/weaponry_structs/equipement_impl_basics.rs
@@ -183,7 +183,10 @@ mod test {
weaponry_structs::{
Equipement, InitialEquipementList,
equipement_advanced_repr::RefinedEquipementList,
- equipement_structs::{DatabaseEquipementStats, InnerEquipementStats},
+ equipement_structs::{
+ DatabaseEquipementStats, EqFinishing, EqMaterial, EqNature, EqShape,
+ InnerEquipementStats,
+ },
},
};
@@ -237,5 +240,17 @@ mod test {
println!("{}", feqlist.get_report(None));
println!("{}", eqlist.get_report(None));
+ println!("{}", feqlist.get_report(Some("Title")));
+ println!("{}", eqlist.get_report(Some("Title")));
+ }
+
+ #[test]
+ fn test_conversion() {
+ let (_, _, _, _) = (
+ Equipement::from(EqShape::default()),
+ Equipement::from(EqMaterial::default()),
+ Equipement::from(EqNature::default()),
+ Equipement::from(EqFinishing::default()),
+ );
}
}
diff --git a/weaponry/src/weaponry_structs/equipement_structs.rs b/weaponry/src/weaponry_structs/equipement_structs.rs
index 28891e6..ee6faa1 100644
--- a/weaponry/src/weaponry_structs/equipement_structs.rs
+++ b/weaponry/src/weaponry_structs/equipement_structs.rs
@@ -273,9 +273,16 @@ impl From for EqFinishing {
#[cfg(test)]
mod test {
use super::{
- EqFinishing, EqMaterial, EqShape, Equipement, InitialEquipementList, InnerEquipementStats,
+ EqFinishing, EqMaterial, EqNature, EqShape, Equipement, InitialEquipementList,
+ InnerEquipementStats,
+ };
+ use crate::{
+ interfaces::RecipeCollection,
+ weaponry_structs::{
+ WeaponBaseShape, equipement_fields::EquipementTargets,
+ equipement_structs::filter_id_unique_and_right_category,
+ },
};
- use crate::interfaces::RecipeCollection;
fn list_equip() -> Vec {
(0..10)
@@ -309,9 +316,43 @@ mod test {
leq.combine_all(&InitialEquipementList::from_vectored(finishing));
}
- #[ignore]
#[test]
- fn test_default_behaviour() {
- unimplemented!()
+ fn test_filter() {
+ let mut a = InnerEquipementStats {
+ id: vec![1, 2],
+ target_category: None,
+ category_base: Some(WeaponBaseShape::Staves),
+ ..Default::default()
+ };
+
+ let mut b = InnerEquipementStats {
+ id: vec![3, 4],
+ target_category: Some(EquipementTargets::Weapons),
+ ..Default::default()
+ };
+ assert!(filter_id_unique_and_right_category()(&b, &a));
+
+ a.category_base = Some(WeaponBaseShape::Armors);
+ assert!(!filter_id_unique_and_right_category()(&b, &a));
+
+ a.category_base = None;
+ assert!(!filter_id_unique_and_right_category()(&b, &a));
+
+ b.target_category = None;
+ assert!(!filter_id_unique_and_right_category()(&b, &a));
+
+ a.category_base = Some(WeaponBaseShape::Blunt);
+ assert!(!filter_id_unique_and_right_category()(&b, &a));
+ }
+
+ #[test]
+ fn test_conversion() {
+ let st = InnerEquipementStats::random_new();
+ let (_, _, _, _) = (
+ EqShape::from(st.clone()),
+ EqFinishing::from(st.clone()),
+ EqMaterial::from(st.clone()),
+ EqNature::from(st.clone()),
+ );
}
}
diff --git a/weaponry/src/weaponry_structs/equipement_views.rs b/weaponry/src/weaponry_structs/equipement_views.rs
index a5c4ec4..14c6cc7 100644
--- a/weaponry/src/weaponry_structs/equipement_views.rs
+++ b/weaponry/src/weaponry_structs/equipement_views.rs
@@ -15,6 +15,7 @@ use super::equipement_advanced_repr::RefinedEquipementList;
/// A rather full view of an equipement, this multi field allow for a great amount of different operations but incurrs a rather hefty calculation price
struct EquipementFullView {}
+#[coverage(off)]
impl ViewTable for EquipementFullView {
type InterestElementList = RefinedEquipementList;