1111 * Copyright (C) 2024 Fossil Logic. All rights reserved.
1212 * -----------------------------------------------------------------------------
1313 */
14- #include < fossil/test /framework.h>
14+ #include < fossil/pizza /framework.h>
1515#include " fossil/sys/framework.h"
1616
1717#ifndef cnull
3030// * * * * * * * * * * * * * * * * * * * * * * * *
3131
3232// Define the test suite and add test cases
33- FOSSIL_TEST_SUITE (cpp_null_suite);
33+ FOSSIL_SUITE (cpp_null_suite);
3434
3535// Setup function for the test suite
3636FOSSIL_SETUP (cpp_null_suite) {
@@ -51,7 +51,7 @@ FOSSIL_TEARDOWN(cpp_null_suite) {
5151// * * * * * * * * * * * * * * * * * * * * * * * *
5252
5353// ** Test csafe_cast Macro **
54- FOSSIL_TEST_CASE (cpp_test_csafe_cast) {
54+ FOSSIL_TEST (cpp_test_csafe_cast) {
5555 void *ptr = reinterpret_cast <void *>(1 ); // Use safe_cast instead of C cast
5656 int *casted_ptr = static_cast <int *>(ptr); // Using the safe_cast macro
5757 ASSUME_ITS_EQUAL_PTR (casted_ptr, reinterpret_cast <int *>(ptr));
@@ -63,22 +63,22 @@ FOSSIL_TEST_CASE(cpp_test_csafe_cast) {
6363}
6464
6565// ** Test cnullify Macro **
66- FOSSIL_TEST_CASE (cpp_test_cnullify) {
66+ FOSSIL_TEST (cpp_test_cnullify) {
6767 void *ptr = reinterpret_cast <void *>(1 );
6868 cnullify (ptr);
6969 ASSUME_ITS_EQUAL_PTR (ptr, cnull);
7070}
7171
7272// ** Test cnotnull Macro **
73- FOSSIL_TEST_CASE (cpp_test_cnotnull) {
73+ FOSSIL_TEST (cpp_test_cnotnull) {
7474 void *ptr = reinterpret_cast <void *>(1 );
7575 ASSUME_ITS_TRUE (cnotnull (ptr));
7676 cnullify (ptr);
7777 ASSUME_ITS_FALSE (cnotnull (ptr));
7878}
7979
8080// ** Test cunwrap_or Macro **
81- FOSSIL_TEST_CASE (cpp_test_cunwrap_or) {
81+ FOSSIL_TEST (cpp_test_cunwrap_or) {
8282 void *ptr = reinterpret_cast <void *>(1 );
8383 void *default_ptr = reinterpret_cast <void *>(99 );
8484 ASSUME_ITS_EQUAL_PTR (cunwrap_or (ptr, default_ptr), ptr);
@@ -87,31 +87,31 @@ FOSSIL_TEST_CASE(cpp_test_cunwrap_or) {
8787}
8888
8989// ** Test cunwrap Macro **
90- FOSSIL_TEST_CASE (cpp_test_cunwrap) {
90+ FOSSIL_TEST (cpp_test_cunwrap) {
9191 void *ptr = reinterpret_cast <void *>(1 );
9292 ASSUME_ITS_EQUAL_PTR (cunwrap (ptr), ptr);
9393 // cnullify(ptr);
9494 // ASSUME_ITS_EQUAL_PTR(cunwrap(ptr), cnull); // Should return cnull when it's cnull
9595}
9696
9797// ** Test cnullable and cnonnull Attributes **
98- FOSSIL_TEST_CASE (cpp_test_nullable_nonnull) {
98+ FOSSIL_TEST (cpp_test_nullable_nonnull) {
9999 void *ptr = cnull;
100100 ASSUME_ITS_TRUE (cnotnull (ptr) == 0 );
101101 ptr = reinterpret_cast <void *>(1 );
102102 ASSUME_ITS_TRUE (cnotnull (ptr) == 1 );
103103}
104104
105105// ** Test coptional Macro and cnone() and csome() **
106- FOSSIL_TEST_CASE (cpp_test_coptional) {
106+ FOSSIL_TEST (cpp_test_coptional) {
107107 void *ptr = reinterpret_cast <void *>(1 );
108108 ASSUME_ITS_EQUAL_PTR (c_optional (ptr), ptr);
109109 cnullify (ptr);
110110 ASSUME_ITS_EQUAL_PTR (c_optional (ptr), cnull);
111111}
112112
113113// ** Test COption structure and cunwrap_option Macro **
114- FOSSIL_TEST_CASE (cpp_test_cunwrap_option) {
114+ FOSSIL_TEST (cpp_test_cunwrap_option) {
115115 COption some_option = csome (reinterpret_cast <void *>(1 ));
116116 COption none_option = cnone ();
117117 ASSUME_ITS_EQUAL_PTR (cunwrap_option (some_option), reinterpret_cast <void *>(1 ));
@@ -122,15 +122,15 @@ FOSSIL_TEST_CASE(cpp_test_cunwrap_option) {
122122}
123123
124124// ** Test cunwrap_or_option Macro **
125- FOSSIL_TEST_CASE (cpp_test_cunwrap_or_option) {
125+ FOSSIL_TEST (cpp_test_cunwrap_or_option) {
126126 COption some_option = csome (reinterpret_cast <void *>(1 ));
127127 COption none_option = cnone ();
128128 ASSUME_ITS_EQUAL_PTR (cunwrap_or_option (some_option, reinterpret_cast <void *>(99 )), reinterpret_cast <void *>(1 ));
129129 ASSUME_ITS_EQUAL_PTR (cunwrap_or_option (none_option, reinterpret_cast <void *>(99 )), reinterpret_cast <void *>(99 ));
130130}
131131
132132// ** Test cdrop Macro **
133- FOSSIL_TEST_CASE (cpp_test_cdrop) {
133+ FOSSIL_TEST (cpp_test_cdrop) {
134134 void *ptr = reinterpret_cast <void *>(1 );
135135 cdrop (ptr);
136136 ASSUME_ITS_EQUAL_PTR (ptr, cnull);
@@ -142,6 +142,16 @@ FOSSIL_TEST_CASE(cpp_test_cdrop) {
142142
143143FOSSIL_TEST_GROUP (cpp_nullptr_tests) {
144144 FOSSIL_TEST_ADD (cpp_null_suite, cpp_test_csafe_cast);
145+ FOSSIL_TEST_ADD (cpp_null_suite, cpp_test_cnullify);
146+ FOSSIL_TEST_ADD (cpp_null_suite, cpp_test_cnotnull);
147+ FOSSIL_TEST_ADD (cpp_null_suite, cpp_test_cunwrap_or);
148+ FOSSIL_TEST_ADD (cpp_null_suite, cpp_test_cunwrap);
149+ FOSSIL_TEST_ADD (cpp_null_suite, cpp_test_nullable_nonnull);
150+ FOSSIL_TEST_ADD (cpp_null_suite, cpp_test_coptional);
151+ FOSSIL_TEST_ADD (cpp_null_suite, cpp_test_cunwrap_option);
152+ FOSSIL_TEST_ADD (cpp_null_suite, cpp_test_cunwrap_or_option);
153+ FOSSIL_TEST_ADD (cpp_null_suite, cpp_test_cdrop);
154+ FOSSIL_TEST_ADD (cpp_null_suite, cpp_test_cnotnull);
145155 FOSSIL_TEST_ADD (cpp_null_suite, cpp_test_nullable_nonnull);
146156 FOSSIL_TEST_ADD (cpp_null_suite, cpp_test_coptional);
147157 FOSSIL_TEST_ADD (cpp_null_suite, cpp_test_cunwrap_option);
0 commit comments