Skip to content

Commit 4fd0a43

Browse files
this time
1 parent 96cfa9d commit 4fd0a43

File tree

1 file changed

+0
-80
lines changed

1 file changed

+0
-80
lines changed

code/tests/cases/test_json.cpp

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -85,77 +85,6 @@ FOSSIL_TEST_CASE(cpp_test_json_stringify_roundtrip) {
8585
ASSUME_ITS_TRUE(out == src || out == "{\"foo\":[1,true,null]}");
8686
}
8787

88-
FOSSIL_TEST_CASE(cpp_test_json_clone_deep_copy) {
89-
Json orig = Json::parse("{\"x\":42,\"y\":[1,2]}");
90-
Json copy = orig.clone();
91-
ASSUME_ITS_TRUE(orig.equals(copy));
92-
// Mutate copy, orig should not change
93-
Json arr = copy.get_path("y");
94-
arr = Json::parse("[99]");
95-
ASSUME_ITS_FALSE(orig.equals(copy));
96-
}
97-
98-
FOSSIL_TEST_CASE(cpp_test_json_equals_true_and_false) {
99-
Json a = Json::parse("[1,2,3]");
100-
Json b = Json::parse("[1,2,3]");
101-
Json c = Json::parse("[1,2,4]");
102-
ASSUME_ITS_TRUE(a.equals(b));
103-
ASSUME_ITS_FALSE(a.equals(c));
104-
}
105-
106-
FOSSIL_TEST_CASE(cpp_test_json_is_null) {
107-
Json j = Json::parse("null");
108-
ASSUME_ITS_TRUE(j.is_null());
109-
Json k = Json::parse("42");
110-
ASSUME_ITS_FALSE(k.is_null());
111-
}
112-
113-
FOSSIL_TEST_CASE(cpp_test_json_is_array_and_object) {
114-
Json arr = Json::parse("[1,2]");
115-
Json obj = Json::parse("{\"a\":1}");
116-
ASSUME_ITS_TRUE(arr.is_array());
117-
ASSUME_ITS_FALSE(arr.is_object());
118-
ASSUME_ITS_TRUE(obj.is_object());
119-
ASSUME_ITS_FALSE(obj.is_array());
120-
}
121-
122-
FOSSIL_TEST_CASE(cpp_test_json_array_reserve_and_object_reserve) {
123-
Json arr = Json::parse("[1]");
124-
arr.array_reserve(10); // Should not throw
125-
Json obj = Json::parse("{\"a\":1}");
126-
obj.object_reserve(5); // Should not throw
127-
}
128-
129-
FOSSIL_TEST_CASE(cpp_test_json_new_int_and_get_int) {
130-
Json j = Json::new_int(123456789);
131-
ASSUME_ITS_EQUAL_I32(j.get_int(), 123456789);
132-
}
133-
134-
FOSSIL_TEST_CASE(cpp_test_json_validate_valid_and_invalid) {
135-
ASSUME_ITS_TRUE(Json::validate("{\"a\":1}"));
136-
ASSUME_ITS_FALSE(Json::validate("{a:1}")); // Invalid JSON
137-
}
138-
139-
FOSSIL_TEST_CASE(cpp_test_json_get_path_simple_and_nested) {
140-
Json j = Json::parse("{\"user\":{\"name\":\"Bob\"},\"items\":[{\"id\":1},{\"id\":2}]}");
141-
Json name = j.get_path("user.name");
142-
ASSUME_ITS_EQUAL_CSTR(name.stringify().c_str(), "\"Bob\"");
143-
Json id2 = j.get_path("items[1].id");
144-
ASSUME_ITS_EQUAL_I32(id2.get_int(), 2);
145-
}
146-
147-
// Note: parse_file and write_file require filesystem access, so only pseudo-tested here.
148-
FOSSIL_TEST_CASE(cpp_test_json_parse_file_and_write_file) {
149-
// Setup: Write a temp file, then parse it
150-
const std::string fname = "test_tmp.json";
151-
Json j = Json::parse("{\"foo\":123}");
152-
j.write_file(fname, false);
153-
Json k = Json::parse_file(fname);
154-
ASSUME_ITS_TRUE(j.equals(k));
155-
// Cleanup: remove file (if possible)
156-
std::remove(fname.c_str());
157-
}
158-
15988
// * * * * * * * * * * * * * * * * * * * * * * * *
16089
// * Fossil Logic Test Pool
16190
// * * * * * * * * * * * * * * * * * * * * * * * *
@@ -168,15 +97,6 @@ FOSSIL_TEST_GROUP(cpp_json_tests) {
16897
FOSSIL_TEST_ADD(cpp_json_fixture, cpp_test_json_parse_array);
16998
FOSSIL_TEST_ADD(cpp_json_fixture, cpp_test_json_parse_object);
17099
FOSSIL_TEST_ADD(cpp_json_fixture, cpp_test_json_stringify_roundtrip);
171-
FOSSIL_TEST_ADD(cpp_json_fixture, cpp_test_json_clone_deep_copy);
172-
FOSSIL_TEST_ADD(cpp_json_fixture, cpp_test_json_equals_true_and_false);
173-
FOSSIL_TEST_ADD(cpp_json_fixture, cpp_test_json_is_null);
174-
FOSSIL_TEST_ADD(cpp_json_fixture, cpp_test_json_is_array_and_object);
175-
FOSSIL_TEST_ADD(cpp_json_fixture, cpp_test_json_array_reserve_and_object_reserve);
176-
FOSSIL_TEST_ADD(cpp_json_fixture, cpp_test_json_new_int_and_get_int);
177-
FOSSIL_TEST_ADD(cpp_json_fixture, cpp_test_json_validate_valid_and_invalid);
178-
FOSSIL_TEST_ADD(cpp_json_fixture, cpp_test_json_get_path_simple_and_nested);
179-
FOSSIL_TEST_ADD(cpp_json_fixture, cpp_test_json_parse_file_and_write_file);
180100

181101
FOSSIL_TEST_REGISTER(cpp_json_fixture);
182102
} // end of tests

0 commit comments

Comments
 (0)