Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweaks to tests #791

Open
wants to merge 2 commits into
base: sail2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions test/builtins/append.sail
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ function main (() : unit) -> unit = {
assert(1^0x0 @ 5^0x1e == 6^0x1e);
assert(10^0x202 @ 1^0x0 == 11^0x404);
assert(14^0x0 @ 64^0x5c003 == 78^0x5c003);
assert(19^0x33 @ 2^0x0 == 21^0xcc);
assert(19^0x9f @ 2^0x0 == 21^0x27c);
assert(19^0x33 @ 02^0x0 == 21^0xcc);
assert(19^0x9f @ 02^0x0 == 21^0x27c);
assert(24^0x0 @ 32^0x8 == 56^0x8);
assert(26^0x1 @ 2^0x0 == 28^0x4);
assert(26^0x3b08414 @ 2^0x0 == 28^0xec21050);
assert(26^0x3ffdc6b @ 2^0x0 == 28^0xfff71ac);
assert(26^0x3ffe79d @ 2^0x0 == 28^0xfff9e74);
assert(26^0x3ffee69 @ 2^0x0 == 28^0xfffb9a4);
assert(26^0x56d @ 2^0x0 == 28^0x15b4);
assert(26^0x1 @ 02^0x0 == 28^0x4);
assert(26^0x3b08414 @ 02^0x0 == 28^0xec21050);
assert(26^0x3ffdc6b @ 02^0x0 == 28^0xfff71ac);
assert(26^0x3ffe79d @ 02^0x0 == 28^0xfff9e74);
assert(26^0x3ffee69 @ 02^0x0 == 28^0xfffb9a4);
assert(26^0x56d @ 02^0x0 == 28^0x15b4);
assert(31^0x0 @ 33^0x37fb000 == 64^0x37fb000);
assert(32^0x0 @ 32^0x4b == 64^0x4b);
assert(32^0x0 @ 32^0xffffff80 == 64^0xffffff80);
Expand Down
4 changes: 2 additions & 2 deletions test/builtins/get_slice_int.sail
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ function main (() : unit) -> unit = {
assert(get_slice_int(1, 6, 6) == 1^0x0, "get_slice_int(1, 6, 6) == 1^0x0");
assert(get_slice_int(1, 7, 6) == 1^0x0, "get_slice_int(1, 7, 6) == 1^0x0");
assert(get_slice_int(11, 1024, 0) == 11^0x400, "get_slice_int(11, 1024, 0) == 11^0x400");
assert(get_slice_int(2, 1, 0) == 2^0x1, "get_slice_int(2, 1, 0) == 2^0x1");
assert(get_slice_int(2, 3, 0) == 2^0x3, "get_slice_int(2, 3, 0) == 2^0x3");
assert(get_slice_int(2, 1, 0) == 02^0x1, "get_slice_int(2, 1, 0) == 02^0x1");
assert(get_slice_int(2, 3, 0) == 02^0x3, "get_slice_int(2, 3, 0) == 02^0x3");
assert(get_slice_int(3, 0, 0) == 3^0x0, "get_slice_int(3, 0, 0) == 3^0x0");
assert(get_slice_int(3, 1, 0) == 3^0x1, "get_slice_int(3, 1, 0) == 3^0x1");
assert(get_slice_int(3, 2, 0) == 3^0x2, "get_slice_int(3, 2, 0) == 3^0x2");
Expand Down
12 changes: 6 additions & 6 deletions test/builtins/replicate_bits.sail
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function main (() : unit) -> unit = {
assert(replicate_bits(1^0x0, 14) == 14^0x0, "replicate_bits(1^0x0, 14) == 14^0x0");
assert(replicate_bits(1^0x0, 16) == 16^0x0, "replicate_bits(1^0x0, 16) == 16^0x0");
assert(replicate_bits(1^0x0, 18) == 18^0x0, "replicate_bits(1^0x0, 18) == 18^0x0");
assert(replicate_bits(1^0x0, 2) == 2^0x0, "replicate_bits(1^0x0, 2) == 2^0x0");
assert(replicate_bits(1^0x0, 2) == 02^0x0, "replicate_bits(1^0x0, 2) == 02^0x0");
assert(replicate_bits(1^0x0, 20) == 20^0x0, "replicate_bits(1^0x0, 20) == 20^0x0");
assert(replicate_bits(1^0x0, 21) == 21^0x0, "replicate_bits(1^0x0, 21) == 21^0x0");
assert(replicate_bits(1^0x0, 22) == 22^0x0, "replicate_bits(1^0x0, 22) == 22^0x0");
Expand Down Expand Up @@ -54,7 +54,7 @@ function main (() : unit) -> unit = {
assert(replicate_bits(1^0x0, 8) == 8^0x0, "replicate_bits(1^0x0, 8) == 8^0x0");
assert(replicate_bits(1^0x1, 1) == 1^0x1, "replicate_bits(1^0x1, 1) == 1^0x1");
assert(replicate_bits(1^0x1, 16) == 16^0xffff, "replicate_bits(1^0x1, 16) == 16^0xffff");
assert(replicate_bits(1^0x1, 2) == 2^0x3, "replicate_bits(1^0x1, 2) == 2^0x3");
assert(replicate_bits(1^0x1, 2) == 02^0x3, "replicate_bits(1^0x1, 2) == 02^0x3");
assert(replicate_bits(1^0x1, 3) == 3^0x7, "replicate_bits(1^0x1, 3) == 3^0x7");
assert(replicate_bits(1^0x1, 32) == 32^0xffffffff, "replicate_bits(1^0x1, 32) == 32^0xffffffff");
assert(replicate_bits(1^0x1, 36) == 36^0xfffffffff, "replicate_bits(1^0x1, 36) == 36^0xfffffffff");
Expand All @@ -70,10 +70,10 @@ function main (() : unit) -> unit = {
assert(replicate_bits(16^0xff, 4) == 64^0xff00ff00ff00ff, "replicate_bits(16^0xff, 4) == 64^0xff00ff00ff00ff");
assert(replicate_bits(16^0xff00, 4) == 64^0xff00ff00ff00ff00, "replicate_bits(16^0xff00, 4) == 64^0xff00ff00ff00ff00");
assert(replicate_bits(16^0xffff, 4) == 64^0xffffffffffffffff, "replicate_bits(16^0xffff, 4) == 64^0xffffffffffffffff");
assert(replicate_bits(2^0x0, 32) == 64^0x0, "replicate_bits(2^0x0, 32) == 64^0x0");
assert(replicate_bits(2^0x1, 32) == 64^0x5555555555555555, "replicate_bits(2^0x1, 32) == 64^0x5555555555555555");
assert(replicate_bits(2^0x2, 32) == 64^0xaaaaaaaaaaaaaaaa, "replicate_bits(2^0x2, 32) == 64^0xaaaaaaaaaaaaaaaa");
assert(replicate_bits(2^0x3, 32) == 64^0xffffffffffffffff, "replicate_bits(2^0x3, 32) == 64^0xffffffffffffffff");
assert(replicate_bits(02^0x0, 32) == 64^0x0, "replicate_bits(02^0x0, 32) == 64^0x0");
assert(replicate_bits(02^0x1, 32) == 64^0x5555555555555555, "replicate_bits(02^0x1, 32) == 64^0x5555555555555555");
assert(replicate_bits(02^0x2, 32) == 64^0xaaaaaaaaaaaaaaaa, "replicate_bits(02^0x2, 32) == 64^0xaaaaaaaaaaaaaaaa");
assert(replicate_bits(02^0x3, 32) == 64^0xffffffffffffffff, "replicate_bits(02^0x3, 32) == 64^0xffffffffffffffff");
assert(replicate_bits(32^0x0, 2) == 64^0x0, "replicate_bits(32^0x0, 2) == 64^0x0");
assert(replicate_bits(32^0xffff, 2) == 64^0xffff0000ffff, "replicate_bits(32^0xffff, 2) == 64^0xffff0000ffff");
assert(replicate_bits(32^0xffff0000, 2) == 64^0xffff0000ffff0000, "replicate_bits(32^0xffff0000, 2) == 64^0xffff0000ffff0000");
Expand Down
14 changes: 7 additions & 7 deletions test/builtins/set_slice_bits.sail
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ $include <flow.sail>
$include <vector_dec.sail>

function main (() : unit) -> unit = {
assert(set_slice_bits(2, 1, 2^0x0, 0, 1^0x0) == 2^0x0, "set_slice_bits(2, 1, 2^0x0, 0, 1^0x0) == 2^0x0");
assert(set_slice_bits(2, 1, 2^0x0, 1, 1^0x0) == 2^0x0, "set_slice_bits(2, 1, 2^0x0, 1, 1^0x0) == 2^0x0");
assert(set_slice_bits(2, 1, 02^0x0, 0, 1^0x0) == 02^0x0, "set_slice_bits(2, 1, 02^0x0, 0, 1^0x0) == 02^0x0");
assert(set_slice_bits(2, 1, 02^0x0, 1, 1^0x0) == 02^0x0, "set_slice_bits(2, 1, 02^0x0, 1, 1^0x0) == 02^0x0");
assert(set_slice_bits(25, 16, 25^0x0, 0, 16^0x9) == 25^0x9, "set_slice_bits(25, 16, 25^0x0, 0, 16^0x9) == 25^0x9");
assert(set_slice_bits(3, 1, 3^0x0, 0, 1^0x1) == 3^0x1, "set_slice_bits(3, 1, 3^0x0, 0, 1^0x1) == 3^0x1");
assert(set_slice_bits(3, 1, 3^0x0, 1, 1^0x0) == 3^0x0, "set_slice_bits(3, 1, 3^0x0, 1, 1^0x0) == 3^0x0");
Expand Down Expand Up @@ -315,9 +315,9 @@ function main (() : unit) -> unit = {
assert(set_slice_bits(32, 16, 32^0x18, 16, 16^0x5) == 32^0x50018, "set_slice_bits(32, 16, 32^0x18, 16, 16^0x5) == 32^0x50018");
assert(set_slice_bits(32, 16, undefined, 0, 16^0x0) == 32^0x0, "set_slice_bits(32, 16, undefined, 0, 16^0x0) == 32^0x0");
assert(set_slice_bits(32, 17, 32^0x0, 8, 17^0x0) == 32^0x0, "set_slice_bits(32, 17, 32^0x0, 8, 17^0x0) == 32^0x0");
assert(set_slice_bits(32, 2, 32^0x0, 0, 2^0x0) == 32^0x0, "set_slice_bits(32, 2, 32^0x0, 0, 2^0x0) == 32^0x0");
assert(set_slice_bits(32, 2, 32^0x0, 10, 2^0x0) == 32^0x0, "set_slice_bits(32, 2, 32^0x0, 10, 2^0x0) == 32^0x0");
assert(set_slice_bits(32, 2, 32^0x0, 12, 2^0x0) == 32^0x0, "set_slice_bits(32, 2, 32^0x0, 12, 2^0x0) == 32^0x0");
assert(set_slice_bits(32, 2, 32^0x0, 0, 02^0x0) == 32^0x0, "set_slice_bits(32, 2, 32^0x0, 0, 02^0x0) == 32^0x0");
assert(set_slice_bits(32, 2, 32^0x0, 10, 02^0x0) == 32^0x0, "set_slice_bits(32, 2, 32^0x0, 10, 02^0x0) == 32^0x0");
assert(set_slice_bits(32, 2, 32^0x0, 12, 02^0x0) == 32^0x0, "set_slice_bits(32, 2, 32^0x0, 12, 02^0x0) == 32^0x0");
assert(set_slice_bits(32, 28, 32^0x0, 4, 28^0x0) == 32^0x0, "set_slice_bits(32, 28, 32^0x0, 4, 28^0x0) == 32^0x0");
assert(set_slice_bits(32, 28, 32^0x2, 4, 28^0x0) == 32^0x2, "set_slice_bits(32, 28, 32^0x2, 4, 28^0x0) == 32^0x2");
assert(set_slice_bits(32, 28, undefined, 4, 28^0x0) == 32^0x0, "set_slice_bits(32, 28, undefined, 4, 28^0x0) == 32^0x0");
Expand Down Expand Up @@ -544,8 +544,8 @@ function main (() : unit) -> unit = {
assert(set_slice_bits(64, 16, 64^0x10, 16, 16^0x0) == 64^0x10, "set_slice_bits(64, 16, 64^0x10, 16, 16^0x0) == 64^0x10");
assert(set_slice_bits(64, 16, 64^0x10, 32, 16^0x0) == 64^0x10, "set_slice_bits(64, 16, 64^0x10, 32, 16^0x0) == 64^0x10");
assert(set_slice_bits(64, 16, 64^0x10, 48, 16^0x0) == 64^0x10, "set_slice_bits(64, 16, 64^0x10, 48, 16^0x0) == 64^0x10");
assert(set_slice_bits(64, 2, 64^0x0, 34, 2^0x0) == 64^0x0, "set_slice_bits(64, 2, 64^0x0, 34, 2^0x0) == 64^0x0");
assert(set_slice_bits(64, 2, 64^0x0, 8, 2^0x0) == 64^0x0, "set_slice_bits(64, 2, 64^0x0, 8, 2^0x0) == 64^0x0");
assert(set_slice_bits(64, 2, 64^0x0, 34, 02^0x0) == 64^0x0, "set_slice_bits(64, 2, 64^0x0, 34, 02^0x0) == 64^0x0");
assert(set_slice_bits(64, 2, 64^0x0, 8, 02^0x0) == 64^0x0, "set_slice_bits(64, 2, 64^0x0, 8, 02^0x0) == 64^0x0");
assert(set_slice_bits(64, 20, 64^0x0, 44, 20^0x0) == 64^0x0, "set_slice_bits(64, 20, 64^0x0, 44, 20^0x0) == 64^0x0");
assert(set_slice_bits(64, 21, 64^0xa200023, 0, 21^0x23) == 64^0xa200023, "set_slice_bits(64, 21, 64^0xa200023, 0, 21^0x23) == 64^0xa200023");
assert(set_slice_bits(64, 21, undefined, 0, 21^0x23) == 64^0x23, "set_slice_bits(64, 21, undefined, 0, 21^0x23) == 64^0x23");
Expand Down
2 changes: 1 addition & 1 deletion test/builtins/zeros.sail
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function main (() : unit) -> unit = {
assert(zeros(128) == 128^0x0);
assert(zeros(15) == 15^0x0);
assert(zeros(16) == 16^0x0);
assert(zeros(2) == 2^0x0);
assert(zeros(2) == 02^0x0);
assert(zeros(24) == 24^0x0);
assert(zeros(25) == 25^0x0);
assert(zeros(3) == 3^0x0);
Expand Down
6 changes: 3 additions & 3 deletions test/sailtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ def get_sail_dir():
return os.environ['SAIL_DIR']
except KeyError:
try:
p = subprocess.run(["opam", "var", "sail:share"], capture_output=True, text=True)
p = subprocess.run(["sail", "--dir"], capture_output=True, text=True)
except Exception as e:
print('{}Unable to get Sail library directory from opam{}'.format(color.FAIL, color.END))
print('{}Unable to get Sail library directory from sail{}'.format(color.FAIL, color.END))
print(e)
sys.exit(1)

if p.returncode == 0:
return p.stdout.strip()
else:
print('{}Unable to get Sail library directory from opam{}'.format(color.FAIL, color.END))
print('{}Unable to get Sail library directory from sail{}'.format(color.FAIL, color.END))
print('{}stdout{}:'.format(color.NOTICE, color.END))
print(p.stdout)
print('{}stderr{}:'.format(color.NOTICE, color.END))
Expand Down
Loading