From a4469e7a91e5fa2cf913e40badc27a659160f832 Mon Sep 17 00:00:00 2001 From: Nicole L Date: Fri, 28 Feb 2025 10:30:54 -0800 Subject: [PATCH] Add division example to expression exercise (#2673) --- src/pattern-matching/exercise.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/pattern-matching/exercise.rs b/src/pattern-matching/exercise.rs index bf590a29..90fe6537 100644 --- a/src/pattern-matching/exercise.rs +++ b/src/pattern-matching/exercise.rs @@ -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