summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2017-09-02 15:12:35 +0200
committerMatthias Beyer <mail@beyermatthias.de>2017-09-02 15:40:15 +0200
commit97496fc95a77ac333300618b145896dc52fb1d80 (patch)
treeb0fc2a0b7f71cf8b2ec0f3324224dd1d00323ea8 /src
parent7282611edefaa1ca014de2a41e8417ad8aec057b (diff)
Add tests for calulating Addition
Diffstat (limited to 'src')
-rw-r--r--src/timetype.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/timetype.rs b/src/timetype.rs
index 4e2575e..8daff2a 100644
--- a/src/timetype.rs
+++ b/src/timetype.rs
@@ -124,5 +124,38 @@ mod tests {
}
}
+ #[test]
+ fn test_addition_of_seconds_calculate() {
+ let a = TT::Seconds(0);
+ let b = TT::Seconds(1);
+
+ let c = (a + b).calculate();
+
+ assert!(c.is_ok());
+ let c = c.unwrap();
+
+ match c {
+ TT::Seconds(1) => assert!(true),
+ _ => assert!(false, "Addition failed"),
+ }
+ }
+
+ #[test]
+ fn test_addition_of_seconds_multiple_calculate() {
+ let a = TT::Seconds(0);
+ let b = TT::Seconds(1);
+ let c = TT::Seconds(2);
+
+ let d = (a + b + c).calculate();
+
+ assert!(d.is_ok());
+ let d = d.unwrap();
+
+ match d {
+ TT::Seconds(3) => assert!(true),
+ _ => assert!(false, "Addition failed"),
+ }
+ }
+
}