pike.git
/
src
/
testsuite.in
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/testsuite.in:7328:
test_eq("-6442450941", [[ (string)(0x7fffffff * -3) ]]) test_eq(-2147483648*-1,2147483648) test_eq(-9223372036854775808*-1,9223372036854775808) // Division. test_eq("1073741824", [[ (string)((int)"2147483648" / 2) ]]) test_false([[ objectp((int)"2147483648" / 2) ]]) test_eq("13934998268672547360069539025", [[ (string)(48324683476346278246238462784624627348 / 3467864333) ]])
-
// sprintf (and the describe stuff in the master)
-
test_do([[sprintf ("%O", 10->pow);]])
-
+
// - sscanf. test_eq("12345678901234567890", [[ (string)array_sscanf("12345678901234567890", "%d")[0] ]]) test_eq("1375488932614371410344080", [[ (string)array_sscanf("123456789F01234567890", "%x")[0] ]]) test_eq("1375488932614371410344080", [[ (string)array_sscanf("0x123456789F01234567890", "%x")[0] ]]) test_eq("1375488932614371410344080", [[ (string)array_sscanf("0X123456789F01234567890", "%x")[0] ]]) test_eq("1375488932614371410344080",
pike.git/src/testsuite.in:13203:
class X { mixed test(int a, mixed ... b) { if(a) return test(0); return b; } }; return X()->test(1,2); ]],[[ ({}) ]])
-
//
-
sprintf
module
+
// sprintf
dnl This really belongs to sscanf, but... test_eq([[ array_sscanf(sprintf("%1c", -1), "%1c")[0] ]], 255) test_eq([[ array_sscanf(sprintf("%2c", -1), "%2c")[0] ]], 65535) test_eq([[ array_sscanf(sprintf("%3c", -1), "%3c")[0] ]], 16777215) test_eq([[ sprintf("%4c",16909060) ]],"\1\2\3\4") test_eq([[ sprintf("%-4c",16909060) ]],"\4\3\2\1") test_eq([[ sprintf("%2c",16909060) ]],"\3\4") test_eq([[ sprintf("%-2c",16909060) ]],"\4\3")
pike.git/src/testsuite.in:13492:
test_eq(sprintf("%4H", ""),"\0\0\0\0") test_eq(sprintf("%4H", "hello"),"\0\0\0\5hello") test_eq(sprintf("%-4H", ""),"\0\0\0\0") test_eq(sprintf("%-4H", "hello"),"\5\0\0\0hello") test_do(sprintf("%9H", "x"*300);); test_eval_error(return sprintf("%H", "\x100");) test_do(return sprintf("%1H", "x"*255);) test_eval_error(return sprintf("%1H", "x"*256);)
+
test_do(add_constant("OBJ",class { string _sprintf(int t) { return sprintf("%c",t); } }() ))
+
test_eq(sprintf("%t", OBJ),"t")
+
test_eq(sprintf("%c", OBJ),"c")
+
test_eq(sprintf("%H", OBJ),"H")
+
test_eq(sprintf("%b", OBJ),"b")
+
test_eq(sprintf("%o", OBJ),"o")
+
test_eq(sprintf("%d", OBJ),"d")
+
test_eq(sprintf("%u", OBJ),"u")
+
test_eq(sprintf("%x", OBJ),"x")
+
test_eq(sprintf("%X", OBJ),"X")
+
test_eq(sprintf("%e", OBJ),"e")
+
test_eq(sprintf("%f", OBJ),"f")
+
test_eq(sprintf("%g", OBJ),"g")
+
test_eq(sprintf("%E", OBJ),"E")
+
test_eq(sprintf("%G", OBJ),"G")
+
test_eq(sprintf("%F", OBJ),"F")
+
test_eq(sprintf("%O", OBJ),"O")
+
test_eq(sprintf("%s", OBJ),"s")
+
test_eq(sprintf("%q", OBJ),"q")
+
test_do(add_constant("OBJ"))
+
dnl / : ; ^ _ > hasn't been tested test_eval_error(return sprintf("%d");) test_eq(sprintf("%O", class { string _sprintf(int type) { return "\t"; } }()), "\t") END_MARKER