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 - Timestamp    -  + test_equal( Regexp("([^-+]*)") +  ->split((string)Timestamp(1850,6,19,2,3,4,12000))[0], +  "1850/06/19 02:03:04.000012") + test_equal( Regexp("([^-+]*)") +  ->split((string)Timestamp(1970,1,1,2,3,4,12000))[0], +  "1970/01/01 02:03:04.000012") + test_equal( Regexp("([^-+]*)") +  ->split((string)Timestamp(2000,1,1,2,3,4,12000))[0], +  "2000/01/01 02:03:04.000012") + test_equal( Regexp("([^-+]*)") +  ->split((string)Timestamp(2000,2,29,2,3,4,12000))[0], +  "2000/02/29 02:03:04.000012") + test_equal( Regexp("([^-+]*)") +  ->split((string)Timestamp(2000,6,17,2,3,4,12000))[0], +  "2000/06/17 02:03:04.000012") + test_equal( Regexp("([^-+]*)") +  ->split((string)Timestamp(2000,11,17,2,3,4,12000))[0], +  "2000/11/17 02:03:04.000012") + test_equal( (int)Timestamp(-2), -2) + test_equal( (int)Timestamp(-1), -1) + test_equal( (int)Timestamp(0), 0) + test_equal( (int)Timestamp(1), 1) + test_equal( (int)(Timestamp(1) + 4), 5) + test_equal( (int)Timestamp(1234567890), 1234567890) +  + dnl - Time +  + test_equal( (string)Time(3,4), "03:04") + test_equal( (string)Time(23,44), "23:44") + test_equal( (string)Time(23,44,12), "23:44:12") + test_equal( (string)Time(23), "00:00:23") + test_equal( (string)Time(23,44,12, 12000), "23:44:12.000012") +  + dnl - TimeTZ +  + test_equal( (string)TimeTZ(23,44,12, 12000), "23:44:12.000012") + test_equal( lambda() { TimeTZ ttz = TimeTZ(23,44); +  ttz->timezone = 3600; +  return (string)ttz;}(), +  "23:44-01") +  + dnl - Date +  + test_equal( (string)Date(2000,1,18), "2000/01/18") + test_equal( (string)Date(2000,6,18), "2000/06/18") + test_equal( (string)Date(1970,1,1), "1970/01/01") + test_equal( (string)Date(1970,1,2), "1970/01/02") + test_equal( (string)Date(1969,12,31), "1969/12/31") + test_equal( (string)Date(1850,12,31), "1850/12/31") + test_equal( (string)Date(1850,12,32), "1851/01/01") + test_equal( (string)Date(1850,13,27), "1851/01/27") + test_equal( (string)Date(1850,14,27), "1851/02/27") + test_equal( (string)(Date(1850,14,27) + 1), "1851/02/28") + test_equal( (string)Date(1234567890), "2009/02/13") +  + dnl - Interval +  + test_equal( (string)Interval(3,1,12,12000), "03:01:12.000012") + test_equal( (string)Interval(3,1,12,12000), "03:01:12.000012") + test_equal( (string)Interval(133,1,12,12000), "133:01:12.000012") + test_equal( (string)Interval(-133,1,12,12000), "-132:58:47.999988") + test_equal( (string)Interval(-133,-1,-12,-12000), "-133:01:12.000012") + test_equal( (string)Interval(-133,1), "-132:59") + test_equal( (string)Interval(-133,-1), "-133:01") + test_equal( (string)Interval(100), "00:01:40") + test_equal( (string)Interval(-100), "-00:01:40") +  + test_equal( Regexp("([^-+]*)") +  ->split((string)(Timestamp(2001,2,3)+Interval(24,4,5)))[0], +  "2001/02/04 00:04:05") + test_equal( Regexp("([^-+]*)") +  ->split((string)(Timestamp(2001,2,3)-Interval(24,4,5)))[0], +  "2001/02/01 23:55:55") + test_equal( Regexp("([^-+]*)") +  ->split((string)(Timestamp(2001,2,3)+Interval(24,4,5)*2))[0], +  "2001/02/05 00:08:10") +  + dnl - Range +  + test_equal( (string)Range(2,5), "[2\54""5\51" ) + test_equal( (string)Range(2,7), "[2\54""7\51" ) + test_equal( (string)Range(2,Math.inf), "[2\54""\51" ) + test_equal( (string)Range(2,2), "empty" ) + test_equal( (string)Range(0,0), "empty" ) + test_equal( (string)Range(), "empty" ) + test_equal( (string)Range(-Math.inf,2), "(\54""2)" ) + test_equal( (string)Range(-Math.inf,Math.inf), "(\54"")" ) +  + test_equal( (string)(Range(2,7) + Range(4,10)), "[2\54""10\51" ) + test_equal( (string)(Range(2,7) - Range(4,10)), "[2\54""4\51" ) + test_equal( (string)(Range(2,7) * Range(4,10)), "[4\54""7\51" ) +  + test_equal( (string)Range(Date(2017,1,1), Date(2017,1,2)), +  "[2017/01/01\54""2017/01/02\51" ) + test_equal( (string)Range(Date(2017,1,3), Date(2017,1,2)), "empty" ) + test_equal( (string)Range(-Math.inf, Date(2017,1,2)), "(,2017/01/02)" ) +  + test_equal( (string)Range(Inet("1.2.3.2"), Inet("1.2.3.4")), +  "[1.2.3.2\54""1.2.3.4\51" ) + test_equal( (string)Range(Inet("1.2.3.7"), Inet("1.2.3.4")), "empty" ) + test_equal( (string)Range(-Math.inf, Inet("1.2.3.4")), "(,1.2.3.4)" ) +  + dnl - Inet +  + test_equal( (string)Inet("255.255.255.255"), "255.255.255.255") + test_equal( (int)Inet("255.255.255.255"), 0xffffffff) + test_equal( (string)Inet("255.255.255.255/20"), "255.255.255.255/20") + test_equal( (int)Inet("255.255.255.255/20"), 0xffffffff) + test_equal( (string)Inet("fffe::"), "fffe::") + test_equal( (string)Inet("fffe::/24"), "fffe::/24") + test_equal( (string)Inet("::1.2.3.4/100"), "1.2.3.4/4") + test_equal( (string)Inet("1.2.3.4/4"), "1.2.3.4/4") + test_equal( (int)Inet("1.2.3.4/4"), 0x01020304) + test_equal( (int)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 })),