summaryrefslogtreecommitdiff
path: root/learn_13
diff options
context:
space:
mode:
Diffstat (limited to 'learn_13')
-rw-r--r--learn_13/src/main.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/learn_13/src/main.rs b/learn_13/src/main.rs
index eb930c6..cf05f5b 100644
--- a/learn_13/src/main.rs
+++ b/learn_13/src/main.rs
@@ -108,6 +108,14 @@ mod tests {
)),
);
assert_eq!(expr.depth(), 3);
+
+ let expr2 = Expr::Negate(Box::new(
+ Expr::Add(
+ Box::new(Expr::Number(1)),
+ Box::new(Expr::Number(2)),
+ ),
+ ));
+ assert_eq!(expr2.depth(), 3);
}
#[test]
@@ -135,5 +143,13 @@ mod tests {
)),
);
assert_eq!(expr.node_count(), 6);
+
+ let expr2 = Expr::Negate(Box::new(
+ Expr::Add(
+ Box::new(Expr::Number(1)),
+ Box::new(Expr::Number(2)),
+ ),
+ ));
+ assert_eq!(expr2.node_count(), 4);
}
}