Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bmerry committed Dec 1, 2024
1 parent 6aa8e60 commit cca1b93
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ mod test {
scale: 0.1,
bias: -10.0, // Not realistic, but useful to test the feature
unit: "kWh",
sum_of: &[1, 2],
}
}

Expand All @@ -103,4 +104,11 @@ mod test {
assert_approx_eq!(f.from_u16s([55536, 4321]), 28323649.2);
assert_approx_eq!(f.from_u16s([55536, 55536]), -65530456.4);
}

#[test]
fn test_from_sum() {
let f = field();
let values = [2.0, 3.0, 4.0];
assert_eq!(f.from_sum(&values), 7.0);
}
}

0 comments on commit cca1b93

Please sign in to comment.