Skip to content

Commit

Permalink
Bit shift tests;
Browse files Browse the repository at this point in the history
  • Loading branch information
JeneLitsch committed Feb 26, 2022
1 parent b9813a8 commit 5d4ef89
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
35 changes: 33 additions & 2 deletions test/arith.ltn
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ namespace test {
return
test_all_cases("Divide/", div, cases) +
test_all_cases("Divide/=", div_eq, cases);

}


Expand All @@ -125,6 +124,36 @@ namespace test {
test_all_cases("Modulo%=", mod_eq, cases);
}

function shift_l() {
var cases = [
[[1, 1], 2],
[[2, 2], 8],
];

var shift = lambda (a, b) {
return a << b;
};

return
test_all_cases("Shift l<<", shift, cases);
}

function shift_r() {
var cases = [
[[1, 1], 0],
[[2, 1], 1],
[[8, 2], 2],
];

var shift = lambda (a, b) {
return a >> b;
};

return
test_all_cases("Shift l<<", shift, cases);
}



function neg() {
var cases = [
Expand All @@ -143,6 +172,8 @@ namespace test {


function arith() {
return add() + sub() + mlt() + div() + mod() + neg();
return
add() + sub() + mlt() + div() + mod() + neg() +
shift_l() + shift_r();
}
}
4 changes: 2 additions & 2 deletions test/exception.ltn
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ namespace test {
};

var cases1 = [
[[ &just_throw(), [] ], true],
[[ &no_throw(), [] ], false],
[[ &just_throw(), [] ], true],
[[ &no_throw(), [] ], false],
[[ &std::remove_back(_), [std::array()] ], true],
[[ &std::remove_back(_), [std::array(42)] ], false],
[[ throws, [1,2] ], true],
Expand Down

0 comments on commit 5d4ef89

Please sign in to comment.