• R/O
  • HTTP
  • SSH
  • HTTPS

ccunit: Commit

A C Unit Test Library for C language.


Commit MetaInfo

Revisióna8c4b6bc098f5e9efef491973792d7ef00ff865f (tree)
Tiempo2003-10-05 18:56:25
Autortsntsumi <tsntsumi@user...>
Commitertsntsumi

Log Message

add object assert function

Cambiar Resumen

Diferencia incremental

--- a/src/ccunit/CCUnitAssert.c
+++ b/src/ccunit/CCUnitAssert.c
@@ -165,6 +165,32 @@ DEF_VALUE_TO_STRING(_ccunit_ptr_t, 24);
165165 } \
166166 }
167167
168+void ccunit_assert_test__ccunit_obj_t (const char* file,
169+ unsigned int line,
170+ bool cond,
171+ const char* condstr,
172+ _ccunit_obj_t expect,
173+ _ccunit_obj_t actual,
174+ char* (*to_string)(_ccunit_obj_t))
175+{
176+ if (cond)
177+ return;
178+ else
179+ {
180+ char* ex = (!to_string ? _ccunit_ptr_t_to_string (expect)
181+ : to_string (expect));
182+ char* ac = (!to_string ? _ccunit_ptr_t_to_string (actual)
183+ : to_string (actual));
184+ CCUnitTestFailure* f;
185+ f = ccunit_newTestFailure (file, line, condstr, ex, ac);
186+ safe_free (ex);
187+ safe_free (ac);
188+ assert (f != NULL);
189+ longjmp (_ccunit_runTest_env, (int)f);
190+ }
191+}
192+
193+
168194 DEF_CCUNIT_ASSERT_TEST_TYPE(char);
169195 DEF_CCUNIT_ASSERT_TEST_TYPE(u_char);
170196 DEF_CCUNIT_ASSERT_TEST_TYPE(int);
Show on old repository browser