le_test.h File Reference

Go to the source code of this file.

Macros

#define LE_TEST_INIT   _le_test_Init()
 
#define LE_TEST(testResult)
 
#define LE_TEST_EXIT   exit(_le_test_GetNumFailures());
 
#define LE_TEST_SUMMARY   LE_TEST_EXIT
  DEPRECATED old name for LE_TEST_EXIT.
 
#define LE_TEST_FORK(exePath, ...)   _le_test_Fork(exePath, ##__VA_ARGS__, NULL)
 
#define LE_TEST_JOIN(child)   _le_test_Join(child)
 

Typedefs

typedef struct le_test_Child * le_test_ChildRef_t
 

Functions

Local definitions that should not be used directly.
void _le_test_Init (void)
 
void _le_test_Fail (void)
 
int _le_test_GetNumFailures (void)
 
le_test_ChildRef_t _le_test_Fork (const char *exePath,...)
 
void _le_test_Join (le_test_ChildRef_t child)
 

Detailed Description

Legato Unit Testing API include file.

Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.

Macro Definition Documentation

#define LE_TEST (   testResult)
Value:
if (testResult) \
{ \
LE_INFO("Unit Test Passed: '%s'", #testResult); \
} \
else \
{ \
LE_ERROR("Unit Test Failed: '%s'", #testResult); \
_le_test_Fail(); \
}
#define LE_INFO(formatString,...)
Informational message. Normally expected.
Definition: le_log.h:478
#define LE_ERROR(formatString,...)
Definition: le_log.h:482

Performs the test. If the test fails (testResult == false) then an error message is logged and the process either exits or the number of test failures is incremented depending on the operating mode. If the test passes (testResult == true) then an info message is logged and this macro just returns.

#define LE_TEST_EXIT   exit(_le_test_GetNumFailures());

Exits the process and returns the number of failed tests.

#define LE_TEST_FORK (   exePath,
  ... 
)    _le_test_Fork(exePath, ##__VA_ARGS__, NULL)

Fork a child process and have it execute a given program.

Parameters
exePath[in] String containing the path to the program to be executed. If this is not an absolute path (doesn't start with a slash '/'), then the PATH environment variable will be used to search for the executable.

A variable list of subsequent parameters is allowed, each of which will be passed as a command-line argument to the child program when it is executed.

Returns
A reference to the child process (see LE_TEST_JOIN()).
#define LE_TEST_INIT   _le_test_Init()

Initializes the testing framework. Must be called once before any tests are performed.

#define LE_TEST_JOIN (   child)    _le_test_Join(child)

Wait for a given child process to terminate and add its results to the running test summary.

Parameters
child[IN] Child process reference returned by LE_TEST_FORK().

Typedef Documentation

typedef struct le_test_Child* le_test_ChildRef_t

Reference to a forked child process. See LE_TEST_FORK() and LE_TEST_JOIN().