Removed obsolete cluster.

This commit is contained in:
jvelilla
2010-03-09 11:41:08 +00:00
parent 805874dc9c
commit 327196a3cf
51 changed files with 0 additions and 1380 deletions

View File

@@ -1,162 +0,0 @@
indexing
description : "System's root class"
date: "$Date$"
revision: "$Revision$"
class
APPLICATION
create
make
feature -- Initialization
make is
-- Run application.
do
print ("JSON OBJECT%N")
test_json_object
print ("%NJSON STRING%N")
test_json_string
print ("%NJSON NUMBER%N")
test_json_number
print ("%NJSON NULL%N")
test_json_null
print ("%NJSON BOOLEAN%N")
test_json_boolean
print ("%NJSON ARRAY%N")
test_json_array
print ("%NJSON READER%N")
test_json_reader
print ("%NJSON PARSER%N")
test_json_parser
end
test_json_object is
--
local
jo:JSON_OBJECT
do
create jo.make
jo.put (create {JSON_STRING}.make_json("myKey"), create {JSON_STRING}.make_json ("MyValue"))
print (jo.to_json)
end
test_json_string is
--
local
js:JSON_STRING
do
create js.make_json ("Json String example")
print (js.to_json)
end
test_json_number is
--
local
jnr,jni:JSON_NUMBER
do
create jnr.make_real (12.3)
print (jnr.to_json)
print ("%N")
create jni.make_integer (123)
print (jni.to_json)
end
test_json_null is
--
local
jnull:JSON_NULL
do
create jnull
print (jnull.to_json)
end
test_json_boolean is
--
local
jbt,jbf:JSON_BOOLEAN
do
create jbt.make_boolean (true)
print (jbt.to_json)
print ("%N")
create jbf.make_boolean (false)
print (jbf.to_json)
end
test_json_array is
--
local
ja:JSON_ARRAY
jo: JSON_OBJECT
do
create ja.make_array
ja.add (create{JSON_STRING}.make_json ("valor1"))
ja.add (create{JSON_NUMBER}.make_integer (10))
ja.add (create{JSON_NULL} )
ja.add (create{JSON_BOOLEAN}.make_boolean (true))
create jo.make
jo.put (create {JSON_STRING}.make_json("myKey"), create {JSON_STRING}.make_json ("MyValue"))
ja.add (jo)
print (ja.to_json)
end
test_json_reader is
--
local
jr:EXAMPLE_JSON_READER
do
create jr.make
jr.test_create_reader
end
test_json_parser is
--
local
jp:EXAMPLE_JSON_PARSER
do
create jp
print("%N ARRAY PARSING %N")
jp.test_json_array
print("%N GLOSSATY PARSING %N")
jp.test_json_glossary_from_file
print("%N NUMBER PARSING %N")
jp.test_json_number
print("%N OBJECTS PARSING %N")
jp.test_json_objects_with_string
print("%N STRING PARSING %N")
jp.test_json_string
end
end -- class APPLICATION

View File

@@ -1,143 +0,0 @@
indexing
description: "Objects that execute test cases"
author: "CDD Tool"
class
CDD_INTERPRETER
inherit
CDD_ABSTRACT_INTERPRETER
create
execute
feature
test_class_instance (a_name: STRING): CDD_TEST_CASE is
local
i: INTEGER
c: CHARACTER
do
i := 1
if a_name /= Void then
if a_name.count >= 10 and then a_name.substring (1, 10).is_equal ("TEST_JSON_") then
i := i + 10
if a_name.count >= i then
c := a_name.item (i)
i := i + 1
inspect c
when 'S' then
if a_name.substring (12, a_name.count).is_equal ("TRING") then
Result := create {TEST_JSON_STRING}
end
when 'O' then
if a_name.substring (12, a_name.count).is_equal ("BJECTS") then
Result := create {TEST_JSON_OBJECTS}
end
else
-- Do nothing.
end
end
end
end
end
test_procedure (a_name: STRING): PROCEDURE [ANY, TUPLE [CDD_TEST_CASE]] is
local
i: INTEGER
c: CHARACTER
do
i := 1
if a_name /= Void then
if a_name.count >= 10 and then a_name.substring (1, 10).is_equal ("TEST_JSON_") then
i := i + 10
if a_name.count >= i then
c := a_name.item (i)
i := i + 1
inspect c
when 'S' then
if a_name.substring (12, a_name.count).is_equal ("TRING.test_1") then
Result := agent {TEST_JSON_STRING}.test_1
end
when 'O' then
if a_name.count >= 23 and then a_name.substring (12, 23).is_equal ("BJECTS.test_") then
i := i + 12
if a_name.count >= i then
c := a_name.item (i)
i := i + 1
inspect c
when 'j' then
if a_name.count >= 28 and then a_name.substring (25, 28).is_equal ("son_") then
i := i + 4
if a_name.count >= i then
c := a_name.item (i)
i := i + 1
inspect c
when 'v' then
if a_name.substring (30, a_name.count).is_equal ("alue") then
Result := agent {TEST_JSON_OBJECTS}.test_json_value
end
when 'o' then
if a_name.substring (30, a_name.count).is_equal ("bjects_items") then
Result := agent {TEST_JSON_OBJECTS}.test_json_objects_items
end
else
-- Do nothing.
end
end
end
when 'c' then
if a_name.count >= i then
c := a_name.item (i)
i := i + 1
inspect c
when 'u' then
if a_name.substring (26, a_name.count).is_equal ("rrent_keys") then
Result := agent {TEST_JSON_OBJECTS}.test_current_keys
end
when 'o' then
if a_name.substring (26, a_name.count).is_equal ("nversion_to_json_object") then
Result := agent {TEST_JSON_OBJECTS}.test_conversion_to_json_object
end
else
-- Do nothing.
end
end
when 'h' then
if a_name.count >= 27 and then a_name.substring (25, 27).is_equal ("as_") then
i := i + 3
if a_name.count >= i then
c := a_name.item (i)
i := i + 1
inspect c
when 'k' then
if a_name.substring (29, a_name.count).is_equal ("ey") then
Result := agent {TEST_JSON_OBJECTS}.test_has_key
end
when 'n' then
if a_name.substring (29, a_name.count).is_equal ("ot_key") then
Result := agent {TEST_JSON_OBJECTS}.test_has_not_key
end
when 'i' then
if a_name.substring (29, a_name.count).is_equal ("tem") then
Result := agent {TEST_JSON_OBJECTS}.test_has_item
end
else
-- Do nothing.
end
end
end
else
-- Do nothing.
end
end
end
else
-- Do nothing.
end
end
end
end
end
end

View File

@@ -1,31 +0,0 @@
indexing
description: "Objects that execute test cases"
author: "CDD Tool"
class
CDD_ROOT_CLASS
create
make
feature {NONE} -- Initialization
make is
local
l_abstract_test_case: CDD_TEST_CASE
l_test_case: TEST_JSON_OBJECTS
do
create l_test_case
l_abstract_test_case := l_test_case
l_abstract_test_case.set_up
l_test_case.test_current_keys
l_test_case.test_has_item
l_test_case.test_has_key
l_test_case.test_has_not_key
l_test_case.test_json_value
l_abstract_test_case.tear_down
end
end

View File

@@ -1 +0,0 @@
"A JSON payload should be an object or array, not a string."

View File

@@ -1 +0,0 @@
{"Extra value after close": true} "misplaced quoted value"

View File

@@ -1 +0,0 @@
{"Illegal expression": 1 + 2}

View File

@@ -1 +0,0 @@
{"Illegal invocation": alert()}

View File

@@ -1 +0,0 @@
{"Numbers cannot have leading zeroes": 013}

View File

@@ -1 +0,0 @@
{"Numbers cannot be hex": 0x14}

View File

@@ -1 +0,0 @@
["Illegal backslash escape: \x15"]

View File

@@ -1 +0,0 @@
[\naked]

View File

@@ -1 +0,0 @@
["Illegal backslash escape: \017"]

View File

@@ -1 +0,0 @@
[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]

View File

@@ -1 +0,0 @@
{"Missing colon" null}

View File

@@ -1 +0,0 @@
["Unclosed array"

View File

@@ -1 +0,0 @@
{"Double colon":: null}

View File

@@ -1 +0,0 @@
{"Comma instead of colon", null}

View File

@@ -1 +0,0 @@
["Colon instead of comma": false]

View File

@@ -1 +0,0 @@
["Bad value", truth]

View File

@@ -1 +0,0 @@
['single quote']

View File

@@ -1 +0,0 @@
[" tab character in string "]

View File

@@ -1 +0,0 @@
["tab\ character\ in\ string\ "]

View File

@@ -1,2 +0,0 @@
["line
break"]

View File

@@ -1,2 +0,0 @@
["line\
break"]

View File

@@ -1 +0,0 @@
[0e]

View File

@@ -1 +0,0 @@
{unquoted_key: "keys must be quoted"}

View File

@@ -1 +0,0 @@
[0e+]

View File

@@ -1 +0,0 @@
[0e+-1]

View File

@@ -1 +0,0 @@
{"Comma instead if closing brace": true,

View File

@@ -1 +0,0 @@
["mismatch"}

View File

@@ -1 +0,0 @@
["extra comma",]

View File

@@ -1 +0,0 @@
["double extra comma",,]

View File

@@ -1 +0,0 @@
[ , "<-- missing value"]

View File

@@ -1 +0,0 @@
["Comma after the close"],

View File

@@ -1 +0,0 @@
["Extra close"]]

View File

@@ -1 +0,0 @@
{"Extra comma": true,}

View File

@@ -1,11 +0,0 @@
{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}

View File

@@ -1,58 +0,0 @@
[
"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,
"": 23456789012E66,
"zero": 0,
"one": 1,
"space": " ",
"quote": "\"",
"backslash": "\\",
"controls": "\b\f\n\r\t",
"slash": "/ & \/",
"alpha": "abcdefghijklmnopqrstuvwyz",
"ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ",
"digit": "0123456789",
"0123456789": "digit",
"special": "`1~!@#$%^&*()_+-={':[,]}|;.</>?",
"hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A",
"true": true,
"false": false,
"null": null,
"array":[ ],
"object":{ },
"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": "&#34; \u0022 %22 0x22 034 &#x22;",
"\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?"
: "A key can be any string"
},
0.5 ,98.6
,
99.44
,
1066,
1e1,
0.1e1,
1e-1,
1e00,2e+00,2e-00
,"rosebud"]

View File

@@ -1 +0,0 @@
[[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]]

View File

@@ -1,6 +0,0 @@
{
"JSON Test Pattern pass3": {
"The outermost value": "must be an object or array.",
"In this test": "It is an object."
}
}

View File

@@ -1,106 +0,0 @@
indexing
description:
"[
This class contains test cases.
TODO: Put proper description of class here.
Visit http://dev.eiffel.com/CddBranch for more information.
]"
author: "EiffelStudio CDD Tool"
date: "$Date$"
revision: "$Revision$"
cdd_id: "EC96DF4F-CBC1-42B3-A9B2-13FC6BBF1C54"
class
TEST_JSON_OBJECTS
inherit
CDD_TEST_CASE
redefine
set_up
end
feature -- Basic operations
set_up is
-- Setup test case. Called by test harness
-- before each test routine invocation. Redefine
-- this routine in descendants.
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/json_menu_example.txt")
create parse_json.make_parser (json_file)
json_value := parse_json.parse_json
json_object ?= json_value
end
feature -- Tests
test_has_key is
do
assert_true ("Has the key menu",json_object.has_key (create {JSON_STRING}.make_json ("menu")))
end
test_has_not_key is
do
assert_false ("Not Has the key test",json_object.has_key (create {JSON_STRING}.make_json ("test")))
end
test_current_keys is
do
assert_integers_equal ("Has 1 key", 1, json_object.current_keys.count)
end
test_has_item is
do
print (json_object.item (create {JSON_STRING}.make_json ("menu")))
end
test_json_value is
--
do
assert_true ("Is a JSON_OBJECT",json_object.is_json_object)
end
test_conversion_to_json_object is
--
local
jo:JSON_OBJECT
do
jo:=json_value.to_json_object
assert ("Is a JSON_OBJECT",jo.has_key (create {JSON_STRING}.make_json ("menu")))
end
test_json_objects_items is
--
local
jo:JSON_OBJECT
do
jo:=json_value.to_json_object
json_value:=jo.item (create {JSON_STRING}.make_json ("menu"))
jo:=json_value.to_json_object
assert_true ("Has key id",jo.has_key (create {JSON_STRING}.make_json ("id")))
assert_true ("Has key value",jo.has_key (create {JSON_STRING}.make_json ("value")))
assert_true ("Has key popup",jo.has_key (create {JSON_STRING}.make_json ("popup")))
assert_true ("Item with key id is a JSON_STRING",jo.item (create{JSON_STRING}.make_json ("id")).is_json_string)
assert_true ("Item with key value is a JSON_STRING",jo.item (create{JSON_STRING}.make_json ("value")).is_json_string)
assert_true ("Item with key popup is a JSON_OBJECT",jo.item (create{JSON_STRING}.make_json ("popup")).is_json_object)
json_value:=jo.item (create{JSON_STRING}.make_json ("popup"))
jo:=json_value.to_json_object
assert_true ("Has key menuitem",jo.has_key (create {JSON_STRING}.make_json ("menuitem")))
assert_true ("Item with key menuitem is a JSON_ARRAY",jo.item (create{JSON_STRING}.make_json ("menuitem")).is_json_array)
end
feature -- JSON_FROM_FILE
json_file:STRING
parse_json:JSON_PARSER
json_object:JSON_OBJECT
file_reader:JSON_FILE_READER
json_value : JSON_VALUE
end

View File

@@ -1,32 +0,0 @@
indexing
description:
"[
This class contains test cases.
TODO: Put proper description of class here.
Visit http://dev.eiffel.com/CddBranch for more information.
]"
author: "EiffelStudio CDD Tool"
date: "$Date$"
revision: "$Revision$"
cdd_id: "4BE6C848-6405-46AD-B6A7-C91FA39829DE"
class
TEST_JSON_STRING
inherit
CDD_TEST_CASE
feature -- Tests
test_1 is
-- TODO: Put header comment here.
do
-- TODO: Below is a sample test, replace with your own.
check
one_plus_one_is_two: 1 + 1 = 2
end
end
end

View File

@@ -1,396 +0,0 @@
indexing
description:
"[
This class contains test cases.
TODO: Put proper description of class here.
Visit http://dev.eiffel.com/CddBranch for more information.
]"
author: "EiffelStudio CDD Tool"
date: "$Date$"
revision: "$Revision$"
cdd_id: "6BDE677C-83F4-4406-B846-BCF548A8E6C4"
class
TEST_JSON_SUITE
inherit
CDD_TEST_CASE
feature -- Tests Pass
test_json_pass1 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/pass1.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse_json
assert_false ("pass1.json",parse_json.is_parsed)
end
test_json_pass2 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/pass2.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_true ("pass2.json",parse_json.is_parsed)
end
test_json_pass3 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/pass3.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_true ("pass3.json",parse_json.is_parsed)
end
feature -- Tests Failures
test_json_fail1 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail1.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_true ("fail1.json",parse_json.is_parsed)
end
test_json_fail2 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail2.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail2.json",parse_json.is_parsed)
end
test_json_fail3 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail3.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail3.json",parse_json.is_parsed)
end
test_json_fail4 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail4.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail4.json",parse_json.is_parsed)
end
test_json_fail5 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail5.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail5.json",parse_json.is_parsed)
end
test_json_fail6 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail6.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail6.json",parse_json.is_parsed)
end
test_json_fail7 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail7.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse_json
assert_false ("fail7.json",parse_json.is_parsed)
end
test_json_fail8 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail8.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse_json
assert_false ("fail8.json",parse_json.is_parsed)
end
test_json_fail9 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail9.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail9.json",parse_json.is_parsed)
end
test_json_fail10 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail10.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse_json
assert_false ("fail10.json",parse_json.is_parsed)
end
test_json_fail11 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail11.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail11.json",parse_json.is_parsed)
end
test_json_fail12 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail12.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail12.json",parse_json.is_parsed)
end
test_json_fail13 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail13.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse_json
assert_false ("fail13.json",parse_json.is_parsed)
end
test_json_fail14 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail14.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail14.json",parse_json.is_parsed)
end
test_json_fail15 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail15.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse_json
assert_false ("fail15.json",parse_json.is_parsed)
end
test_json_fail16 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail16.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail16.json",parse_json.is_parsed)
end
test_json_fail17 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail17.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse_json
assert_false ("fail17.json",parse_json.is_parsed)
end
test_json_fail18 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail18.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse_json
assert_false ("fail18.json",parse_json.is_parsed)
end
test_json_fail19 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail19.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail19.json",parse_json.is_parsed)
end
test_json_fail20 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail20.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail20.json",parse_json.is_parsed)
end
test_json_fail21 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail21.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail21.json",parse_json.is_parsed)
end
test_json_fail22 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail22.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail22.json",parse_json.is_parsed)
end
test_json_fail23 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail23.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail23.json",parse_json.is_parsed)
end
test_json_fail24 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail24.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail24.json",parse_json.is_parsed)
end
test_json_fail25 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail25.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse_json
assert_false ("fail25.json",parse_json.is_parsed)
end
test_json_fail26 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail26.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse_json
assert_false ("fail26.json",parse_json.is_parsed)
end
test_json_fail27 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail27.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse_json
assert_false ("fail27.json",parse_json.is_parsed)
end
test_json_fail28 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail28.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail28.json",parse_json.is_parsed)
end
test_json_fail29 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail29.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail29.json",parse_json.is_parsed)
end
test_json_fail30 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail30.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail30.json",parse_json.is_parsed)
end
test_json_fail31 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail31.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail31.json",parse_json.is_parsed)
end
test_json_fail32 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail32.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail32.json",parse_json.is_parsed)
end
test_json_fail33 is
--
do
create file_reader
json_file:=file_reader.read_json_from ("/home/jvelilla/work/eiffel_work/json_test/cdd_tests/json_test/fail33.json")
create parse_json.make_parser (json_file)
json_value := parse_json.parse
assert_false ("fail33.json",parse_json.is_parsed)
end
feature -- JSON_FROM_FILE
json_file:STRING
parse_json:JSON_PARSER
json_object:JSON_OBJECT
file_reader:JSON_FILE_READER
json_value : JSON_VALUE
end

View File

@@ -1,22 +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"
}
}
}
}
}

View File

@@ -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..."}
]
}}

View File

@@ -1,11 +0,0 @@
{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-3-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-3-0 http://www.eiffel.com/developers/xml/configuration-1-3-0.xsd" name="json_test" uuid="6184F667-395B-4211-8149-EC90F66A66B7">
<target name="json_test">
<root class="CDD_ROOT_CLASS" feature="make"/>
<cdd extract="false" execute="true"/>
<option warning="true">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<precompile name="base_pre" location="$ISE_PRECOMP\base.ecf"/>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="json" location="\home\jvelilla\work\eiffel_work\json\json.ecf"/>
<cluster name="json_test" location=".\" recursive="true">
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
<exclude>/CVS$</exclude>
<exclude>/cdd_tests$</exclude>
</file_rule>
</cluster>
</target>
<target name="json_test_dotnet" extends="json_test">
<setting name="msil_generation" value="true"/>
</target>
</system>

View File

@@ -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"}}}

View File

@@ -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;"
}
}}

View File

@@ -1,160 +0,0 @@
indexing
description: "Objects that ..."
author: ""
date: "$Date$"
revision: "$Revision$"
class
EXAMPLE_JSON_PARSER
feature -- Access
test_json_string is
--
local
parse_json:JSON_PARSER
json_value:JSON_VALUE
do
create parse_json.make_parser("%"key %N This is a test %"")
json_value:=parse_json.parse
print (json_value.to_json)
end
test_json_objects_with_string is
--
local
parse_json:JSON_PARSER
json_value:JSON_VALUE
do
create parse_json.make_parser("{}")
json_value:=parse_json.parse
print (json_value.to_json)
create parse_json.make_parser("{%"key%":%"value%"}")
json_value:=parse_json.parse
print (json_value.to_json)
create parse_json.make_parser("{%"key%" :%"value%"}")
json_value:=parse_json.parse
print (json_value.to_json)
create parse_json.make_parser("{%"key%" : %"value%"}")
json_value:=parse_json.parse
print (json_value.to_json)
create parse_json.make_parser("{%"key%" : %"value%" }")
json_value:=parse_json.parse
print (json_value.to_json)
create parse_json.make_parser("{ %N%"key%" : %"value%" }")
json_value:=parse_json.parse
print (json_value.to_json)
create parse_json.make_parser("{ %N%"key%" ; %"value%" }")
json_value:=parse_json.parse
print (json_value.to_json)
end
test_json_array is
--
local
parse_json:JSON_PARSER
json_value:JSON_VALUE
do
create parse_json.make_parser ("[]")
json_value:=parse_json.parse
print (json_value.to_json)
create parse_json.make_parser ("[%"value%"]")
json_value:=parse_json.parse
print (json_value.to_json)
create parse_json.make_parser ("[%"value%",%"value2%"]")
json_value:=parse_json.parse
print (json_value.to_json)
--create parse_json.make_parser ("[%"value%";%"value2%"]")
--json_value:=parse_json.parse
--print (json_value.to_json)
create parse_json.make_parser ("[null]")
json_value:=parse_json.parse
print (json_value.to_json)
create parse_json.make_parser ("[false]")
json_value:=parse_json.parse
print (json_value.to_json)
create parse_json.make_parser ("[true]")
json_value:=parse_json.parse
print (json_value.to_json)
end
test_json_number is
--
local
parse_json:JSON_PARSER
json_value:JSON_VALUE
do
create parse_json.make_parser ("1234.5")
json_value:=parse_json.parse
print (json_value.to_json)
create parse_json.make_parser ("1234.e5")
json_value:=parse_json.parse
print (json_value.to_json)
end
test_json_glossary_from_file is
--
local
file_reader:JSON_FILE_READER
parse_json:JSON_PARSER
json_value:JSON_VALUE
do
create file_reader
create parse_json.make_parser (file_reader.read_json_from ("./json_glossary_example.txt"))
json_value:=parse_json.parse
print (json_value.to_json)
print ("%N JSON MENU %N")
create parse_json.make_parser (file_reader.read_json_from ("./json_menu_example.txt"))
json_value:=parse_json.parse
print (json_value.to_json)
print ("%N JSON WIDGET %N")
create parse_json.make_parser (file_reader.read_json_from ("./json_widget_example.txt"))
json_value:=parse_json.parse
print (json_value.to_json)
print ("%N JSON WEBXML %N")
create parse_json.make_parser (file_reader.read_json_from ("./json_webxml_example.txt"))
json_value:=parse_json.parse
print (json_value.to_json)
print ("%N JSON MENU2 %N")
create parse_json.make_parser (file_reader.read_json_from ("./json_menu2_example.txt"))
json_value:=parse_json.parse
print (json_value.to_json)
end
end

View File

@@ -1,41 +0,0 @@
indexing
description: "Objects that ..."
author: ""
date: "$Date$"
revision: "$Revision$"
class
EXAMPLE_JSON_READER
create
make
feature -- Access
make is
--
do
test_create_reader
end
test_create_reader is
--
local
reader:JSON_READER
condition:BOOLEAN
do
create reader.make("{%"key%":%"value%"}")
from
condition:=false
until condition
loop
if reader.has_next then
print (reader.read)
reader.next
else
condition:=true
end
end
end
end