LeOS-Genesis/external/badvpn/ncd/tests/arithmetic.ncd

70 lines
1.0 KiB
Plaintext
Raw Normal View History

2020-10-05 13:12:00 +02:00
process main {
num_lesser("6", "7") r;
assert(r);
num_lesser("7", "7") r;
not(r) a;
assert(a);
num_greater("7", "6") r;
assert(r);
num_greater("7", "7") r;
not(r) a;
assert(a);
num_lesser_equal("7", "7") r;
assert(r);
num_lesser_equal("8", "7") r;
not(r) a;
assert(a);
num_greater_equal("7", "7") r;
assert(r);
num_greater_equal("7", "8") r;
not(r) a;
assert(a);
num_equal("7", "7") r;
assert(r);
num_equal("6", "7") r;
not(r) a;
assert(a);
num_equal("7", "6") r;
not(r) a;
assert(a);
num_different("7", "6") a;
assert(a);
num_different("7", "007") a;
not(a) a;
assert(a);
num_add("4", "7") r;
strcmp(r, "11") a;
assert(a);
num_subtract("4", "3") r;
strcmp(r, "1") a;
assert(a);
num_multiply("4", "5") r;
strcmp(r, "20") a;
assert(a);
num_divide("7", "3") r;
strcmp(r, "2") a;
assert(a);
num_modulo("7", "3") r;
strcmp(r, "1") a;
assert(a);
exit("0");
}