summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/timetype.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/timetype.rs b/src/timetype.rs
index edabb3e..80a6c57 100644
--- a/src/timetype.rs
+++ b/src/timetype.rs
@@ -1042,4 +1042,30 @@ mod tests {
}
+#[cfg(test)]
+mod test_add_and_sub_mixed {
+ use timetype::TimeType as TT;
+
+ #[test]
+ fn test_add_then_sub() {
+ let a = TT::seconds(0);
+ let b = TT::seconds(1);
+ let c = TT::seconds(1);
+
+ let d = a + b - c;
+
+ assert_eq!(0, d.calculate().unwrap().get_seconds());
+ }
+ #[test]
+ fn test_sub_then_add() {
+ let a = TT::seconds(1);
+ let b = TT::seconds(1);
+ let c = TT::seconds(0);
+
+ let d = a - b + c;
+
+ assert_eq!(0, d.calculate().unwrap().get_seconds());
+ }
+}
+