-
Notifications
You must be signed in to change notification settings - Fork 543
Expand file tree
/
Copy pathhealth-statistics.rs
More file actions
43 lines (37 loc) · 888 Bytes
/
health-statistics.rs
File metadata and controls
43 lines (37 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use health_statistics::*;
const NAME: &str = "Ebenezer";
const AGE: u32 = 89;
const WEIGHT: f32 = 131.6;
#[test]
fn name() {
let user = User::new(NAME.into(), AGE, WEIGHT);
assert_eq!(user.name(), NAME);
}
#[test]
#[ignore]
fn age() {
let user = User::new(NAME.into(), AGE, WEIGHT);
assert_eq!(user.age(), AGE);
}
#[test]
#[ignore]
fn weight() {
let user = User::new(NAME.into(), AGE, WEIGHT);
assert!((user.weight() - WEIGHT).abs() < f32::EPSILON);
}
#[test]
#[ignore]
fn set_age() {
let new_age: u32 = 90;
let mut user = User::new(NAME.into(), AGE, WEIGHT);
user.set_age(new_age);
assert_eq!(user.age(), new_age);
}
#[test]
#[ignore]
fn set_weight() {
let new_weight: f32 = 129.4;
let mut user = User::new(NAME.into(), AGE, WEIGHT);
user.set_weight(new_weight);
assert!((user.weight() - new_weight).abs() < f32::EPSILON);
}