A bunch of work on unit testing
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -54,8 +54,6 @@ pub mod tests {
|
||||
&StringKey::new("test_ability"),
|
||||
Arc::new(Ability::new(&"test_ability".into(), &"test_ability".into(), Vec::new())),
|
||||
);
|
||||
// Drops borrow as mut
|
||||
|
||||
lib
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ pub mod tests {
|
||||
0.0,
|
||||
0,
|
||||
Vec::new(),
|
||||
StaticStatisticSet::default(),
|
||||
StaticStatisticSet::new(10, 10, 10, 10, 10, 10),
|
||||
Vec::new(),
|
||||
Vec::new(),
|
||||
LearnableMoves::new(),
|
||||
|
||||
@@ -174,4 +174,20 @@ pub mod tests {
|
||||
assert_approx_eq!(r.get_effectiveness(t0, &[t1, t1]), 0.25);
|
||||
assert_approx_eq!(r.get_effectiveness(t1, &[t0, t0]), 4.0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn add_two_types_get_type_name() {
|
||||
let mut lib = TypeLibrary::new(2);
|
||||
|
||||
// Borrow as mut so we can insert
|
||||
let w = &mut lib;
|
||||
let t0 = w.register_type(&"foo".into());
|
||||
let t1 = w.register_type(&"bar".into());
|
||||
// Drops borrow as mut
|
||||
|
||||
// Borrow as read so we can read
|
||||
let r = &lib;
|
||||
assert_eq!(r.get_type_name(t0).unwrap(), "foo".into());
|
||||
assert_eq!(r.get_type_name(t1).unwrap(), "bar".into());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user