pike.git
/
src
/
testsuite.in
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/testsuite.in:859:
test_equal([[ typeof(sprintf("%c", 1023)); ]], [[ typeof([string(1023)](mixed)""); ]]); test_equal([[ typeof(sprintf("%c\n", 1023)); ]], [[ typeof([string(10 | 1023)](mixed)""); ]]); dnl The following is due to (string & sprintf_result) == sprintf_result. test_equal([[ typeof(sprintf("%c\n", Stdio)); ]], [[ sprintf_result; ]]); test_equal([[ typeof(sprintf("%4[1]c", 17)); ]], [[ typeof([string(8bit)](mixed)"") ]]); test_equal([[ typeof(sprintf("%[1]n", 17)); ]],
-
[[ typeof(
[string(zero)](mixed)
"") ]]);
+
[[ typeof("") ]]);
test_equal([[ typeof(aggregate("foo"));]], [[ typeof([array(string(3: 102..111))](mixed)({})) ]]); test_any([[int a; return sprintf("%O", typeof(aggregate(a)));]], "array(int)"); test_any([[int|string a; string s = sprintf("%O", typeof(aggregate(a))); return (< "array(string) | array(int)", "array(string | int)", "array(int | string)" >)[s];]], 1); test_any([[return sprintf("%O", typeof(aggregate()));]], "array(zero:)"); test_any([[int i; return (< "int", "int | zero", "zero | int" >) [sprintf("%O", typeof(max(i,0)))];]], 1)
pike.git/src/testsuite.in:11612:
test_equal(`+(([0:1,3:6]),([5:2,3:6])),([0:1,3:6,3:6,5:2])) test_equal(`+(UNDEFINED,([1:2]),([3:4])), ([1:2,3:4])) test_equal(`+(([1:2]),UNDEFINED,([3:4])), ([1:2,3:4])) test_equal(17+class{protected mixed ``+(mixed n){return (<n>);}}(),(<17>)) test_equal(1700000000000000000000+class{protected mixed ``+(mixed n){return (<n>);}}(),(<1700000000000000000000>)) test_eval_error(Gmp.mpz(1700000000000000000000)+class{protected mixed ``+(mixed n){return (<n>);}}()) test_do([[
-
class A (int x) { protected
mixed
`+(mixed y) { return this_program(x + (objectp(y)?y->x:y)); } };
+
class A (int x) {
+
protected
this_program
`+(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_do([[
-
class A (int x) { protected
mixed
``+(mixed y) { return this_program(x + (objectp(y)?y->x:y)); } };
+
class A (int x) {
+
protected
this_program
``+(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(`+(3,A(2))->x, 5) test_eq(`+(A(3),A(2),A(5))->x, 10) test_eq(`+(3,A(2),A(5))->x, 10) test_do(add_constant("A")); test_eq(`+(1.0,2,3.0), 6.0) test_eq(`+(1,2.0,3), 6.0) test_do([[ class A {
-
protected
mixed
`+(
string
s) { return "`+"+s; }
-
protected
mixed
``+(
string
s) { return s+"``+"; }
-
protected
mixed
`+=(
string
s) { return "`+="+s; }
+
protected
string
`+(
mixed
s) { return "`+"+s; }
+
protected
string
``+(
mixed
s) { return s+"``+"; }
+
protected
string
`+=(
mixed
s) { return "`+="+s; }
}; add_constant("A",A); ]]) test_eq(`+(A(),"e"), "`+=e") test_any([[ array a=({ A() }); return `+(a[0],"e"); ]], "`+e") test_eq(`+("e",A()), "e``+") dnl test_eq(`+(UNDEFINED,"x"), "x")
pike.git/src/testsuite.in:11721:
}; add_constant("A",A); ]]) test_eq(`-(A(5),A(2))->x, 3) test_eq(`-(5,A(2))->x, 3) test_eq(`-(A(5),A(2),A(1))->x, 2) test_eq(`-(5,A(2),A(1))->x, 2) test_do(add_constant("A")); test_do([[
-
class A (int x) { protected
mixed
`-(mixed y) { return this_program(-x); } };
+
class A (int x) {
+
protected
this_program
`-(mixed
|void
y) {
+
return this_program(-x);
+
}
+
};
add_constant("A",A); ]]) test_eq(`-(A(5))->x, -5) test_eval_error([[ class B {}; return `-(B()); ]]) test_do(add_constant("A")); test_eq(`-(4.5, Gmp.mpz(1)), Gmp.mpz(3))