From 8f3c7beba89a5d172847961ebcdc18a148b2ec8d Mon Sep 17 00:00:00 2001 From: jvelilla Date: Sun, 25 May 2008 00:03:46 +0000 Subject: [PATCH] CDD classes --- .../cdd_tests/json_test/cdd_interpreter.e | 74 +++++++++++++++++++ .../cdd_tests/json_test/cdd_root_class.e | 27 +++++++ 2 files changed, 101 insertions(+) create mode 100644 json_test/cdd_tests/json_test/cdd_interpreter.e create mode 100644 json_test/cdd_tests/json_test/cdd_root_class.e diff --git a/json_test/cdd_tests/json_test/cdd_interpreter.e b/json_test/cdd_tests/json_test/cdd_interpreter.e new file mode 100644 index 00000000..6460fbd2 --- /dev/null +++ b/json_test/cdd_tests/json_test/cdd_interpreter.e @@ -0,0 +1,74 @@ +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.substring (1, a_name.count).is_equal ("TEST_JSON_OBJECTS") then + Result := create {TEST_JSON_OBJECTS} + 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 >= 23 and then a_name.substring (1, 23).is_equal ("TEST_JSON_OBJECTS.test_") then + i := i + 23 + if a_name.count >= i then + c := a_name.item (i) + i := i + 1 + inspect c + 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 '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 'k' then + if a_name.substring (29, a_name.count).is_equal ("ey") then + Result := agent {TEST_JSON_OBJECTS}.test_has_key + end + else + -- Do nothing. + end + end + end + when 'c' then + if a_name.substring (25, a_name.count).is_equal ("urrent_keys") then + Result := agent {TEST_JSON_OBJECTS}.test_current_keys + end + else + -- Do nothing. + end + end + end + end + end + + +end diff --git a/json_test/cdd_tests/json_test/cdd_root_class.e b/json_test/cdd_tests/json_test/cdd_root_class.e new file mode 100644 index 00000000..fed397e9 --- /dev/null +++ b/json_test/cdd_tests/json_test/cdd_root_class.e @@ -0,0 +1,27 @@ +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_has_key + l_abstract_test_case.tear_down + end + + +end