pike.git
/
src
/
testsuite.in
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/testsuite.in:10724:
test_eq(`%(4.5, Gmp.mpz(2)), Gmp.mpz(0)) // - `& test_do([[ class A (int x) { mixed `&(mixed y) { return this_program(x & (objectp(y)?y->x:y)); } }; add_constant("A",A); ]]) test_eq(`&(A(7),A(5))->x, 5)
+
test_eq(`&(A(7),5)->x, 5)
test_eq(`&(A(7),A(5),A(4))->x, 4)
-
+
test_eq(`&(A(7),A(5),4)->x, 4)
test_eval_error([[ class B {} `&(B(),A(5)); ]]) test_do(add_constant("A")); // - `() test_eq(1,`()(a)) test_eq(1,`()(lambda(int a){ return a; },1)) test_eq(1,`()(intp,1)) // - `* test_do([[ class A (int x) { mixed `*(mixed y) { return this_program(x * (objectp(y)?y->x:y)); } }; add_constant("A",A); ]]) test_eq(`*(A(3),A(2))->x, 6)
-
+
test_eq(`*(A(3),2)->x, 6)
test_eq(`*(A(3),A(2),A(5))->x, 30)
-
+
test_eq(`*(A(3),A(2),5)->x, 30)
test_eval_error([[ class B {} `*(B(),A(5)); ]]) test_do(add_constant("A")); // - `+ test_eq(`+(1,1),2) test_eq(`+(1,-2),-1) test_eq(`+(-2,-2),-4)
pike.git/src/testsuite.in:10785:
test_equal(17+class{mixed ``+(mixed n){return (<n>);}}(),(<17>)) test_equal(1700000000000000000000+class{mixed ``+(mixed n){return (<n>);}}(),(<1700000000000000000000>)) test_eval_error(Gmp.mpz(1700000000000000000000)+class{mixed ``+(mixed n){return (<n>);}}()) test_do([[ class A (int x) { mixed `+(mixed y) { return this_program(x + (objectp(y)?y->x:y)); } }; add_constant("A",A); ]]) test_eq(`+(A(3),A(2))->x, 5)
+
test_eq(`+(A(3),2)->x, 5)
test_eq(`+(A(3),A(2),A(5))->x, 10) test_eval_error([[ class B {} `+(B(),A(5)); ]]) test_do(add_constant("A")); test_eq(`+(1.0,2,3.0), 6.0) test_eq(`+(1,2.0,3), 6.0)
pike.git/src/testsuite.in:10836:
add_constant("A",A); ]]) test_eq(`+(({1}),({2}),A()), "({/*2elements*/1,2})") test_eq(`+((<1>),(<2>),A()), "(</*2elements*/1,2>)") test_eq(`+(([1:2]),([3:4]),A()), "([/*2elements*/1:2,3:4])") test_do(add_constant("A")) // - `- test_do([[
-
class A (int x) { mixed `-(mixed y) { return this_program(x - (objectp(y)?y->x:y)); } };
+
class A (int x) {
+
mixed `-(mixed y) { return this_program(x - (objectp(y)?y->x:y)); }
+
// Optimizer will modify the code which requires `+.
+
mixed `+(int y) { return this_program(x+y);
}
+
}
;
add_constant("A",A); ]]) test_eq(`-(A(5),A(2))->x, 3)
-
+
test_eq(`-(A(5),2)->x, 3)
test_eq(`-(A(5),A(2),A(1))->x, 2)
-
+
test_eq(`-(A(5),A(2),1)->x, 2)
test_eval_error([[ class B {} `-(B(),A(5)); ]]) test_do(add_constant("A")); test_do([[ class A (int x) { mixed `-(mixed y) { return this_program(-x); } }; add_constant("A",A); ]])
pike.git/src/testsuite.in:10865:
]]) test_do(add_constant("A")); test_eq(`-(4.5, Gmp.mpz(1)), Gmp.mpz(3)) test_eq(`-(Gmp.mpz(1), 4.5), Gmp.mpz(-3)) // - `-> // - `->= // - `/
+
test_do([[
+
class A (int x) { mixed `/(mixed y) { return this_program(x / (objectp(y)?y->x:y)); } };
+
add_constant("A",A);
+
]])
+
test_eq(`/(A(8),A(2))->x, 4)
+
test_eq(`/(A(8),2)->x, 4)
+
test_eq(`/(A(8),A(2),A(2))->x, 2)
+
test_eq(`/(A(8),A(2),2)->x, 2)
+
test_eval_error([[
+
class B {}
+
`/(B(),A(5));
+
]])
+
test_do(add_constant("A"));
+
test_eq(`/(4.5, Gmp.mpz(2)), 2.25) test_eq(`/(Gmp.mpz(2), 4.0), 0.5)) // - `< // - `<< // - `<= // - `== // - `> // - `>= // - `>>
pike.git/src/testsuite.in:10898:
]]) test_do(add_constant("A")); // - `| test_do([[ class A (int x) { mixed `|(mixed y) { return this_program(x | (objectp(y)?y->x:y)); } }; add_constant("A",A); ]]) test_eq(`|(A(3),A(6))->x, 7)
+
test_eq(`|(A(3),6)->x, 7)
test_eq(`|(A(3),A(6),A(9))->x, 15)
-
+
test_eq(`|(A(3),A(6),9)->x, 15)
test_eval_error([[ class B {} `|(B(),A(5)); ]]) test_do(add_constant("A")); // - `~ test_do([[ class A (int x) { mixed `~() { return this_program(~x); } };