From 59f4475466ce86a003fc7cb7a224c9cb828fbbad Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 25 Jun 2016 17:42:59 -0400 Subject: [PATCH] Tests: Removed JSON tests --- test/.gitignore | 1 - test/CMakeLists.txt | 4 +- test/json.t.cpp | 189 ---------------------------------------- test/json/1.json | 23 ----- test/json/2.json | 11 --- test/json/3.json | 26 ------ test/json/4.json | 88 ------------------- test/json/5.json | 27 ------ test/json/6.json | 2 - test/json/e1.json | 1 - test/json/e2.json | 30 ------- test/json/e3.json | 4 - test/json/e4.json | 26 ------ test/json/e5.json | 70 --------------- test/json/e6.json | 17 ---- test/json/e7.json | 34 -------- test/json/e8.json | 36 -------- test/json/facebook.json | 44 ---------- test/json/flikr.json | 21 ----- test/json/interop.json | 41 --------- test/json/iphone.json | 77 ---------------- test/json/twitter.json | 50 ----------- test/json/youtube.json | 53 ----------- test/json_test.cpp | 87 ------------------ test/json_test.t | 83 ------------------ 25 files changed, 2 insertions(+), 1043 deletions(-) delete mode 100644 test/json.t.cpp delete mode 100644 test/json/1.json delete mode 100644 test/json/2.json delete mode 100644 test/json/3.json delete mode 100644 test/json/4.json delete mode 100644 test/json/5.json delete mode 100644 test/json/6.json delete mode 100644 test/json/e1.json delete mode 100644 test/json/e2.json delete mode 100644 test/json/e3.json delete mode 100644 test/json/e4.json delete mode 100644 test/json/e5.json delete mode 100644 test/json/e6.json delete mode 100644 test/json/e7.json delete mode 100644 test/json/e8.json delete mode 100644 test/json/facebook.json delete mode 100644 test/json/flikr.json delete mode 100644 test/json/interop.json delete mode 100644 test/json/iphone.json delete mode 100644 test/json/twitter.json delete mode 100644 test/json/youtube.json delete mode 100644 test/json_test.cpp delete mode 100755 test/json_test.t diff --git a/test/.gitignore b/test/.gitignore index aae3c5865..dd2709758 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -13,7 +13,6 @@ fs.t i18n.t iso8601d.t iso8601p.t -json.t lexer.t list.t msg.t diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4bb26533e..6a4d15834 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -14,9 +14,9 @@ include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/test ${TASK_INCLUDE_DIRS}) -set (test_SRCS autocomplete.t col.t color.t config.t fs.t i18n.t json.t list.t +set (test_SRCS autocomplete.t col.t color.t config.t fs.t i18n.t list.t msg.t nibbler.t t.t tdb2.t text.t utf8.t util.t view.t - json_test lexer.t iso8601d.t iso8601p.t eval.t dates.t + lexer.t iso8601d.t iso8601p.t eval.t dates.t variant_add.t variant_and.t variant_cast.t variant_divide.t variant_equal.t variant_exp.t variant_gt.t variant_gte.t variant_inequal.t variant_lt.t variant_lte.t variant_match.t diff --git a/test/json.t.cpp b/test/json.t.cpp deleted file mode 100644 index 9c3a948ad..000000000 --- a/test/json.t.cpp +++ /dev/null @@ -1,189 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// http://www.opensource.org/licenses/mit-license.php -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include -#include - -Context context; - -const char *positive_tests[] = -{ - "{}", - - " { } ", - - "[]", - - "{\"one\":1}", - - "{\n\"one\"\n:\n1\n}\n", - - " { \"one\" : 1 } ", - - "{\"name\":123, \"array\":[1,2,3.4], \"object\":{\"m1\":\"v1\", \"m2\":\"v2\"}}", - - "{\"name\":\"value\",\"array\":[\"one\",\"two\"],\"object\":{\"name2\":123,\"literal\":false}}", - - "{\n" - "\"ticket\": { \"type\":\"add\", \"client\":\"taskwarrior 2.x\"},\n" - "\"auth\": { \"user\":\"paul\", \"org\":\"gbf\", \"key\":\".........\",\n" - " \"locale\":\"en-US\" },\n" - "\n" - "\"add\": { \"description\":\"Wash the dog\",\n" - " \"project\":\"home\",\n" - " \"due\":\"20101101T000000Z\" }\n" - "}", - - "{" - "\"ticket\":{" - "\"type\":\"synch\"," - "\"client\":\"taskd-test-suite 1.0\"" - "}," - "\"synch\":{" - "\"user\":{" - "\"data\":[" - "{" - "\"uuid\":\"11111111-1111-1111-1111-111111111111\"," - "\"status\":\"pending\"," - "\"description\":\"This is a test\"," - "\"entry\":\"20110111T124000Z\"" - "}" - "]," - "\"synch\":\"key\"" - "}" - "}," - "\"auth\":{" - "\"org\":\"gbf\"," - "\"user\":\"Paul Beckingham\"," - "\"key\":\"K\"," - "\"locale\":\"en-US\"" - "}" - "}" -}; - -#define NUM_POSITIVE_TESTS (sizeof (positive_tests) / sizeof (positive_tests[0])) - -const char *negative_tests[] = -{ - "", - "{", - "}", - "[", - "]", - "foo", - "[?]" -}; - -#define NUM_NEGATIVE_TESTS (sizeof (negative_tests) / sizeof (negative_tests[0])) - -//////////////////////////////////////////////////////////////////////////////// -int main (int, char**) -{ - UnitTest t (NUM_POSITIVE_TESTS + NUM_NEGATIVE_TESTS + 22); - - // Ensure environment has no influence. - unsetenv ("TASKDATA"); - unsetenv ("TASKRC"); - - // Positive tests. - for (unsigned int i = 0; i < NUM_POSITIVE_TESTS; ++i) - { - try - { - json::value* root = json::parse (positive_tests[i]); - t.ok (root, std::string ("positive: ") + positive_tests[i]); - if (root) - { - t.diag (root->dump ()); - delete root; - } - } - - catch (const std::string& e) { t.diag (e); } - catch (...) { t.diag ("Unknown error"); } - } - - // Negative tests. - for (unsigned int i = 0; i < NUM_NEGATIVE_TESTS; ++i) - { - try - { - json::value* root = json::parse (negative_tests[i]); - t.is ((const char*) root, (const char*) NULL, - std::string ("negative: ") + negative_tests[i]); - } - - catch (const std::string& e) { t.pass (e); } - catch (...) { t.fail ("Unknown error"); } - } - - // Other tests. - try - { - // Regular unit tests. - t.is (json::encode ("1\b2"), "1\\b2", "json::encode slashslashb -> slashslashslashslashb"); - t.is (json::decode ("1\\b2"), "1\b2", "json::decode slashslashslashslashb -> slashslashb"); - - t.is (json::encode ("1\n2"), "1\\n2", "json::encode slashslashn -> slashslashslashslashn"); - t.is (json::decode ("1\\n2"), "1\n2", "json::decode slashslashslashslashn -> slashslashn"); - - t.is (json::encode ("1\r2"), "1\\r2", "json::encode slashslashr -> slashslashslashslashr"); - t.is (json::decode ("1\\r2"), "1\r2", "json::decode slashslashslashslashr -> slashslashr"); - - t.is (json::encode ("1\t2"), "1\\t2", "json::encode slashslasht -> slashslashslashslasht"); - t.is (json::decode ("1\\t2"), "1\t2", "json::decode slashslashslashslasht -> slashslasht"); - - t.is (json::encode ("1\\2"), "1\\\\2", "json::encode slashslash -> slashslashslashslash"); - t.is (json::decode ("1\\\\2"), "1\\2", "json::decode slashslashslashslash -> slashslash"); - - t.is (json::encode ("1\x2"), "1\x2", "json::encode slashslashx -> slashslashx(NOP)"); - t.is (json::decode ("1\x2"), "1\x2", "json::decode slashslashx -> slashslashx(NOP)"); - - t.is (json::encode ("1€2"), "1€2", "json::encode € -> €"); - t.is (json::decode ("1\\u20ac2"), "1€2", "json::decode slashslashu20ac -> €"); - - std::string encoded = json::encode ("one\\"); - t.is (encoded, "one\\\\", "json::encode oneslashslashslashslash -> oneslashslashslashslashslashslashslashslash"); - t.is ((int)encoded.length (), 5, "json::encode oneslashslashslashslash -> length 5"); - t.is (encoded[0], 'o', "json::encode oneslashslashslashslash[0] -> o"); - t.is (encoded[1], 'n', "json::encode oneslashslashslashslash[1] -> n"); - t.is (encoded[2], 'e', "json::encode oneslashslashslashslash[2] -> e"); - t.is (encoded[3], '\\', "json::encode oneslashslashslashslash[3] -> slashslash"); - t.is (encoded[4], '\\', "json::encode oneslashslashslashslash[4] -> slashslash"); - - t.is (json::decode (encoded), "one\\", "json::decode oneslashslashslashslashslashslashslashslash -> oneslashslashslashslash"); - } - - catch (const std::string& e) {t.diag (e);} - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/test/json/1.json b/test/json/1.json deleted file mode 100644 index 81d48c0d1..000000000 --- a/test/json/1.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "glossary": { - "title": "example glossary", - "GlossDiv": { - "title": "S", - "GlossList": { - "GlossEntry": { - "ID": "SGML", - "SortAs": "SGML", - "GlossTerm": "Standard Generalized Markup Language", - "Acronym": "SGML", - "Abbrev": "ISO 8879:1986", - "GlossDef": { - "para": "A meta-markup language, used to create markup languages such as DocBook.", - "GlossSeeAlso": ["GML", "XML"] - }, - "GlossSee": "markup" - } - } - } - } -} - diff --git a/test/json/2.json b/test/json/2.json deleted file mode 100644 index 5600991a4..000000000 --- a/test/json/2.json +++ /dev/null @@ -1,11 +0,0 @@ -{"menu": { - "id": "file", - "value": "File", - "popup": { - "menuitem": [ - {"value": "New", "onclick": "CreateNewDoc()"}, - {"value": "Open", "onclick": "OpenDoc()"}, - {"value": "Close", "onclick": "CloseDoc()"} - ] - } -}} diff --git a/test/json/3.json b/test/json/3.json deleted file mode 100644 index 9b820d853..000000000 --- a/test/json/3.json +++ /dev/null @@ -1,26 +0,0 @@ -{"widget": { - "debug": "on", - "window": { - "title": "Sample Konfabulator Widget", - "name": "main_window", - "width": 500, - "height": 500 - }, - "image": { - "src": "Images/Sun.png", - "name": "sun1", - "hOffset": 250, - "vOffset": 250, - "alignment": "center" - }, - "text": { - "data": "Click Here", - "size": 36, - "style": "bold", - "name": "text1", - "hOffset": 250, - "vOffset": 100, - "alignment": "center", - "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;" - } -}} diff --git a/test/json/4.json b/test/json/4.json deleted file mode 100644 index 9eea6ad6e..000000000 --- a/test/json/4.json +++ /dev/null @@ -1,88 +0,0 @@ -{"web-app": { - "servlet": [ - { - "servlet-name": "cofaxCDS", - "servlet-class": "org.cofax.cds.CDSServlet", - "init-param": { - "configGlossary:installationAt": "Philadelphia, PA", - "configGlossary:adminEmail": "ksm@pobox.com", - "configGlossary:poweredBy": "Cofax", - "configGlossary:poweredByIcon": "/images/cofax.gif", - "configGlossary:staticPath": "/content/static", - "templateProcessorClass": "org.cofax.WysiwygTemplate", - "templateLoaderClass": "org.cofax.FilesTemplateLoader", - "templatePath": "templates", - "templateOverridePath": "", - "defaultListTemplate": "listTemplate.htm", - "defaultFileTemplate": "articleTemplate.htm", - "useJSP": false, - "jspListTemplate": "listTemplate.jsp", - "jspFileTemplate": "articleTemplate.jsp", - "cachePackageTagsTrack": 200, - "cachePackageTagsStore": 200, - "cachePackageTagsRefresh": 60, - "cacheTemplatesTrack": 100, - "cacheTemplatesStore": 50, - "cacheTemplatesRefresh": 15, - "cachePagesTrack": 200, - "cachePagesStore": 100, - "cachePagesRefresh": 10, - "cachePagesDirtyRead": 10, - "searchEngineListTemplate": "forSearchEnginesList.htm", - "searchEngineFileTemplate": "forSearchEngines.htm", - "searchEngineRobotsDb": "WEB-INF/robots.db", - "useDataStore": true, - "dataStoreClass": "org.cofax.SqlDataStore", - "redirectionClass": "org.cofax.SqlRedirection", - "dataStoreName": "cofax", - "dataStoreDriver": "com.microsoft.jdbc.sqlserver.SQLServerDriver", - "dataStoreUrl": "jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon", - "dataStoreUser": "sa", - "dataStorePassword": "dataStoreTestQuery", - "dataStoreTestQuery": "SET NOCOUNT ON;select test='test';", - "dataStoreLogFile": "/usr/local/tomcat/logs/datastore.log", - "dataStoreInitConns": 10, - "dataStoreMaxConns": 100, - "dataStoreConnUsageLimit": 100, - "dataStoreLogLevel": "debug", - "maxUrlLength": 500}}, - { - "servlet-name": "cofaxEmail", - "servlet-class": "org.cofax.cds.EmailServlet", - "init-param": { - "mailHost": "mail1", - "mailHostOverride": "mail2"}}, - { - "servlet-name": "cofaxAdmin", - "servlet-class": "org.cofax.cds.AdminServlet"}, - - { - "servlet-name": "fileServlet", - "servlet-class": "org.cofax.cds.FileServlet"}, - { - "servlet-name": "cofaxTools", - "servlet-class": "org.cofax.cms.CofaxToolsServlet", - "init-param": { - "templatePath": "toolstemplates/", - "log": 1, - "logLocation": "/usr/local/tomcat/logs/CofaxTools.log", - "logMaxSize": "", - "dataLog": 1, - "dataLogLocation": "/usr/local/tomcat/logs/dataLog.log", - "dataLogMaxSize": "", - "removePageCache": "/content/admin/remove?cache=pages&id=", - "removeTemplateCache": "/content/admin/remove?cache=templates&id=", - "fileTransferFolder": "/usr/local/tomcat/webapps/content/fileTransferFolder", - "lookInContext": 1, - "adminGroupID": 4, - "betaServer": true}}], - "servlet-mapping": { - "cofaxCDS": "/", - "cofaxEmail": "/cofaxutil/aemail/*", - "cofaxAdmin": "/admin/*", - "fileServlet": "/static/*", - "cofaxTools": "/tools/*"}, - - "taglib": { - "taglib-uri": "cofax.tld", - "taglib-location": "/WEB-INF/tlds/cofax.tld"}}} diff --git a/test/json/5.json b/test/json/5.json deleted file mode 100644 index 49980ca25..000000000 --- a/test/json/5.json +++ /dev/null @@ -1,27 +0,0 @@ -{"menu": { - "header": "SVG Viewer", - "items": [ - {"id": "Open"}, - {"id": "OpenNew", "label": "Open New"}, - null, - {"id": "ZoomIn", "label": "Zoom In"}, - {"id": "ZoomOut", "label": "Zoom Out"}, - {"id": "OriginalView", "label": "Original View"}, - null, - {"id": "Quality"}, - {"id": "Pause"}, - {"id": "Mute"}, - null, - {"id": "Find", "label": "Find..."}, - {"id": "FindAgain", "label": "Find Again"}, - {"id": "Copy"}, - {"id": "CopyAgain", "label": "Copy Again"}, - {"id": "CopySVG", "label": "Copy SVG"}, - {"id": "ViewSVG", "label": "View SVG"}, - {"id": "ViewSource", "label": "View Source"}, - {"id": "SaveAs", "label": "Save As"}, - null, - {"id": "Help"}, - {"id": "About", "label": "About Adobe CVG Viewer..."} - ] -}} diff --git a/test/json/6.json b/test/json/6.json deleted file mode 100644 index 8711288cb..000000000 --- a/test/json/6.json +++ /dev/null @@ -1,2 +0,0 @@ -[{"styleFocus":"GROWTH","creationTime":"2008-01-21","preferences":{"kfe.elite-rankings":"hide","guitarPromoClosed":"1","kfe.last_viewed_feature":"1"},"nickName":"Pascal-Louis Perez","showFlag":true,"firstName":"Pascal-Louis","points":0,"id":8,"industryFocus":"TECHNOLOGY","externalIds":[{"platform":"FACEBOOK","id":219948}],"useRealName":true,"shard":8,"concentrationFocus":"LESS_THAN_10","passwordSalt":3567830610840546163,"validatedEmails":["pascal.louis.perez@gmail.com","pascal@kaching.com","pascal@cs.stanford.edu"],"city":"Geneve","rankLevel":"BASIC","experiences":["KACHING","DEVELOPMENT","LOGIN_SYSTEM","ADMIN","RESEARCH","RANKINGS"],"marketCapFocus":"LARGE","picture":"sqr8.jpg","interests":{"MY_WALL":["EMAIL"]},"nonValidatedEmails":["pascal.loui-s.perez@gmail.com"],"showPicture":true,"lastName":"Perez","tradingFrequencyFocus":"BUY_AND_HOLD","validatedPrimaryEmail":"pascal.louis.perez@gmail.com","country":"CH","sessions":[{"d":"p","parameters":{"facebookSessionKey":"a9f133eed207196a563b0ca7-219948","facebookUserId":"219948"},"k":"qOtXSepsfrc=","platform":"FACEBOOK"},{"d":"s","k":"O7p3i91IXa8="},{"d":"s","k":"fexhG/MSXr0="},{"d":"s","k":"YUkWZMK4ors="},{"d":"s","k":"ETfFsm0svdg="}],"primaryEmail":"pascal.louis.perez@gmail.com","investmentStrategy":"Hire people who can manage my assets for me. I'm lousy.","lastLogin":"2008-12-17 12:45:25.000","portfolioId":219948}] - diff --git a/test/json/e1.json b/test/json/e1.json deleted file mode 100644 index 0dd16dd01..000000000 --- a/test/json/e1.json +++ /dev/null @@ -1 +0,0 @@ -[ 100, 500, 300, 200, 400 ] diff --git a/test/json/e2.json b/test/json/e2.json deleted file mode 100644 index c3e38240b..000000000 --- a/test/json/e2.json +++ /dev/null @@ -1,30 +0,0 @@ -[ - { - "color": "red", - "value": "#f00" - }, - { - "color": "green", - "value": "#0f0" - }, - { - "color": "blue", - "value": "#00f" - }, - { - "color": "cyan", - "value": "#0ff" - }, - { - "color": "magenta", - "value": "#f0f" - }, - { - "color": "yellow", - "value": "#ff0" - }, - { - "color": "black", - "value": "#000" - } -] diff --git a/test/json/e3.json b/test/json/e3.json deleted file mode 100644 index 93fd18825..000000000 --- a/test/json/e3.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "color": "red", - "value": "#f00" -} diff --git a/test/json/e4.json b/test/json/e4.json deleted file mode 100644 index ef2b65474..000000000 --- a/test/json/e4.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "id": "0001", - "type": "donut", - "name": "Cake", - "ppu": 0.55, - "batters": - { - "batter": - [ - { "id": "1001", "type": "Regular" }, - { "id": "1002", "type": "Chocolate" }, - { "id": "1003", "type": "Blueberry" }, - { "id": "1004", "type": "Devil's Food" } - ] - }, - "topping": - [ - { "id": "5001", "type": "None" }, - { "id": "5002", "type": "Glazed" }, - { "id": "5005", "type": "Sugar" }, - { "id": "5007", "type": "Powdered Sugar" }, - { "id": "5006", "type": "Chocolate with Sprinkles" }, - { "id": "5003", "type": "Chocolate" }, - { "id": "5004", "type": "Maple" } - ] -} diff --git a/test/json/e5.json b/test/json/e5.json deleted file mode 100644 index 70ddac09a..000000000 --- a/test/json/e5.json +++ /dev/null @@ -1,70 +0,0 @@ -[ - { - "id": "0001", - "type": "donut", - "name": "Cake", - "ppu": 0.55, - "batters": - { - "batter": - [ - { "id": "1001", "type": "Regular" }, - { "id": "1002", "type": "Chocolate" }, - { "id": "1003", "type": "Blueberry" }, - { "id": "1004", "type": "Devil's Food" } - ] - }, - "topping": - [ - { "id": "5001", "type": "None" }, - { "id": "5002", "type": "Glazed" }, - { "id": "5005", "type": "Sugar" }, - { "id": "5007", "type": "Powdered Sugar" }, - { "id": "5006", "type": "Chocolate with Sprinkles" }, - { "id": "5003", "type": "Chocolate" }, - { "id": "5004", "type": "Maple" } - ] - }, - { - "id": "0002", - "type": "donut", - "name": "Raised", - "ppu": 0.55, - "batters": - { - "batter": - [ - { "id": "1001", "type": "Regular" } - ] - }, - "topping": - [ - { "id": "5001", "type": "None" }, - { "id": "5002", "type": "Glazed" }, - { "id": "5005", "type": "Sugar" }, - { "id": "5003", "type": "Chocolate" }, - { "id": "5004", "type": "Maple" } - ] - }, - { - "id": "0003", - "type": "donut", - "name": "Old Fashioned", - "ppu": 0.55, - "batters": - { - "batter": - [ - { "id": "1001", "type": "Regular" }, - { "id": "1002", "type": "Chocolate" } - ] - }, - "topping": - [ - { "id": "5001", "type": "None" }, - { "id": "5002", "type": "Glazed" }, - { "id": "5003", "type": "Chocolate" }, - { "id": "5004", "type": "Maple" } - ] - } -] diff --git a/test/json/e6.json b/test/json/e6.json deleted file mode 100644 index e55e960fa..000000000 --- a/test/json/e6.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "id": "0001", - "type": "donut", - "name": "Cake", - "image": - { - "url": "images/0001.jpg", - "width": 200, - "height": 200 - }, - "thumbnail": - { - "url": "images/thumbnails/0001.jpg", - "width": 32, - "height": 32 - } -} diff --git a/test/json/e7.json b/test/json/e7.json deleted file mode 100644 index adbd088e7..000000000 --- a/test/json/e7.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "items": - { - "item": - [ - { - "id": "0001", - "type": "donut", - "name": "Cake", - "ppu": 0.55, - "batters": - { - "batter": - [ - { "id": "1001", "type": "Regular" }, - { "id": "1002", "type": "Chocolate" }, - { "id": "1003", "type": "Blueberry" }, - { "id": "1004", "type": "Devil's Food" } - ] - }, - "topping": - [ - { "id": "5001", "type": "None" }, - { "id": "5002", "type": "Glazed" }, - { "id": "5005", "type": "Sugar" }, - { "id": "5007", "type": "Powdered Sugar" }, - { "id": "5006", "type": "Chocolate with Sprinkles" }, - { "id": "5003", "type": "Chocolate" }, - { "id": "5004", "type": "Maple" } - ] - } - ] - } -} diff --git a/test/json/e8.json b/test/json/e8.json deleted file mode 100644 index 468c919b4..000000000 --- a/test/json/e8.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "items": - { - "item": - [ - { - "id": "0001", - "type": "donut", - "name": "Cake", - "ppu": 0.55, - "batters": - { - "batter": - [ - { "id": "1001", "type": "Regular" }, - { "id": "1002", "type": "Chocolate" }, - { "id": "1003", "type": "Blueberry" }, - { "id": "1004", "type": "Devil's Food" } - ] - }, - "topping": - [ - { "id": "5001", "type": "None" }, - { "id": "5002", "type": "Glazed" }, - { "id": "5005", "type": "Sugar" }, - { "id": "5007", "type": "Powdered Sugar" }, - { "id": "5006", "type": "Chocolate with Sprinkles" }, - { "id": "5003", "type": "Chocolate" }, - { "id": "5004", "type": "Maple" } - ] - } - - - ] - } -} diff --git a/test/json/facebook.json b/test/json/facebook.json deleted file mode 100644 index 6627bf8df..000000000 --- a/test/json/facebook.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "data": [ - { - "id": "X999_Y999", - "from": { - "name": "Tom Brady", "id": "X12" - }, - "message": "Looking forward to 2010!", - "actions": [ - { - "name": "Comment", - "link": "http://www.facebook.com/X999/posts/Y999" - }, - { - "name": "Like", - "link": "http://www.facebook.com/X999/posts/Y999" - } - ], - "type": "status", - "created_time": "2010-08-02T21:27:44+0000", - "updated_time": "2010-08-02T21:27:44+0000" - }, - { - "id": "X998_Y998", - "from": { - "name": "Peyton Manning", "id": "X18" - }, - "message": "Where's my contract?", - "actions": [ - { - "name": "Comment", - "link": "http://www.facebook.com/X998/posts/Y998" - }, - { - "name": "Like", - "link": "http://www.facebook.com/X998/posts/Y998" - } - ], - "type": "status", - "created_time": "2010-08-02T21:27:44+0000", - "updated_time": "2010-08-02T21:27:44+0000" - } - ] -} diff --git a/test/json/flikr.json b/test/json/flikr.json deleted file mode 100644 index 710db0c71..000000000 --- a/test/json/flikr.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "title": "Talk On Travel Pool", - "link": "http://www.flickr.com/groups/talkontravel/pool/", - "description": "Travel and vacation photos from around the world.", - "modified": "2009-02-02T11:10:27Z", - "generator": "http://www.flickr.com/", - "items": [ - { - "title": "View from the hotel", - "link": "http://www.flickr.com/photos/33112458@N08/3081564649/in/pool-998875@N22", - "media": {"m":"http://farm4.static.flickr.com/3037/3081564649_4a6569750c_m.jpg"}, - "date_taken": "2008-12-04T04:43:03-08:00", - "description": "

Talk On Travel<\/a> has added a photo to the pool:<\/p>

\"View<\/a><\/p> ", - "published": "2008-12-04T12:43:03Z", - "author": "nobody@flickr.com (Talk On Travel)", - "author_id": "33112458@N08", - "tags": "spain dolphins tenerife canaries lagomera aqualand playadelasamericas junglepark losgigantos loscristines talkontravel" - } - ] -} - diff --git a/test/json/interop.json b/test/json/interop.json deleted file mode 100644 index 5d680f627..000000000 --- a/test/json/interop.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "ResultSet": { - "totalResultsAvailable": "1827221", - "totalResultsReturned": 2, - "firstResultPosition": 1, - "Result": [ - { - "Title": "potato jpg", - "Summary": "Kentang Si bungsu dari keluarga Solanum tuberosum L ini ternyata memiliki khasiat untuk mengurangi kerutan jerawat bintik hitam dan kemerahan pada kulit Gunakan seminggu sekali sebagai", - "Url": "http:\/\/www.mediaindonesia.com\/spaw\/uploads\/images\/potato.jpg", - "ClickUrl": "http:\/\/www.mediaindonesia.com\/spaw\/uploads\/images\/potato.jpg", - "RefererUrl": "http:\/\/www.mediaindonesia.com\/mediaperempuan\/index.php?ar_id=Nzkw", - "FileSize": 22630, - "FileFormat": "jpeg", - "Height": "362", - "Width": "532", - "Thumbnail": { - "Url": "http:\/\/thm-a01.yimg.com\/nimage\/557094559c18f16a", - "Height": "98", - "Width": "145" - } - }, - { - "Title": "potato jpg", - "Summary": "Introduction of puneri aloo This is a traditional potato preparation flavoured with curry leaves and peanuts and can be eaten on fasting day Preparation time 10 min", - "Url": "http:\/\/www.infovisual.info\/01\/photo\/potato.jpg", - "ClickUrl": "http:\/\/www.infovisual.info\/01\/photo\/potato.jpg", - "RefererUrl": "http:\/\/sundayfood.com\/puneri-aloo-indian-%20recipe", - "FileSize": 119398, - "FileFormat": "jpeg", - "Height": "685", - "Width": "1024", - "Thumbnail": { - "Url": "http:\/\/thm-a01.yimg.com\/nimage\/7fa23212efe84b64", - "Height": "107", - "Width": "160" - } - } - ] - } -} diff --git a/test/json/iphone.json b/test/json/iphone.json deleted file mode 100644 index 08dcdf40a..000000000 --- a/test/json/iphone.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "menu": { - "header": "xProgress SVG Viewer", - "items": [ - { - "id": "Open" - }, - { - "id": "OpenNew", - "label": "Open New" - }, - null, - { - "id": "ZoomIn", - "label": "Zoom In" - }, - { - "id": "ZoomOut", - "label": "Zoom Out" - }, - { - "id": "OriginalView", - "label": "Original View" - }, - null, - { - "id": "Quality" - }, - { - "id": "Pause" - }, - { - "id": "Mute" - }, - null, - { - "id": "Find", - "label": "Find..." - }, - { - "id": "FindAgain", - "label": "Find Again" - }, - { - "id": "Copy" - }, - { - "id": "CopyAgain", - "label": "Copy Again" - }, - { - "id": "CopySVG", - "label": "Copy SVG" - }, - { - "id": "ViewSVG", - "label": "View SVG" - }, - { - "id": "ViewSource", - "label": "View Source" - }, - { - "id": "SaveAs", - "label": "Save As" - }, - null, - { - "id": "Help" - }, - { - "id": "About", - "label": "About xProgress CVG Viewer..." - } - ] - } -} diff --git a/test/json/twitter.json b/test/json/twitter.json deleted file mode 100644 index bfbf99087..000000000 --- a/test/json/twitter.json +++ /dev/null @@ -1,50 +0,0 @@ -{"results":[ - - {"text":"@twitterapi http:\/\/tinyurl.com\/ctrefg", - - "to_user_id":396524, - - "to_user":"TwitterAPI", - - "from_user":"jkoum", - - "metadata": - - { - - "result_type":"popular", - - "recent_retweets": 109 - - }, - - "id":1478555574, - - "from_user_id":1833773, - - "iso_language_code":"nl", - - "source":"twitter<\/a>", - - "profile_image_url":"http:\/\/s3.amazonaws.com\/twitter_production\/profile_images\/118412707\/2522215727_a5f07da155_b_normal.jpg", - - "created_at":"Wed, 08 Apr 2009 19:22:10 +0000"} - - ], - - "since_id":0, - - "max_id":1480307926, - - "refresh_url":"?since_id=1480307926&q=%40twitterapi", - - "results_per_page":15, - - "next_page":"?page=2&max_id=1480307926&q=%40twitterapi", - - "completed_in":0.031704, - - "page":1, - - "query":"%40twitterapi" -} diff --git a/test/json/youtube.json b/test/json/youtube.json deleted file mode 100644 index 7e97ee6a8..000000000 --- a/test/json/youtube.json +++ /dev/null @@ -1,53 +0,0 @@ -{"apiVersion":"2.0", - "data":{ - "updated":"2010-01-07T19:58:42.949Z", - "totalItems":800, - "startIndex":1, - "itemsPerPage":1, - "items":[ - {"id":"hYB0mn5zh2c", - "uploaded":"2007-06-05T22:07:03.000Z", - "updated":"2010-01-07T13:26:50.000Z", - "uploader":"GoogleDeveloperDay", - "category":"News", - "title":"Google Developers Day US - Maps API Introduction", - "description":"Google Maps API Introduction ...", - "tags":[ - "GDD07","GDD07US","Maps" - ], - "thumbnail":{ - "default":"http://i.ytimg.com/vi/hYB0mn5zh2c/default.jpg", - "hqDefault":"http://i.ytimg.com/vi/hYB0mn5zh2c/hqdefault.jpg" - }, - "player":{ - "default":"http://www.youtube.com/watch?v\u003dhYB0mn5zh2c" - }, - "content":{ - "1":"rtsp://v5.cache3.c.youtube.com/CiILENy.../0/0/0/video.3gp", - "5":"http://www.youtube.com/v/hYB0mn5zh2c?f...", - "6":"rtsp://v1.cache1.c.youtube.com/CiILENy.../0/0/0/video.3gp" - }, - "duration":2840, - "aspectRatio":"widescreen", - "rating":4.63, - "ratingCount":68, - "viewCount":220101, - "favoriteCount":201, - "commentCount":22, - "status":{ - "value":"restricted", - "reason":"limitedSyndication" - }, - "accessControl":{ - "syndicate":"allowed", - "commentVote":"allowed", - "rate":"allowed", - "list":"allowed", - "comment":"allowed", - "embed":"allowed", - "videoRespond":"moderated" - } - } - ] - } -} diff --git a/test/json_test.cpp b/test/json_test.cpp deleted file mode 100644 index 0a1879b17..000000000 --- a/test/json_test.cpp +++ /dev/null @@ -1,87 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// http://www.opensource.org/licenses/mit-license.php -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include -#include -#include - -Context context; - -//////////////////////////////////////////////////////////////////////////////// -int main (int argc, char** argv) -{ - if (argc == 1) - { - std::cout << "\nUsage: json_test [-q] ...\n" - << "\n" - << " -q quiet, no JSON dump\n" - << " file containing JSON\n" - << " JSON string, may need to be quoted\n" - << "\n"; - return 0; - } - - bool quiet = false; - for (int i = 1; i < argc; ++i) - if (!strcmp (argv[i], "-q")) - quiet = true; - - for (int i = 1; i < argc; ++i) - { - if (strcmp (argv[i], "-q")) - { - try - { - json::value* root; - File file (argv[i]); - if (file.exists ()) - { - std::string contents; - file.read (contents); - root = json::parse (contents); - } - else - root = json::parse (argv[i]); - - if (root && !quiet) - std::cout << root->dump () << "\n"; - - delete root; - } - - catch (const std::string& e) { std::cout << e << "\n"; } - catch (...) { std::cout << "Unknown error\n"; } - } - } - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/test/json_test.t b/test/json_test.t deleted file mode 100755 index a1f566b2f..000000000 --- a/test/json_test.t +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env python2.7 -# -*- coding: utf-8 -*- -############################################################################### -# -# Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -# -# http://www.opensource.org/licenses/mit-license.php -# -############################################################################### - -import sys -import os -import unittest -from glob import glob -# Ensure python finds the local simpletap module -sys.path.append(os.path.dirname(os.path.abspath(__file__))) - -from basetest import TestCase -from basetest.utils import CURRENT_DIR, run_cmd_wait_nofail -from basetest.meta import MetaTest - - -class MetaTestJson(MetaTest): - """Helper metaclass to simplify test logic below (TestJson) - - Creates test_methods in the TestCase class dynamically named after the - arguments used. - """ - @staticmethod - def make_function(classname, *args, **kwargs): - filepath = args[0] - TEST_BIN = kwargs.get("TEST_BIN") - - def test(self): - # ### Body of the usual test_testcase ### # - cmd = (TEST_BIN, filepath) - code, out, err = run_cmd_wait_nofail(cmd) - - self.assertNotIn("Error", out) - - filename = os.path.basename(filepath) - - # Title of test in report - test.__doc__ = "{0} {1}".format(classname, filename) - - return test - - -class TestJsonParsing(TestCase): - __metaclass__ = MetaTestJson - - EXTRA = {} - EXTRA["TEST_DIR"] = os.path.abspath(os.path.join(CURRENT_DIR, "..")) - EXTRA["TEST_BIN"] = os.path.join(EXTRA["TEST_DIR"], "json_test") - - TESTS = ( - zip(glob(os.path.join(EXTRA["TEST_DIR"], "json/*.json"))) - ) - - -if __name__ == "__main__": - from simpletap import TAPTestRunner - unittest.main(testRunner=TAPTestRunner()) - -# vim: ai sts=4 et sw=4 ft=python