Skip to content

Commit

Permalink
Add division example to expression exercise (#2673)
Browse files Browse the repository at this point in the history
  • Loading branch information
randomPoison authored Feb 28, 2025
1 parent f22395d commit a4469e7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/pattern-matching/exercise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,16 @@ fn test_zeros() {
0
);
}

#[test]
fn test_div() {
assert_eq!(
eval(Expression::Op {
op: Operation::Div,
left: Box::new(Expression::Value(10)),
right: Box::new(Expression::Value(2)),
}),
5
)
}
// ANCHOR_END: tests

0 comments on commit a4469e7

Please sign in to comment.