Further massive amounts of work
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use crate::defines::LevelInt;
|
||||
use crate::static_data::growth_rates::growth_rate::GrowthRate;
|
||||
use std::collections::HashMap;
|
||||
use hashbrown::HashMap;
|
||||
use std::fmt;
|
||||
use std::fmt::{Debug, Formatter};
|
||||
|
||||
@@ -42,7 +42,10 @@ pub mod tests {
|
||||
|
||||
// Borrow as mut so we can insert
|
||||
let w = &mut lib;
|
||||
w.add_growth_rate("foo", Box::new(LookupGrowthRate::new(vec![0, 5, 10, 100])));
|
||||
w.add_growth_rate(
|
||||
"test_growthrate",
|
||||
Box::new(LookupGrowthRate::new(vec![0, 5, 10, 100])),
|
||||
);
|
||||
// Drops borrow as mut
|
||||
|
||||
lib
|
||||
@@ -51,14 +54,14 @@ pub mod tests {
|
||||
#[test]
|
||||
fn add_growth_rate_to_library_and_calculate_level() {
|
||||
let lib = build();
|
||||
assert_eq!(lib.calculate_level("foo", 3), 1);
|
||||
assert_eq!(lib.calculate_level("foo", 50), 3);
|
||||
assert_eq!(lib.calculate_level("test_growthrate", 3), 1);
|
||||
assert_eq!(lib.calculate_level("test_growthrate", 50), 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn add_growth_rate_to_library_and_calculate_experience() {
|
||||
let lib = build();
|
||||
assert_eq!(lib.calculate_experience("foo", 1), 0);
|
||||
assert_eq!(lib.calculate_experience("foo", 3), 10);
|
||||
assert_eq!(lib.calculate_experience("test_growthrate", 1), 0);
|
||||
assert_eq!(lib.calculate_experience("test_growthrate", 3), 10);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user