Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
Theory invariants

Macros

#define cr_assume(Condition)
 
#define cr_assume_not(Condition)   cr_assume(!(Condition))
 
#define cr_assume_eq(Actual, Expected)   cr_assume_op_(==, Actual, Expected)
 
#define cr_assume_neq(Actual, Unexpected)   cr_assume_op_(!=, Actual, Unexpected)
 
#define cr_assume_gt(Actual, Reference)   cr_assume_op_(>, Actual, Reference)
 
#define cr_assume_geq(Actual, Reference)   cr_assume_op_(>=, Actual, Reference)
 
#define cr_assume_lt(Actual, Reference)   cr_assume_op_(<, Actual, Reference)
 
#define cr_assume_leq(Actual, Reference)   cr_assume_op_(<=, Actual, Reference)
 
#define cr_assume_null(Value)   cr_assume_eq(Value, NULL)
 
#define cr_assume_not_null(Value)   cr_assume_neq(Value, NULL)
 
#define cr_assume_float_eq(Actual, Expected, Epsilon)
 
#define cr_assume_float_neq(Actual, Expected, Epsilon)
 
#define cr_assume_str_eq(Actual, Expected)   cr_assume_str_op_(==, Actual, Expected)
 
#define cr_assume_str_neq(Actual, Unexpected)   cr_assume_str_op_(!=, Actual, Unexpected)
 
#define cr_assume_str_lt(Actual, Reference)   cr_assume_str_op_(<, Actual, Reference)
 
#define cr_assume_str_leq(Actual, Reference)   cr_assume_str_op_(<=, Actual, Reference)
 
#define cr_assume_str_gt(Actual, Reference)   cr_assume_str_op_(>, Actual, Reference)
 
#define cr_assume_str_geq(Actual, Reference)   cr_assume_str_op_(>=, Actual, Reference)
 
#define cr_assume_arr_eq(Actual, Expected, Size)   cr_assume(!memcmp((Actual), (Expected), (Size)))
 
#define cr_assume_arr_neq(Actual, Unexpected, Size)   cr_assume(memcmp((Actual), (Unexpected), (Size)))
 

Detailed Description

Macro Definition Documentation

◆ cr_assume

#define cr_assume ( Condition)
Value:
do { \
if (!(Condition)) \
cr_theory_abort(); \
} while (0)

Assumes Condition is true

Evaluates Condition and continues execution if it is true. Otherwise the current theory iteration aborts without marking the test as failure.

Parameters
[in]ConditionCondition to test

Definition at line 117 of file theories.h.

117#define cr_assume(Condition) \
118 do { \
119 if (!(Condition)) \
120 cr_theory_abort(); \
121 } while (0)

◆ cr_assume_arr_eq

#define cr_assume_arr_eq ( Actual,
Expected,
Size )   cr_assume(!memcmp((Actual), (Expected), (Size)))

Assumes Actual is byte-to-byte equal to Expected

Continues execution if Actual is byte-to-byte equal to Expected. Otherwise the current theory iteration aborts without marking the test as failure.

Warning
This should not be used on struct arrays
Parameters
[in]ActualArray to test
[in]ExpectedExpected array
[in]SizeThe size of both arrays

Definition at line 365 of file theories.h.

◆ cr_assume_arr_neq

#define cr_assume_arr_neq ( Actual,
Unexpected,
Size )   cr_assume(memcmp((Actual), (Unexpected), (Size)))

Assumes Actual is not byte-to-byte equal to Unexpected

Continues execution if Actual is not byte-to-byte equal to Unexpected. Otherwise the current theory iteration aborts without marking the test as failure.

Warning
This should not be used on struct arrays
Parameters
[in]ActualArray to test
[in]UnexpectedUnexpected array
[in]SizeThe size of both arrays

Definition at line 380 of file theories.h.

◆ cr_assume_eq

#define cr_assume_eq ( Actual,
Expected )   cr_assume_op_(==, Actual, Expected)

Assumes Actual is equal to Expected

Continues execution if Actual is equal to Expected. Otherwise the current theory iteration aborts without marking the test as failure.

Parameters
[in]ActualValue to test
[in]ExpectedExpected value

Definition at line 146 of file theories.h.

◆ cr_assume_float_eq

#define cr_assume_float_eq ( Actual,
Expected,
Epsilon )
Value:
cr_assume((Expected) - (Actual) <= (Epsilon) \
&& (Actual) - (Expected) <= (Epsilon))
#define cr_assume(Condition)
Definition theories.h:117

Assumes Actual is equal to Expected with a tolerance of Epsilon

Continues execution if Actual is equal to Expected with a tolerance of Epsilon. Otherwise the current theory iteration aborts without marking the test as failure.

Note
Use this to test equality between floats
Parameters
[in]ActualValue to test
[in]ExpectedExpected value
[in]EpsilonTolerance between Actual and Expected

Definition at line 251 of file theories.h.

251#define cr_assume_float_eq(Actual, Expected, Epsilon) \
252 cr_assume((Expected) - (Actual) <= (Epsilon) \
253 && (Actual) - (Expected) <= (Epsilon))

◆ cr_assume_float_neq

#define cr_assume_float_neq ( Actual,
Expected,
Epsilon )
Value:
cr_assume((Expected) - (Actual) > (Epsilon) \
|| (Actual) - (Expected) > (Epsilon))

Assumes Actual is not equal to Expected with a tolerance of Epsilon

Continues execution if Actual is not equal to Expected with a tolerance of Epsilon. Otherwise the current theory iteration aborts without marking the test as failure.

Note
Use this to test equality between floats
Parameters
[in]ActualValue to test
[in]ExpectedExpected value
[in]EpsilonTolerance between Actual and Expected

Definition at line 269 of file theories.h.

269#define cr_assume_float_neq(Actual, Expected, Epsilon) \
270 cr_assume((Expected) - (Actual) > (Epsilon) \
271 || (Actual) - (Expected) > (Epsilon))

◆ cr_assume_geq

#define cr_assume_geq ( Actual,
Reference )   cr_assume_op_(>=, Actual, Reference)

Assumes Actual is greater or equal to Reference

Continues execution if Actual is greater or equal to Reference. Otherwise the current theory iteration aborts without marking the test as failure.

Parameters
[in]ActualValue to test
[in]ReferenceReference value

Definition at line 185 of file theories.h.

◆ cr_assume_gt

#define cr_assume_gt ( Actual,
Reference )   cr_assume_op_(>, Actual, Reference)

Assumes Actual is greater than Reference

Continues execution if Actual is greater than Reference. Otherwise the current theory iteration aborts without marking the test as failure.

Parameters
[in]ActualValue to test
[in]ReferenceReference value

Definition at line 172 of file theories.h.

◆ cr_assume_leq

#define cr_assume_leq ( Actual,
Reference )   cr_assume_op_(<=, Actual, Reference)

Assumes Actual is less or equal to Reference

Continues execution if Actual is less or equal to Reference. Otherwise the current theory iteration aborts without marking the test as failure.

Parameters
[in]ActualValue to test
[in]ReferenceReference value

Definition at line 211 of file theories.h.

◆ cr_assume_lt

#define cr_assume_lt ( Actual,
Reference )   cr_assume_op_(<, Actual, Reference)

Assumes Actual is less than Reference

Continues execution if Actual is less than Reference. Otherwise the current theory iteration aborts without marking the test as failure.

Parameters
[in]ActualValue to test
[in]ReferenceReference value

Definition at line 198 of file theories.h.

◆ cr_assume_neq

#define cr_assume_neq ( Actual,
Unexpected )   cr_assume_op_(!=, Actual, Unexpected)

Assumes Actual is not equal to Unexpected

Continues execution if Actual is not equal to Unexpected. Otherwise the current theory iteration aborts without marking the test as failure.

Parameters
[in]ActualValue to test
[in]UnexpectedUnexpected value

Definition at line 159 of file theories.h.

◆ cr_assume_not

#define cr_assume_not ( Condition)    cr_assume(!(Condition))

Assumes Condition is false

Evaluates Condition and continues execution if it is false. Otherwise the current theory iteration aborts without marking the test as failure.

Parameters
[in]ConditionCondition to test

Definition at line 133 of file theories.h.

◆ cr_assume_not_null

#define cr_assume_not_null ( Value)    cr_assume_neq(Value, NULL)

Assumes Value is not NULL.

Continues execution if Value is not NULL. Otherwise the current theory iteration aborts without marking the test as failure.

Parameters
[in]ValueValue to test

Definition at line 235 of file theories.h.

◆ cr_assume_null

#define cr_assume_null ( Value)    cr_assume_eq(Value, NULL)

Assumes Value is NULL.

Continues execution if Value is NULL. Otherwise the current theory iteration aborts without marking the test as failure.

Parameters
[in]ValueValue to test

Definition at line 223 of file theories.h.

◆ cr_assume_str_eq

#define cr_assume_str_eq ( Actual,
Expected )   cr_assume_str_op_(==, Actual, Expected)

Assumes Actual is lexicographically equal to Expected

Continues execution if Actual is lexicographically equal to Expected. Otherwise the current theory iteration aborts without marking the test as failure.

Parameters
[in]ActualString to test
[in]ExpectedExpected string

Definition at line 284 of file theories.h.

◆ cr_assume_str_geq

#define cr_assume_str_geq ( Actual,
Reference )   cr_assume_str_op_(>=, Actual, Reference)

Assumes Actual is lexicographically greater or equal to Reference

Continues execution if Actual is lexicographically greater or equal to Reference. Otherwise the current theory iteration aborts without marking the test as failure.

Parameters
[in]ActualValue to test
[in]ReferenceReference value

Definition at line 349 of file theories.h.

◆ cr_assume_str_gt

#define cr_assume_str_gt ( Actual,
Reference )   cr_assume_str_op_(>, Actual, Reference)

Assumes Actual is lexicographically greater than Reference

Continues execution if Actual is lexicographically greater than Reference. Otherwise the current theory iteration aborts without marking the test as failure.

Parameters
[in]ActualValue to test
[in]ReferenceReference value

Definition at line 336 of file theories.h.

◆ cr_assume_str_leq

#define cr_assume_str_leq ( Actual,
Reference )   cr_assume_str_op_(<=, Actual, Reference)

Assumes Actual is lexicographically less or equal to Reference

Continues execution if Actual is lexicographically less or equal to Reference. Otherwise the current theory iteration aborts without marking the test as failure.

Parameters
[in]ActualValue to test
[in]ReferenceReference value

Definition at line 323 of file theories.h.

◆ cr_assume_str_lt

#define cr_assume_str_lt ( Actual,
Reference )   cr_assume_str_op_(<, Actual, Reference)

Assumes Actual is lexicographically less than Reference

Continues execution if Actual is lexicographically less than Reference. Otherwise the current theory iteration aborts without marking the test as failure.

Parameters
[in]ActualValue to test
[in]ReferenceReference value

Definition at line 310 of file theories.h.

◆ cr_assume_str_neq

#define cr_assume_str_neq ( Actual,
Unexpected )   cr_assume_str_op_(!=, Actual, Unexpected)

Assumes Actual is not lexicographically equal to Unexpected

Continues execution if Actual is not lexicographically equal to Unexpected. Otherwise the current theory iteration aborts without marking the test as failure.

Parameters
[in]ActualString to test
[in]UnexpectedUnexpected string

Definition at line 297 of file theories.h.