Internal API Reference - Unit Testing
Desktop Apps Training - Policy Kit

Unit testing

Unit testing — Unit testing

 

Synopsis



KitTest;
kit_bool_t kit_test_run (KitTest **tests,
size_t num_tests);

Description

Functions used for unit testing.

 

Details

KitTest

typedef struct {
const char *name;
void (*setup) (void);
void (*teardown) (void);
kit_bool_t (*run) (void);
} KitTest;

Test suite abstraction. See kit_test_run() for details.

 

const char *name;

name of the unit test

setup ()

setup function

teardown ()

teardown function

run ()

actual test function.

kit_test_run ()

kit_bool_t          kit_test_run                        (KitTest **tests,
size_t num_tests);

Runs a number of tests simulating Out Of Memory. Checks for both memory and file descriptor leaks.

This function is only available if libkit have been built with KIT_BUILD_TESTS.

 

tests :

array of KitTest objects

num_tests :

size of tests array

Returns :

TRUE only if all tests succeed without memory or file descriptor leaks