diff options
| author | Jon French | 2019-02-13 12:27:48 +0000 |
|---|---|---|
| committer | Jon French | 2019-02-13 12:27:48 +0000 |
| commit | ea39b3c674570ce5eea34067c36d5196ca201f83 (patch) | |
| tree | 516e7491bc32797a4d0ac397ea47387f2b16cf1b /test/c/bool_bits_mapping.sail | |
| parent | ab3f3671d4dd682b2aee922d5a05e9455afd5849 (diff) | |
| parent | 24fc989891ad266eae642815646294279e2485ca (diff) | |
Merge branch 'sail2' into rmem_interpreter
Diffstat (limited to 'test/c/bool_bits_mapping.sail')
| -rw-r--r-- | test/c/bool_bits_mapping.sail | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/c/bool_bits_mapping.sail b/test/c/bool_bits_mapping.sail new file mode 100644 index 00000000..1a104186 --- /dev/null +++ b/test/c/bool_bits_mapping.sail @@ -0,0 +1,23 @@ +default Order dec + +$include <prelude.sail> + +mapping bool_bits : bool <-> bits(1) = { + true <-> 0b1, + false <-> 0b0 +} + +val "print_endline" : string -> unit + +function main((): unit) -> unit = { + if bool_bits(0b1) then { + print_endline("ok") + } else { + print_endline("fail") + }; + if bool_bits(true) == 0b1 then { + print_endline("ok") + } else { + print_endline("fail") + } +}
\ No newline at end of file |
