Scrutiny  1.1.0
C testing framework for POSIX environments
Macros | Functions
test.h File Reference

Defines the test macros. More...

#include <stddef.h>
#include <stdint.h>
#include "definitions.h"
Include dependency graph for test.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define scrFail(...)
 Fails the current test with a message.
 
#define scrAssert(expr)
 Asserts that an expression is true and fails the test if it isn't.
 
#define scrAssertEq(expr1, expr2)
 Asserts that two integers are equal.
 
#define scrAssertNe(expr1, expr2)
 Asserts that two integers are not equal.
 
#define scrAssertLt(expr1, expr2)
 Asserts that one integer is less than another.
 
#define scrAssertLe(expr1, expr2)
 Asserts that one integer is less than or equal to another.
 
#define scrAssertGt(expr1, expr2)
 Asserts that one integer is greater than another.
 
#define scrAssertGe(expr1, expr2)
 Asserts that one integer is greater than or equal to another.
 
#define scrAssertUnsignedEq(expr1, expr2)
 Asserts that two unsigned integers are equal.
 
#define scrAssertUnsignedNe(expr1, expr2)
 Asserts that two unsigned integers are not equal.
 
#define scrAssertUnsignedLt(expr1, expr2)
 Asserts that one unsigned integer is less than another.
 
#define scrAssertUnsignedLe(expr1, expr2)
 Asserts that one unsigned integer is less than or equal to another.
 
#define scrAssertUnsignedGt(expr1, expr2)
 Asserts that one unsigned integer is greater than another.
 
#define scrAssertUnsignedGe(expr1, expr2)
 Asserts that one unsigned integer is greater than or equal to another.
 
#define scrAssertFloatEq(expr1, expr2)
 Asserts that two floating-point values are equal.
 
#define scrAssertFloatNe(expr1, expr2)
 Asserts that two floating-point values are not equal.
 
#define scrAssertFloatLt(expr1, expr2)
 Asserts that one floating-point value is less than another.
 
#define scrAssertFloatLe(expr1, expr2)
 Asserts that one floating-point value is less than or equal to another.
 
#define scrAssertFloatGt(expr1, expr2)
 Asserts that one floating-point value is greater than another.
 
#define scrAssertFloatGe(expr1, expr2)
 Asserts that one floating-point value is greater than or equal to another.
 
#define scrAssertPtrEq(expr1, expr2)
 Asserts that two pointers are equal.
 
#define scrAssertPtrNe(expr1, expr2)
 Asserts that two pointers are not equal.
 
#define scrAssertStrEq(expr1, expr2)
 Asserts that two strings are equal.
 
#define scrAssertStrNe(expr1, expr2)
 Asserts that two strings are not equal.
 
#define scrAssertStrBeginsWith(expr1, expr2)
 Asserts that one string starts with another.
 
#define scrAssertStrNBeginsWith(expr1, expr2)
 Asserts that one string doesn't start with another.
 
#define scrAssertStrContains(expr1, expr2)
 Asserts that one string contains another. More...
 
#define scrAssertStrNContains(expr1, expr2)
 Asserts that one string doesn't contain another.
 
#define scrAssertCharEq(expr1, expr2)
 Asserts that two characters are equal.
 
#define scrAssertCharNe(expr1, expr2)
 Asserts that two characters are not equal.
 
#define scrAssertMemEq(expr1, expr2, size)
 Asserts that two memory regions are equal.
 

Functions

void * scrGroupCtx (void) SCR_EXPORT __attribute__((pure))
 Gets the group context. More...
 
void * scrPatchedFunction (const char *func_name) SCR_EXPORT SCR_NONNULL(1)
 Gets the real pointer to a monkeypatched function. More...
 
void scrTestSkip (void) SCR_EXPORT SCR_NORETURN
 Skips the current test.
 
void _scrLog (SCR_CONTEXT_DECL, const char *format,...) SCR_EXPORT
 Logs a message.
 

Detailed Description

Defines the test macros.

Macro Definition Documentation

◆ scrAssertStrContains

#define scrAssertStrContains (   expr1,
  expr2 
)

Asserts that one string contains another.

Returns
If successful, the offset in the first string where the second string begins.

Function Documentation

◆ scrGroupCtx()

void* scrGroupCtx ( void  )

Gets the group context.

Returns
The group context.

◆ scrPatchedFunction()

void* scrPatchedFunction ( const char *  func_name)

Gets the real pointer to a monkeypatched function.

Parameters
func_nameThe name of the function that was monkeypatched.
Returns
The real pointer to the function or NULL if the function wasn't patched.