pike.git / lib / modules / testsuite.in

version» Context lines:

pike.git/lib/modules/testsuite.in:904:   test_equal( o("x"/" ")->i, 42 )   test_equal( o("x -i 7"/" ")->i, 7 )   test_equal( o("/a/b/c -v"/" ")[Arg.PATH], "/a/b/c" )   test_equal( o("/a/b/c -v"/" ")[Arg.APP], "c")   test_equal( o("x"/" ")->m, 0)   test_equal( o("x -m a"/" ")->m, ({ "a" }))   test_equal( o("x -m a -m b"/" ")->m, ({ "a", "b" }))      test_do(add_constant("o"))    - dnl - Val.Timestamp -  - test_equal( Regexp("([^-+]*)") -  ->split((string)Val.Timestamp(1920,6,19,2,3,4,12000))[0], -  "1920/06/19 02:03:04.000012") - test_equal( Regexp("([^-+]*)") -  ->split((string)Val.Timestamp(1970,1,1,2,3,4,12000))[0], -  "1970/01/01 02:03:04.000012") - test_equal( Regexp("([^-+]*)") -  ->split((string)Val.Timestamp(2000,1,1,2,3,4,12000))[0], -  "2000/01/01 02:03:04.000012") - test_equal( Regexp("([^-+]*)") -  ->split((string)Val.Timestamp(2000,2,29,2,3,4,12000))[0], -  "2000/02/29 02:03:04.000012") - test_equal( Regexp("([^-+]*)") -  ->split((string)Val.Timestamp(2000,6,17,2,3,4,12000))[0], -  "2000/06/17 02:03:04.000012") - test_equal( Regexp("([^-+]*)") -  ->split((string)Val.Timestamp(2000,11,17,2,3,4,12000))[0], -  "2000/11/17 02:03:04.000012") - test_equal( (int)Val.Timestamp(-2), -2) - test_equal( (int)Val.Timestamp(-1), -1) - test_equal( (int)Val.Timestamp(0), 0) - test_equal( (int)Val.Timestamp(1), 1) - test_equal( (int)(Val.Timestamp(1) + 4), 5) - test_equal( (int)Val.Timestamp(1234567890), 1234567890) -  - dnl - Val.Time -  - test_equal( (string)Val.Time(3,4), "03:04") - test_equal( (string)Val.Time(23,44), "23:44") - test_equal( (string)Val.Time(23,44,12), "23:44:12") - test_equal( (string)Val.Time(23), "00:00:23") - test_equal( (string)Val.Time(23,44,12, 12000), "23:44:12.000012") - test_equal( (string)(Val.Time(14,03,33,12000)+Val.Interval(123)), -  "14:05:36.000012") -  - dnl - Val.TimeTZ -  - test_equal( Regexp("([^-+]*)") -  ->split((string)Val.TimeTZ(23,44,12, 12000))[0], "23:44:12.000012") - test_equal( lambda() { Val.TimeTZ ttz = Val.TimeTZ(23,44); -  ttz->timezone = 3600; -  return (string)ttz;}(), -  "23:44-01") - test_equal( Regexp("([^-+]*)") -  ->split((string)(Val.TimeTZ(14,03,33,12000)+Val.Interval(123)))[0], -  "14:05:36.000012") -  - dnl - Val.Date -  - test_equal( (string)Val.Date(2000,1,18), "2000/01/18") - test_equal( (string)Val.Date(2000,6,18), "2000/06/18") - test_equal( (string)Val.Date(1970,1,1), "1970/01/01") - test_equal( (string)Val.Date(1970,1,2), "1970/01/02") - test_equal( (string)Val.Date(1969,12,31), "1969/12/31") - test_equal( (string)Val.Date(1920,12,31), "1920/12/31") - test_equal( (string)Val.Date(1920,12,32), "1921/01/01") - test_equal( (string)Val.Date(1920,13,27), "1921/01/27") - test_equal( (string)Val.Date(1920,14,27), "1921/02/27") - test_equal( (string)(Val.Date(1920,14,27) + 1), "1921/02/28") - test_equal( (string)Val.Date(1234567890), "2009/02/13") -  - test_equal( (int)(Val.Date(2017,7,14)+Val.Time(12,03,33,12000)), -  1500033813) - test_equal( Regexp("([^-+]*)") -  ->split((string)(Val.Date(2017,7,14) -  + Val.TimeTZ(2017,7,14,12,03,33,12000)))[0], -  "2017/07/14 12:03:33.000012") -  - dnl - Val.Interval -  - test_equal( (string)Val.Interval(3,1,12,12000), "03:01:12.000012") - test_equal( (string)Val.Interval(3,1,12,12000), "03:01:12.000012") - test_equal( (string)Val.Interval(133,1,12,12000), "133:01:12.000012") - test_equal( (string)Val.Interval(-133,1,12,12000), "-132:58:47.999988") - test_equal( (string)Val.Interval(-133,-1,-12,-12000), "-133:01:12.000012") - test_equal( (string)Val.Interval(-133,1), "-132:59") - test_equal( (string)Val.Interval(-133,-1), "-133:01") - test_equal( (string)Val.Interval(100), "00:01:40") - test_equal( (string)Val.Interval(-100), "-00:01:40") -  - test_equal( Regexp("([^-+]*)") -  ->split((string)(Val.Timestamp(2001,2,3)+Val.Interval(24,4,5)))[0], -  "2001/02/04 00:04:05") - test_equal( Regexp("([^-+]*)") -  ->split((string)(Val.Timestamp(2001,2,3)-Val.Interval(24,4,5)))[0], -  "2001/02/01 23:55:55") - test_equal( Regexp("([^-+]*)") -  ->split((string)(Val.Timestamp(2001,2,3)+Val.Interval(24,4,5)*2))[0], -  "2001/02/05 00:08:10") -  - test_equal( (string)(Val.Date(2017,12,2) - Val.Date(2017,12,5)), "-3 DAY") - test_equal( (string)(Val.Date(2017,12,5) - Val.Date(2017,12,2)), "3 DAY") - test_equal( (string)(Val.Timestamp(2017,12,5) - Val.Timestamp(2017,12,2)), -  "72:00") - test_equal( (string)(Val.Timestamp(2017,12,5) - Val.Date(2017,12,2)), "72:00") - test_equal( (string)(Val.Date(2017,12,5) - Val.Timestamp(2017,12,2)), "72:00") -  - dnl - Val.Range -  - test_equal( (string)Val.Range(2,5), "[2\54""5\51" ) - test_equal( (string)Val.Range(2,7), "[2\54""7\51" ) - test_equal( (string)Val.Range(2,Math.inf), "[2\54""\51" ) - test_equal( !Val.Range(2,2), 1 ) - test_equal( !Val.Range(3,2), 1 ) - test_equal( !!Val.Range(3,2), 0 ) - test_equal( Val.Range(3,2)->isempty(), 1 ) - test_equal( (string)Val.Range(2,2), "empty" ) - test_equal( (string)Val.Range(0,0), "empty" ) - test_equal( (string)Val.Range(), "empty" ) - test_equal( (string)Val.Range(-Math.inf,2), "(\54""2)" ) - test_equal( (string)Val.Range(-Math.inf,Math.inf), "(\54"")" ) -  - test_equal( Val.Range(2,7)->contains(Val.Range(2,7)), 1 ) - test_equal( Val.Range(2,7)->contains(Val.Range(2,6)), 1 ) - test_equal( Val.Range(2,7)->contains(Val.Range(3,6)), 1 ) - test_equal( Val.Range(2,7)->contains(Val.Range(1,6)), 0 ) - test_equal( Val.Range(2,7)->contains(Val.Range(1,7)), 0 ) - test_equal( Val.Range(2,7)->contains(Val.Range(1,8)), 0 ) - test_equal( Val.Range(2,7)->contains(Val.Range(2,8)), 0 ) - test_equal( Val.Range(2,7)->contains(Val.Range(3,8)), 0 ) - test_equal( Val.Range(2,7)->contains(Val.Range(3,7)), 1 ) - test_equal( Val.Range(2,7)->contains(6), 1 ) - test_equal( Val.Range(2,7)->contains(7), 0 ) - test_equal( Val.Range(2,7)->contains(2), 1 ) - test_equal( Val.Range(2,7)->contains(1), 0 ) -  - test_equal( Val.Range(2,7) << Val.Range(2,7), 0 ) - test_equal( Val.Range(2,7) << Val.Range(5,9), 0 ) - test_equal( Val.Range(2,7) << Val.Range(7,9), 1 ) - test_equal( Val.Range(2,7) << Val.Range(8,9), 1 ) - test_equal( Val.Range(2,7) >> Val.Range(2,7), 0 ) - test_equal( Val.Range(5,9) >> Val.Range(2,7), 0 ) - test_equal( Val.Range(7,9) >> Val.Range(2,7), 1 ) - test_equal( Val.Range(8,9) >> Val.Range(2,7), 1 ) -  - test_equal( (string)(Val.Range(2,4)->merge(Val.Range(7,10))), "[2\54""10\51" ) - test_equal( (string)(Val.Range(3,10)->merge(Val.Range(2,9))), "[2\54""10\51" ) - test_equal( (string)(Val.Range(2,10)->merge(Val.Range(4,9))), "[2\54""10\51" ) - test_equal( (string)(Val.Range(2,7) + Val.Range(4,10)), "[2\54""10\51" ) - test_equal( (string)(Val.Range(2,7) - Val.Range(4,10)), "[2\54""4\51" ) - test_equal( (string)(Val.Range(2,7) * Val.Range(4,10)), "[4\54""7\51" ) -  - test_equal( (string)Val.Range(Val.Date(2017,1,1), Val.Date(2017,1,2)), -  "[2017/01/01\54""2017/01/02\51" ) - test_equal( (string)Val.Range(Val.Date(2017,1,3), Val.Date(2017,1,2)), "empty" ) - test_equal( (string)Val.Range(-Math.inf, Val.Date(2017,1,2)), "(,2017/01/02)" ) -  - test_equal( (string)Val.Range(Val.Inet("1.2.3.2"), Val.Inet("1.2.3.4")), -  "[1.2.3.2\54""1.2.3.4\51" ) - test_equal( (string)Val.Range(Val.Inet("1.2.3.7"), Val.Inet("1.2.3.4")), -  "empty" ) - test_equal( (string)Val.Range(-Math.inf, Val.Inet("1.2.3.4")), "(,1.2.3.4)" ) -  - test_equal( (string)Val.Range(Val.Date(2017,12,2), -  Val.Date(2017,12,5))->interval(), "3 DAY") -  - dnl - Val.Inet -  - test_equal( (string)Val.Inet("255.255.255.255"), "255.255.255.255") - test_equal( (int)Val.Inet("255.255.255.255"), 0xffffffff) - test_equal( (string)Val.Inet("255.255.255.255/20"), "255.255.255.255/20") - test_equal( (int)Val.Inet("255.255.255.255/20"), 0xffffffff) - test_equal( (string)Val.Inet("fffe::"), "fffe::") - test_equal( (string)Val.Inet("fffe::/24"), "fffe::/24") - test_equal( (string)Val.Inet("::1.2.3.4/100"), "1.2.3.4/4") - test_equal( (string)Val.Inet("1.2.3.4/4"), "1.2.3.4/4") - test_equal( (int)Val.Inet("1.2.3.4/4"), 0x01020304) - test_equal( (string)Val.Inet(0x01020304, 128 - 8), "1.2.3.4/24") - test_equal( (int)Val.Inet("fffe::"), 0xfffe0000000000000000000000000000) -  +    dnl - Array      test_equal(Array.diff(({ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }),    ({ 6, 7, 8, 9, 3, 4, 5, 1, 2, 0 })),    ({ ({ ({ 0, 1, 2, 3, 4, 5 }),    ({ 6, 7, 8, 9 }), ({}) }),    ({ ({}), ({ 6, 7, 8, 9 }),    ({ 3, 4, 5, 1, 2, 0 }) }) }))   test_equal(Array.diff(({ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }),    ({ 9, 7, 8, 4, 5, 6, 0, 1, 2, 3 })),
pike.git/lib/modules/testsuite.in:2228:    a[i] = TestResourceCount->acquire();    }    for(i = 0; i < 10; i++) {    a[i] = 0;    a[i] = TestResourceCount->drained();    }    return a;   ]], ({ 0,0,0,0,0,0,0,0,0,1 }))   test_do([[ add_constant("TestResourceCount"); ]])    - test_false(!Val.true) - test_true(!Val.false) - test_eq((int) Val.true, 1) - test_eq((int) Val.false, 0) - test_eq((string) Val.true, "1") - test_eq((string) Val.false, "0") - test_false(Val.true == 0) - test_false(Val.true == 1) - test_false(Val.false == 0) - test_false(Val.false == 1) - test_false(Val.true == Val.false) - test_true(Val.true == Val.true) - test_true(Val.false == Val.false) -  - test_true(!Val.null) - test_eval_error((int) Val.null) - test_eval_error((string) Val.null) - test_false(Val.null == 0) - test_false(Val.null == 1) - test_false(Val.null == Val.true) - test_false(Val.null == Val.false) - test_true(Val.null == Val.null) -  - test_true(decode_value (encode_value (Val.null)) == Val.null) - test_true(decode_value (encode_value (Val.true)) == Val.true) - test_true(decode_value (encode_value (Val.false)) == Val.false) - test_true(decode_value ("\266ke0#\6\5rVal.null") == Val.null) - test_true(decode_value ("\266ke0#\6\5rVal.true") == Val.true) - test_true(decode_value ("\266ke0#\6\6rVal.false") == Val.false) -  - test_true(([Val.null: 1])[Val.null]) - test_false(([Val.false: 1])[Val.null]) - test_false(([0: 1])[Val.null]) - test_true(([Val.true: 1])[Val.true]) - test_false(([Val.true: 1])[Val.false]) - test_true(([Val.false: 1])[Val.false]) - test_false(([Val.true: 1])[Val.false]) -  +    test_any([[    function a = lambda(string x) { return x+"a"; };    function b = lambda(string x) { return x+"b"; };    function q = Function.composite(a, b);    return map("123"/1, q)*"-";   ]], "1ba-2ba-3ba")      END_MARKER