ihct
(I Hate C Testing)
Assertions

Wraps all assertions. More...

Macros

#define IHCT_ASSERT(expr)
 Asserts a statement inside a test unit. If the expression is false, the unit will fail the test. More...
 
#define IHCT_NASSERT(expr)
 Asserts a statement inside a test unit. If the expression is true, the unit will fail the test. More...
 
#define IHCT_ASSERT_STR(s1, s2)
 Asserts two strings inside a test unit to be equal. If there is any difference in the strings, the unit will fail the test. More...
 
#define IHCT_NASSERT_STR(s1, s2)
 Asserts two strings inside a test unit not to be equal. If there is any difference in the strings, the unit will fail the test. More...
 
#define IHCT_PASS()
 Set the test as passed and return. More...
 
#define IHCT_FAIL()
 Set the test as failed and return. More...
 

Detailed Description

Wraps all assertions.

Decides the success of a test. Right now, tests can only result in PASS or FAIL. Assertions are only given for expressions.

Macro Definition Documentation

◆ IHCT_ASSERT

#define IHCT_ASSERT (   expr)

Asserts a statement inside a test unit. If the expression is false, the unit will fail the test.

Parameters
exprthe expression to evaluate.

Can be shortened to remove 'IHCT_' prefix by defining IHCT_SHORT.

◆ IHCT_ASSERT_STR

#define IHCT_ASSERT_STR (   s1,
  s2 
)

Asserts two strings inside a test unit to be equal. If there is any difference in the strings, the unit will fail the test.

Parameters
s1first string to compare
s2second string to compare

Can be shortened to remove 'IHCT_' prefix by defining IHCT_SHORT.

◆ IHCT_FAIL

#define IHCT_FAIL ( )

Set the test as failed and return.

Used for more complex tests where the PASS/FAIL status is more complex than an assert. Can be shortened to remove 'IHCT_' prefix by defining IHCT_SHORT.

◆ IHCT_NASSERT

#define IHCT_NASSERT (   expr)

Asserts a statement inside a test unit. If the expression is true, the unit will fail the test.

Parameters
exprthe expression to evaluate.

Can be shortened to remove 'IHCT_' prefix by defining IHCT_SHORT.

◆ IHCT_NASSERT_STR

#define IHCT_NASSERT_STR (   s1,
  s2 
)

Asserts two strings inside a test unit not to be equal. If there is any difference in the strings, the unit will fail the test.

Parameters
s1first string to compare
s2second string to compare

Can be shortened to remove 'IHCT_' prefix by defining IHCT_SHORT.

◆ IHCT_PASS

#define IHCT_PASS ( )

Set the test as passed and return.

Used for more complex tests where the PASS/FAIL status is more complex than an assert. Can be shortened to remove 'IHCT_' prefix by defining IHCT_SHORT.