Skip to content

Commit

Permalink
Add not2 codegen test
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewhickman committed Dec 23, 2019
1 parent df2c166 commit 6fd6e8f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions codegen/not2.sl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(
func arg =>
let not = func x => if x
then false
else true
in
not (not arg)
) true
24 changes: 24 additions & 0 deletions src/codegen_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,27 @@ test_case!(
value: Value::Number(NumberValue::Int(5)),
},]
);
test_case!(
not2,
&[
Command::Push {
value: Value::Bool(true),
},
Command::Test { jump_offset: 2 },
Command::Push {
value: Value::Bool(true),
},
Command::Jump { jump_offset: 1 },
Command::Push {
value: Value::Bool(false),
},
Command::Test { jump_offset: 2 },
Command::Push {
value: Value::Bool(true),
},
Command::Jump { jump_offset: 1 },
Command::Push {
value: Value::Bool(false),
},
]
);

0 comments on commit 6fd6e8f

Please sign in to comment.