diff options
author | JJ | 2023-04-13 08:23:19 +0000 |
---|---|---|
committer | JJ | 2023-04-13 08:23:19 +0000 |
commit | f1286b162b9223f039ac561dcd4fea5bbfa831d3 (patch) | |
tree | e17767adc05c1fffaaaf004b6aff40dd9bf7a5b9 /tests/test_execution.rs | |
parent | 5ae010fef48cc2bf83a0d366d2a1cfa74ecce278 (diff) |
unbreak tests
Diffstat (limited to 'tests/test_execution.rs')
-rw-r--r-- | tests/test_execution.rs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/tests/test_execution.rs b/tests/test_execution.rs index 5aeac19..d9b1c5e 100644 --- a/tests/test_execution.rs +++ b/tests/test_execution.rs @@ -4,18 +4,20 @@ use chrysanthemum::util::*; #[test] fn test_simple() { - assert_eq!(execute(Context::new(), Const(0)), Ok(Term(0, Empty))); - assert_eq!(execute(Context::new(), Const(123)), Ok(Term(123, Empty))); - assert_eq!(execute(Context::new(), Const(123)), Ok(Term(123, Empty))); - assert!(execute(Context::new(), Var("x")).is_err()); + let context = Context::new(); + assert_eq!(execute(&context, Const(Term::Boolean(false))), Ok(Term::Boolean(false))); + assert_eq!(execute(&context, Const(Term::Natural(123))), Ok(Term::Natural(123))); + assert_eq!(execute(&context, Const(Term::Integer(123))), Ok(Term::Integer(123))); + assert!(execute(&context, Var("x")).is_err()); } #[test] fn test_complex() { let mut context = Context::new(); - context.insert(String::from("x"), Term(413, Empty)); - context.insert(String::from("y"), Term(1, Empty)); - assert_eq!(execute(context.clone(), Var("x")), Ok(Term(413, Empty))); - assert_eq!(execute(context.clone(), Cond(Var("y"), Const(612), Var("x"))), Ok(Term(612, Empty))); - assert_eq!(execute(context.clone(), App(Abs("z", Cond(Const(0), Var("x"), Var("z"))), Const(1025))), Ok(Term(1025, Empty))); + context.insert(String::from("x"), Term::Natural(413)); + context.insert(String::from("y"), Term::Boolean(true)); + assert_eq!(execute(&context, Var("x")), Ok(Term::Natural(413))); + assert_eq!(execute(&context, Cond(Var("y"), Const(Term::Integer(612)), Var("x"))), Ok(Term::Integer(612))); + assert_eq!(execute(&context, + App(Abs("z", Cond(Const(Term::Boolean(false)), Var("x"), Var("z"))), Const(Term::Integer(1025)))), Ok(Term::Integer(1025))); } |