forked from Maxluli/RustyPropagation
human: remove new() trait
This commit is contained in:
+13
-13
@@ -14,20 +14,20 @@ pub struct Human {
|
|||||||
pub x: i32,
|
pub x: i32,
|
||||||
pub y: i32,
|
pub y: i32,
|
||||||
}
|
}
|
||||||
impl Human {
|
// impl Human {
|
||||||
// humans with state "Normal"
|
// // humans with state "Normal"
|
||||||
pub fn new(pos_x: i32, pos_y: i32) -> Self {
|
// pub fn new(pos_x: i32, pos_y: i32) -> Self {
|
||||||
Self {
|
|
||||||
present_state: State::Normal,
|
|
||||||
x: pos_x,
|
|
||||||
y: pos_y,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// pub fn new_empty() -> Self{
|
|
||||||
// Self {
|
// Self {
|
||||||
// present_state: State::Normal,
|
// present_state: State::Normal,
|
||||||
// x : 0,
|
// x: pos_x,
|
||||||
// y : 0,
|
// y: pos_y,
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
}
|
// // pub fn new_empty() -> Self{
|
||||||
|
// // Self{
|
||||||
|
// // present_state:State::Normal,
|
||||||
|
// // x : 0,
|
||||||
|
// // y : 0,
|
||||||
|
// // }
|
||||||
|
// // }
|
||||||
|
// }
|
||||||
|
|||||||
+5
-1
@@ -345,7 +345,11 @@ mod tests {
|
|||||||
let mut stats: Stats;
|
let mut stats: Stats;
|
||||||
|
|
||||||
for _ in 0..10 {
|
for _ in 0..10 {
|
||||||
humans.push(Human::new(0, 0));
|
humans.push(Human{
|
||||||
|
present_state: State::Normal,
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
stats = humans_stats(&humans);
|
stats = humans_stats(&humans);
|
||||||
assert_eq!(stats.normal, 10);
|
assert_eq!(stats.normal, 10);
|
||||||
|
|||||||
Reference in New Issue
Block a user