Skip to content

Commit

Permalink
tests: adds trivial +mas jet tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joemfb committed Nov 11, 2023
1 parent 817fac4 commit c64d626
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions pkg/noun/jets_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,71 @@ _test_ob(void)
return ret_i;
}

static c3_i
_test_mas(void)
{
c3_i ret_i = 1;
u3_atom res;

if ( 0x4000 != (res = u3qc_mas(0x8000)) ) {
fprintf(stderr, "test mas fail: (mas 0x8000) != 0x4000: 0x'%x'\r\n", res);
ret_i = 0;
}

if ( 0x20000000 != (res = u3qc_mas(0x40000000)) ) {
fprintf(stderr, "test mas fail: (mas 0x4000.0000) != 0x2000.0000: 0x%x\r\n", res);
ret_i = 0;
}

{
u3_atom sam, pro;

sam = u3qc_bex(36);
pro = u3qc_bex(35);
res = u3qc_mas(sam);

if ( c3n == u3r_sing(pro, res) ) {
c3_c* out_c;
u3s_etch_ux_c(res, &out_c);
fprintf(stderr, "test mas fail: (mas (bex 36)) != (bex 35): %s\r\n", out_c);
c3_free(out_c);
ret_i = 0;
}

u3z(res); u3z(sam); u3z(pro);

sam = u3qc_bex(64);
pro = u3qc_bex(63);
res = u3qc_mas(sam);

if ( c3n == u3r_sing(pro, res) ) {
c3_c* out_c;
u3s_etch_ux_c(res, &out_c);
fprintf(stderr, "test mas fail: (mas (bex 64)) != (bex 63): %s\r\n", out_c);
c3_free(out_c);
ret_i = 0;
}

u3z(res); u3z(sam); u3z(pro);

sam = u3qc_bex(65);
pro = u3qc_bex(64);
res = u3qc_mas(sam);

if ( c3n == u3r_sing(pro, res) ) {
c3_c* out_c;
u3s_etch_ux_c(res, &out_c);
fprintf(stderr, "test mas fail: (mas (bex 65)) != (bex 64): %s\r\n", out_c);
c3_free(out_c);
ret_i = 0;
}

u3z(res); u3z(sam); u3z(pro);
}

return ret_i;
}

static c3_i
_test_jets(void)
{
Expand Down Expand Up @@ -900,6 +965,11 @@ _test_jets(void)
ret_i = 0;
}

if ( !_test_mas() ) {
fprintf(stderr, "test jets: mas: failed\r\n");
ret_i = 0;
}

return ret_i;
}

Expand Down

0 comments on commit c64d626

Please sign in to comment.