From 0f04a42dcbb002611f10636f63aebc69d45f78fe Mon Sep 17 00:00:00 2001 From: Mark Date: Mon, 10 Apr 2023 12:48:36 -0700 Subject: [PATCH] Added tests --- src/tests.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/tests.rs b/src/tests.rs index 2fbe217..a7787db 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -173,4 +173,24 @@ fn operators() { good_expr("18", "3!3"); bad_expr("3.1!"); bad_expr("pi!"); +} + +#[test] +fn units() { + //good_expr("4 m*s", "2 m * 2s"); + good_expr("1 m/s", "2 m / 2s"); + good_expr("10 m", "10 m"); + good_expr("10 m", "10 * m"); + good_expr("12 m", "(2 + 10) m"); + + good_expr("2 m^2", "2m^2"); + good_expr("4 m^2", "(2m)^2"); + good_expr("2 m^2", "2m * m"); + good_expr("1 m^2", "m m"); + + good_expr("2 m", "rt (4m^2)"); + + bad_expr("m + s"); + bad_expr("m ^ s"); + bad_expr("m ^ pi"); } \ No newline at end of file