Defines | Functions

shortcut.cpp File Reference

#include <stdio.h>
#include <string.h>
#include "shortcut.h"
Include dependency graph for shortcut.cpp:

Defines

#define MAX_TEST_FUNCTIONS   256
#define MAX_MSG_LEN   128

Functions

const char * version ()
void assert_true (bool bool_expr, struct TestCase *tc, const char *msg)
void assert_false (bool bool_expr, struct TestCase *tc, const char *msg)
void assert_equals (const char *expected, char *actual, struct TestCase *tc, const char *msg)
void assert_equals (int expected, int actual, struct TestCase *tc, const char *msg)
int get_test_count ()
bool add_test (void(*test_function)(struct TestCase *tc), const char *test_name)
void run_tests ()

Define Documentation

#define MAX_MSG_LEN   128
#define MAX_TEST_FUNCTIONS   256

Function Documentation

bool add_test ( void(*)(struct TestCase *tc)  test_function,
const char *  test_case_name 
)

add_test creates a new test case and adds the a test function to this test case.

Parameters:
test_function Pointer to the test function to be added to the newly created test case.
test_case_name Name which should be assigned to the newly created test case.
void assert_equals ( const char *  expected,
char *  actual,
struct TestCase tc,
const char *  msg 
)

assert_equals checks whether two values are equal. Currently the following data formats are supported:

  • strings
  • integer
    Parameters:
    expected The expected string value
    actual The actual string value
    tc Pointer to the test case which states this assertion.
    msg Message to be printed if assertion evaluates to false.
    See also:
    assert
void assert_equals ( int  expected,
int  actual,
struct TestCase tc,
const char *  msg 
)

Here is the call graph for this function:

void assert_false ( bool  bool_expr,
struct TestCase tc,
const char *  msg 
)

assert_false does the same as assert() but the boolean expression has to evaluate to false. If it evaluates to true the assertion fails.

See also:
assert

Here is the call graph for this function:

void assert_true ( bool  bool_expr,
struct TestCase tc,
const char *  msg 
)

assert_true checks, whether a boolean expression passed is true or false. in case it is false the test case stating the assertion is marked as failed and msg is printed.

Parameters:
bool_expr Expression which is evaluated.
tc Pointer to the test case which states this assertion.
msg Message to be printed if assertion evaluates to false.
int get_test_count (  ) 
Returns:
The total number of test cases added to the test.
void run_tests (  ) 

Here is the call graph for this function:

const char* version (  ) 
Returns:
Version of shortcut as string
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines