More coverage
This commit is contained in:
parent
fadd82ff3b
commit
a155e53b30
|
|
@ -1 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="122" height="18" role="img" aria-label="test-coverage: 23%"><title>test-coverage: 23%</title><linearGradient id="bms-446d4cb5ae0bdc86" x2="0" y2="100%"><stop offset="0" stop-color="#fff" stop-opacity=".7"/><stop offset=".1" stop-color="#aaa" stop-opacity=".1"/><stop offset=".9" stop-color="#000" stop-opacity=".3"/><stop offset="1" stop-color="#000" stop-opacity=".5"/></linearGradient><clipPath id="bmr-446d4cb5ae0bdc86"><rect width="122" height="18" rx="4" fill="#fff"/></clipPath><g clip-path="url(#bmr-446d4cb5ae0bdc86)"><rect width="87" height="18" fill="#555"/><rect x="87" width="35" height="18" fill="#e05d44"/><rect width="122" height="18" fill="url(#bms-446d4cb5ae0bdc86)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="445" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="770">test-coverage</text><text x="445" y="130" transform="scale(.1)" fill="#fff" textLength="770">test-coverage</text><text aria-hidden="true" x="1035" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="250">23%</text><text x="1035" y="130" transform="scale(.1)" fill="#fff" textLength="250">23%</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="122" height="18" role="img" aria-label="test-coverage: 28%"><title>test-coverage: 28%</title><linearGradient id="bms-6ed4d3a1c27a31b3" x2="0" y2="100%"><stop offset="0" stop-color="#fff" stop-opacity=".7"/><stop offset=".1" stop-color="#aaa" stop-opacity=".1"/><stop offset=".9" stop-color="#000" stop-opacity=".3"/><stop offset="1" stop-color="#000" stop-opacity=".5"/></linearGradient><clipPath id="bmr-6ed4d3a1c27a31b3"><rect width="122" height="18" rx="4" fill="#fff"/></clipPath><g clip-path="url(#bmr-6ed4d3a1c27a31b3)"><rect width="87" height="18" fill="#555"/><rect x="87" width="35" height="18" fill="#e05d44"/><rect width="122" height="18" fill="url(#bms-6ed4d3a1c27a31b3)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="445" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="770">test-coverage</text><text x="445" y="130" transform="scale(.1)" fill="#fff" textLength="770">test-coverage</text><text aria-hidden="true" x="1035" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="250">28%</text><text x="1035" y="130" transform="scale(.1)" fill="#fff" textLength="250">28%</text></g></svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
|
@ -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,
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -273,9 +273,16 @@ impl From<InnerEquipementStats> 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<Equipement> {
|
||||
(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()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue