[PHP-CVS] cvs: php-src /ext/json/tests pass001.1.phpt
dmitry Tue Jul 10 07:51:23 2007 UTC Modified files: /php-src/ext/json/tests pass001.1.phpt Log: Fixed test http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/pass001.1.phpt?r1=1.8&r2=1.9&diff_format=u Index: php-src/ext/json/tests/pass001.1.phpt diff -u php-src/ext/json/tests/pass001.1.phpt:1.8 php-src/ext/json/tests/pass001.1.phpt:1.9 --- php-src/ext/json/tests/pass001.1.phpt:1.8 Fri Jun 8 09:03:23 2007 +++ php-src/ext/json/tests/pass001.1.phpt Tue Jul 10 07:51:23 2007 @@ -383,7 +383,7 @@ float(1.23456789E-13) ["E"]=> float(1.23456789E+34) -["_empty_"]=> +[""]=> float(INF) ["E no ."]=> float(4) @@ -527,9 +527,9 @@ string(7) "rosebud" } ENCODE: FROM OBJECT -["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},{},[],-42,true,false,null,{"integer":1234567890,"real":-9876.54321,"e":1.23456789e-13,"E":1.23456789e+34,"_empty_":0,"E no .":4.0e+12,"zero":0,"one":1,"space":" ","quote":"\"","backslash":"\\","controls":"\b\f\n\r\t","slash":"\/ & \/","alpha":"abcdefghijklmnopqrstuvwyz","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","digit":"0123456789","special":"[EMAIL PROTECTED]&*()_+-={':[,]}|;.<\/>?","hex":"\u0123\u4567\u89ab\ucdef\uabcd\uef4a","unicode":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","empty_string":"","true":true,"false":false,"null":null,"array":[],"object":{},"123":{"456":{"abc":{"789":"def","012":[1,2,"5",500],"ghi":[1,2,"five",50,"sixty"]}}},"address":"50 St. James Street","url":"http:\/\/www.JSON.org\/","comment":"\/\/ \/* *\/":" "," s p a c e d ":[1,2,3,4,5,6,7],"compact":[1,2,3,4,5,6,7],"jsontext":"{\"object with 1 me! mber\":[\"array with 1 element\"]}","quotes":"" \" %22 0x22 034 "","\/\\\"[EMAIL PROTECTED]&*()_+-=[]{}|;:',.\/<>?":"A key can be any string"},0.5,98.6,99.44,1066,"rosebud"] +["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},{},[],-42,true,false,null,{"integer":1234567890,"real":-9876.54321,"e":1.23456789e-13,"E":1.23456789e+34,"_empty_":0,"E no .":4,"zero":0,"one":1,"space":" ","quote":"\"","backslash":"\\","controls":"\b\f\n\r\t","slash":"\/ & \/","alpha":"abcdefghijklmnopqrstuvwyz","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","digit":"0123456789","special":"[EMAIL PROTECTED]&*()_+-={':[,]}|;.<\/>?","hex":"\u0123\u4567\u89ab\ucdef\uabcd\uef4a","unicode":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","empty_string":"","true":true,"false":false,"null":null,"array":[],"object":{},"123":{"456":{"abc":{"789":"def","012":[1,2,"5",500],"ghi":[1,2,"five",50,"sixty"]}}},"address":"50 St. James Street","url":"http:\/\/www.JSON.org\/","comment":"\/\/ \/* *\/":" "," s p a c e d ":[1,2,3,4,5,6,7],"compact":[1,2,3,4,5,6,7],"jsontext":"{\"object wit! h 1 member\":[\"array with 1 element\"]}","quotes":"" \" %22 0x22 034 "","\/\\\"[EMAIL PROTECTED]&*()_+-=[]{}|;:',.\/<>?":"A key can be any string"},0.5,98.6,99.44,1066,"rosebud"] ENCODE: FROM ARRAY -["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},[],[],-42,true,false,null,{"integer":1234567890,"real":-9876.54321,"e":1.23456789e-13,"E":1.23456789e+34,"_empty_":0,"E no .":4.0e+12,"zero":0,"one":1,"space":" ","quote":"\"","backslash":"\\","controls":"\b\f\n\r\t","slash":"\/ & \/","alpha":"abcdefghijklmnopqrstuvwyz","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","digit":"0123456789","special":"[EMAIL PROTECTED]&*()_+-={':[,]}|;.<\/>?","hex":"\u0123\u4567\u89ab\ucdef\uabcd\uef4a","unicode":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","empty_string":"","true":true,"false":false,"null":null,"array":[],"object":[],"123":{"456":{"abc":{"789":"def","012":[1,2,"5",500],"ghi":[1,2,"five",50,"sixty"]}}},"address":"50 St. James Street","url":"http:\/\/www.JSON.org\/","comment":"\/\/ \/* *\/":" "," s p a c e d ":[1,2,3,4,5,6,7],"compact":[1,2,3,4,5,6,7],"jsontext":"{\"object with 1 me! mber\":[\"array with 1 element\"]}","quotes":"" \" %22 0x22 034 "","\/\\\"[EMAIL PROTECTED]&*()_+-=[]{}|;:',.\/<>?":"A key can be any string"},0.5,98.6,99.44,1066,"rosebud"] +["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},[],[],-42,true,false,null,{"integer":1234567890,"real":-9876.54321,"e":1.23456789e-13,"E":1.23456789e+34,"":0,"E no .":4,"zero":0,"one":1,"space":" ","quote":"\"","backslash":"\\","controls":"\b\f\n\r\t","slash":"\/ & \/","alpha":"abcdefghijklmnopqrstuvwyz","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","digit":"0123456789","special":"[EMAIL PROTECTED]&*()_+-={':[,]}|;.<\/>?","hex":"\u0123\u4567\u89ab\ucdef\uabcd\uef4a","unicode":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","empty_string":"","true":true,"false":false,"null":null,"array"
[PHP-CVS] cvs: php-src /ext/json/tests pass001.1.phpt pass001.1_64bit.phpt pass001.phpt
tony2001Fri Jun 8 09:03:23 2007 UTC Modified files: /php-src/ext/json/tests pass001.1_64bit.phpt pass001.1.phpt pass001.phpt Log: fix tests http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/pass001.1_64bit.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/json/tests/pass001.1_64bit.phpt diff -u /dev/null php-src/ext/json/tests/pass001.1_64bit.phpt:1.2 --- /dev/null Fri Jun 8 09:03:23 2007 +++ php-src/ext/json/tests/pass001.1_64bit.phpt Fri Jun 8 09:03:23 2007 @@ -0,0 +1,1674 @@ +--TEST-- +JSON (http://www.crockford.com/JSON/JSON_checker/test/pass1.json) +--INI-- +precision=14 +--SKIPIF-- + +--FILE-- +?\", +\"hex\": \"\\u0123\\u4567\\u89AB\\uCDEF\\uabcd\\uef4A\", +\"unicode\": \"\\u30d7\\u30ec\\u30b9\\u30ad\\u30c3\\u30c8\", +\"ãã¬ã¹ããã\": \"ãã¬ã¹ããã\", +\"empty_string\": \"\", +\"true\": true, +\"false\": false, +\"null\": null, +\"array\":[ ], +\"object\":{ }, + \"123\":{\"456\":{\"abc\":{\"789\":\"def\",\"012\":[1,2,\"5\",500],\"ghi\":[1,2,\"five\",50,\"sixty\"]}}}, +\"address\": \"50 St. James Street\", +\"url\": \"http://www.JSON.org/\";, +\"comment\": \"// /* */\": \" \", +\" s p a c e d \" :[1,2 , 3 + +, + +4 , 5, 6 ,7], +\"compact\": [1,2,3,4,5,6,7], +\"jsontext\": \"{\\\"object with 1 member\\\":[\\\"array with 1 element\\\"]}\", +\"quotes\": \"" \\u0022 %22 0x22 034 "\", +\"\\/\\\"[EMAIL PROTECTED]&*()_+-=[]{}|;:',./<>?\" +: \"A key can be any string\" +}, +0.5 ,98.6 +, +99.44 +, + +1066 + + +,\"rosebud\"] +"; + +echo 'Testing: ' . $test . "\n"; +echo "DECODE: AS OBJECT\n"; +$obj = json_decode($test); +var_dump($obj); +echo "DECODE: AS ARRAY\n"; +$arr = json_decode($test, true); +var_dump($arr); + +echo "ENCODE: FROM OBJECT\n"; +$obj_enc = json_encode($obj); +echo $obj_enc . "\n"; +echo "ENCODE: FROM ARRAY\n"; +$arr_enc = json_encode($arr); +echo $arr_enc . "\n"; + +echo "DECODE AGAIN: AS OBJECT\n"; +$obj = json_decode($obj_enc); +var_dump($obj); +echo "DECODE AGAIN: AS ARRAY\n"; +$arr = json_decode($arr_enc, true); +var_dump($arr); + +?> +--EXPECTF-- +Testing: +[ +"JSON Test Pattern pass1", +{"object with 1 member":["array with 1 element"]}, +{}, +[], +-42, +true, +false, +null, +{ +"integer": 1234567890, +"real": -9876.543210, +"e": 0.123456789e-12, +"E": 1.234567890E+34, +"": 23456789012E666, +"E no .": 4E12, +"zero": 0, +"one": 1, +"space": " ", +"quote": "\"", +"backslash": "\\", +"controls": "\b\f\n\r\t", +"slash": "/ & \/", +"alpha": "abcdefghijklmnopqrstuvwyz", +"ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ", +"digit": "0123456789", +"special": "[EMAIL PROTECTED]&*()_+-={':[,]}|;.?", +"hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A", +"unicode": "\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8", +"ãã¬ã¹ããã": "ãã¬ã¹ããã", +"empty_string": "", +"true": true, +"false": false, +"null": null, +"array":[ ], +"object":{ }, + "123":{"456":{"abc":{"789":"def","012":[1,2,"5",500],"ghi":[1,2,"five",50,"sixty"]}}}, +"address": "50 St. James Street", +"url": "http://www.JSON.org/";, +"comment": "// /* */": " ", +" s p a c e d " :[1,2 , 3 + +, + +4 , 5, 6 ,7], +"compact": [1,2,3,4,5,6,7], +"jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}", +"quotes": "" \u0022 %22 0x22 034 "", +"\/\\\"[EMAIL PROTECTED]&*()_+-=[]{}|;:',./<>?" +: "A key can be any string" +}, +0.5 ,98.6 +, +99.44 +, + +1066 + + +,"rosebud"] + +DECODE: AS OBJECT +array(14) { + [0]=> + string(23) "JSON Test Pattern pass1" + [1]=> + object(stdClass)#%d (1) { +["object with 1 member"]=> +array(1) { + [0]=> + string(20) "array with 1 element" +} + } + [2]=> + object(stdClass)#%d (0) { + } + [3]=> + array(0) { + } + [4]=> + int(-42) + [5]=> + bool(true) + [6]=> + bool(false) + [7]=> + NULL + [8]=> + object(stdClass)#%d (36) { +["integer"]=> +int(1234567890) +["real"]=> +float(-9876.54321) +["e"]=> +float(1.23456789E-13) +["E"]=> +float(1.23456789E+34) +["_empty_"]=> +float(INF) +["E no ."]=> +float(4) +["zero"]=> +int(0) +["one"]=> +int(1) +["space"]=> +string(1) " " +["quote"]=> +string(1) """ +["backslash"]=> +string(1) "\" +["controls"]=> +string(5) " + " +["slash"]=> +string(5) "/ & /" +["alpha"]=> +string(25) "abcdefghijklmnopqrstuvwyz" +["ALPHA"]=> +string(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ
[PHP-CVS] cvs: php-src /ext/json/tests pass001.1.phpt
tony2001Fri Apr 20 10:15:12 2007 UTC Modified files: /php-src/ext/json/tests pass001.1.phpt Log: fix test http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/pass001.1.phpt?r1=1.5&r2=1.6&diff_format=u Index: php-src/ext/json/tests/pass001.1.phpt diff -u php-src/ext/json/tests/pass001.1.phpt:1.5 php-src/ext/json/tests/pass001.1.phpt:1.6 --- php-src/ext/json/tests/pass001.1.phpt:1.5 Thu Oct 19 20:17:17 2006 +++ php-src/ext/json/tests/pass001.1.phpt Fri Apr 20 10:15:12 2007 @@ -204,7 +204,7 @@ ["_empty_"]=> float(INF) ["E no ."]=> -float(4.0E+12) +float(4) ["zero"]=> int(0) ["one"]=> @@ -383,7 +383,7 @@ ["_empty_"]=> float(INF) ["E no ."]=> -float(4.0E+12) +float(4) ["zero"]=> int(0) ["one"]=> @@ -566,7 +566,7 @@ ["_empty_"]=> int(0) ["E no ."]=> -float(4.0E+12) +float(4) ["zero"]=> int(0) ["one"]=> @@ -745,7 +745,7 @@ ["_empty_"]=> int(0) ["E no ."]=> -float(4.0E+12) +float(4) ["zero"]=> int(0) ["one"]=> @@ -988,7 +988,7 @@ [u"_empty_"]=> float(INF) [u"E no ."]=> -float(4.0E+12) +float(4) [u"zero"]=> int(0) [u"one"]=> @@ -1167,7 +1167,7 @@ [u"_empty_"]=> float(INF) [u"E no ."]=> -float(4.0E+12) +float(4) [u"zero"]=> int(0) [u"one"]=> @@ -1350,7 +1350,7 @@ [u"_empty_"]=> int(0) [u"E no ."]=> -float(4.0E+12) +float(4) [u"zero"]=> int(0) [u"one"]=> @@ -1529,7 +1529,7 @@ [u"_empty_"]=> int(0) [u"E no ."]=> -float(4.0E+12) +float(4) [u"zero"]=> int(0) [u"one"]=> -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php