Skip to content

Commit

Permalink
An obvious simplificiation to the Assert and AssertArgs macros.
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Bronson committed Jun 12, 2008
1 parent a8a8542 commit 6d677a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ TODO:
- Optionally install signal handlers. int/fp /0 and bus errors.
Can we recover just like we do for failed asserts?
- Make a homepage for it, replace the URL in the readme file.
- What to do about compiling in asserts? I want to be able to run the
unit tests at any time so I want asserts compiled in. But do I want
to error out if the test is hit during normal usage?? Probably not!

Version 0.8, IN PROGRESS
- Renamed mutest to ctest. A generic name is better than a lame one.
Expand Down
12 changes: 4 additions & 8 deletions ctassert.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,11 @@
*/

/* If the expression returns false, it is printed in the failure message. */
#define Assert(x) do { \
if(x) { ctest_assert(1, __FILE__, __LINE__, #x); } \
else { ctest_assert(0, __FILE__, __LINE__, #x); } \
} while(0)
#define Assert(x) \
ctest_assert((x), __FILE__, __LINE__, #x)

#define AssertArgs(x,str,arg1,arg2) do { \
if(x) { ctest_assert_fmt(1, __FILE__, __LINE__, str, arg1, arg2); } \
else { ctest_assert_fmt(0, __FILE__, __LINE__, str, arg1, arg2); } \
} while(0)
#define AssertArgs(x,str,arg1,arg2) \
ctest_assert_fmt((x), __FILE__, __LINE__, str, arg1, arg2)


#define AssertExpType(x,op,y,type,fmt) do { \
Expand Down

0 comments on commit 6d677a9

Please sign in to comment.