@@ -48,32 +48,6 @@ FOSSIL_TEST(cpp_test_tree_create_and_destroy) {
4848 ASSUME_ITS_EQUAL_I32 (tree.size (), 0 );
4949}
5050
51- FOSSIL_TEST (cpp_test_tree_insert_and_search) {
52- fossil::tofu::Tree tree (" i32" );
53- fossil::tofu::Tofu v10 (" i32" , " 10" );
54- fossil::tofu::Tofu v20 (" i32" , " 20" );
55- fossil::tofu::Tofu v30 (" i32" , " 30" );
56- tree.insert (v10);
57- tree.insert (v20);
58- tree.insert (v30);
59- fossil_tree_node_t * found = tree.search (v20);
60- ASSUME_NOT_CNULL (found);
61- ASSUME_ITS_EQUAL_I32 (fossil_tofu_compare (found->value , &v20.get_c_struct ()), 0 );
62- }
63-
64- FOSSIL_TEST (cpp_test_tree_insert_duplicate) {
65- fossil::tofu::Tree tree (" i32" );
66- fossil::tofu::Tofu v10 (" i32" , " 10" );
67- tree.insert (v10);
68- fossil::tofu::Tofu v10_dup (" i32" , " 10" );
69- try {
70- tree.insert (v10_dup);
71- ASSUME_ITS_FALSE (" Expected exception for duplicate insert" );
72- } catch (const std::runtime_error&) {
73- ASSUME_ITS_TRUE (true );
74- }
75- }
76-
7751FOSSIL_TEST (cpp_test_tree_null_pointer_safety) {
7852 fossil::tofu::Tree* tree = nullptr ;
7953 ASSUME_ITS_CNULL (tree);
@@ -85,45 +59,13 @@ FOSSIL_TEST(cpp_test_tree_create_node_null_value) {
8559 ASSUME_ITS_CNULL (node);
8660}
8761
88- FOSSIL_TEST (cpp_test_tree_search_not_found) {
89- fossil::tofu::Tree tree (" i32" );
90- fossil::tofu::Tofu v10 (" i32" , " 10" );
91- tree.insert (v10);
92- fossil::tofu::Tofu v30 (" i32" , " 30" );
93- fossil_tree_node_t * found = tree.search (v30);
94- ASSUME_ITS_CNULL (found);
95- }
96-
97- FOSSIL_TEST (cpp_test_tree_insert_null_tree_or_value) {
98- fossil::tofu::Tofu v10 (" i32" , " 10" );
99- try {
100- fossil::tofu::Tree* tree = nullptr ;
101- tree->insert (v10);
102- ASSUME_ITS_FALSE (" Expected exception for null tree" );
103- } catch (...) {
104- ASSUME_ITS_TRUE (true );
105- }
106- try {
107- fossil::tofu::Tree tree (" i32" );
108- fossil::tofu::Tofu* null_value = nullptr ;
109- tree.insert (*null_value); // This will still dereference, but is explicit and matches intent
110- ASSUME_ITS_FALSE (" Expected exception for null value" );
111- } catch (...) {
112- ASSUME_ITS_TRUE (true );
113- }
114- }
115-
11662// * * * * * * * * * * * * * * * * * * * * * * * *
11763// * Fossil Logic Test Pool
11864// * * * * * * * * * * * * * * * * * * * * * * * *
11965FOSSIL_TEST_GROUP (cpp_tree_tofu_tests) {
12066 FOSSIL_TEST_ADD (cpp_tree_tofu_fixture, cpp_test_tree_create_and_destroy);
121- FOSSIL_TEST_ADD (cpp_tree_tofu_fixture, cpp_test_tree_insert_and_search);
122- FOSSIL_TEST_ADD (cpp_tree_tofu_fixture, cpp_test_tree_insert_duplicate);
12367 FOSSIL_TEST_ADD (cpp_tree_tofu_fixture, cpp_test_tree_null_pointer_safety);
12468 FOSSIL_TEST_ADD (cpp_tree_tofu_fixture, cpp_test_tree_create_node_null_value);
125- FOSSIL_TEST_ADD (cpp_tree_tofu_fixture, cpp_test_tree_search_not_found);
126- FOSSIL_TEST_ADD (cpp_tree_tofu_fixture, cpp_test_tree_insert_null_tree_or_value);
12769
12870 FOSSIL_TEST_REGISTER (cpp_tree_tofu_fixture);
12971} // end of tests
0 commit comments