Go to the source code of this file.
Legato Unit Testing API include file.
Copyright (C) Sierra Wireless Inc.
◆ LE_TEST_OUTPUT
#define LE_TEST_OUTPUT |
( |
|
format, |
|
|
|
... |
|
) |
| LE_INFO("TAP | " format, ##__VA_ARGS__) |
◆ LE_TEST_NO_PLAN
#define LE_TEST_NO_PLAN -1 |
Indicate the number of tests is not known in advance.
◆ LE_TEST_PLAN
#define LE_TEST_PLAN |
( |
|
testCount | ) |
|
Value:do { \
_le_test_Init(testCount); \
} while(0)
#define LE_TEST_OUTPUT(format,...)
Definition: le_test.h:140
Initializes a test plan. Must be called once before any tests are performed.
- Parameters
-
testCount | Number of tests expected in this test case. |
◆ LE_TEST_INIT
◆ LE_TEST_OK
#define LE_TEST_OK |
( |
|
test, |
|
|
|
testName, |
|
|
|
... |
|
) |
| |
Value:do { \
if (test) \
{ \
LE_TEST_OUTPUT("ok %d - " testName "%s", \
##__VA_ARGS__, \
} \
else \
{ \
LE_TEST_OUTPUT("not ok %d - " testName "%s", \
##__VA_ARGS__, \
_le_test_Fail(); \
} \
} while(0)
int _le_test_NumberTest(void)
const char * _le_test_GetTag(void)
Perform the test
◆ LE_TEST
#define LE_TEST |
( |
|
testResult | ) |
LE_TEST_OK((testResult), #testResult) |
Performs the test.
For new tests, LE_TEST_OK is preferred which gives an option to set the test name.
◆ LE_TEST_FATAL
#define LE_TEST_FATAL |
( |
|
... | ) |
|
Value:do { \
LE_TEST_OUTPUT("Bail out! " __VA_ARGS__); \
_le_test_Exit(); \
} while(0)
Bail out of a test suite early.
Using this instead of LE_FATAL ensures the test harness is notified the test suite is exiting abnormally.
◆ LE_TEST_ASSERT
#define LE_TEST_ASSERT |
( |
|
test, |
|
|
|
testName, |
|
|
|
... |
|
) |
| |
Value:do { \
if (test) \
{ \
LE_TEST_OUTPUT("ok %d - " testName "%s", \
##__VA_ARGS__, \
} \
else \
{ \
LE_TEST_OUTPUT("not ok %d - " testName "%s", \
##__VA_ARGS__, \
_le_test_Fail(); \
LE_TEST_FATAL(); \
} \
} while(0)
int _le_test_NumberTest(void)
const char * _le_test_GetTag(void)
Perform a test, and bail out if the test fails.
This should only be used if a test suite cannot continue if this test fails. Generally LE_TEST_OK should be used instead.
◆ LE_TEST_INFO
Ouptut some diagnostic information. In tests this should be used instead of LE_INFO so the output appears in the test results
◆ LE_TEST_BEGIN_TODO
#define LE_TEST_BEGIN_TODO |
( |
|
cond | ) |
|
Value:do { \
bool _le_test_SetTodo(bool todo)
Mark a test as not yet implemented. Todo tests will still be run, but are expected to fail.
Begins a block which must be terminated by LE_TEST_END_TODO()
◆ LE_TEST_END_TODO
#define LE_TEST_END_TODO |
( |
| ) |
|
Value: } while(0)
bool _le_test_SetTodo(bool todo)
End a block of tests which may not be implemented yet.
◆ LE_TEST_BEGIN_SKIP
#define LE_TEST_BEGIN_SKIP |
( |
|
cond, |
|
|
|
count |
|
) |
| |
Value:do { \
if (cond) \
{ \
_le_test_Skip(count); \
break; \
}
Mark a test as skipped. Skipped tests will not be run, and will always pass.
Begins a block which must be terminated by LE_TEST_END_SKIP()
◆ LE_TEST_END_SKIP
#define LE_TEST_END_SKIP |
( |
| ) |
} while(0) |
End a block of tests which may not be implemented yet.
◆ LE_TEST_EXIT
Value:do { \
{ \
} \
_le_test_Exit(); \
} while(0)
int _le_test_GetNumTests(void)
bool _le_test_CheckNeedsPlan(void)
Exits the process and returns the number of failed tests.
◆ LE_TEST_SUMMARY
DEPRECATED old name for LE_TEST_EXIT.
◆ _le_test_Init()
void _le_test_Init |
( |
int |
testCount | ) |
|
◆ _le_test_Exit()
void _le_test_Exit |
( |
void |
| ) |
|
◆ _le_test_CheckNeedsPlan()
bool _le_test_CheckNeedsPlan |
( |
void |
| ) |
|
◆ _le_test_Fail()
void _le_test_Fail |
( |
void |
| ) |
|
◆ _le_test_NumberTest()
int _le_test_NumberTest |
( |
void |
| ) |
|
◆ _le_test_GetNumTests()
int _le_test_GetNumTests |
( |
void |
| ) |
|
◆ _le_test_GetNumFailures()
int _le_test_GetNumFailures |
( |
void |
| ) |
|
◆ _le_test_SetTodo()
bool _le_test_SetTodo |
( |
bool |
todo | ) |
|
◆ _le_test_Skip()
void _le_test_Skip |
( |
int |
count | ) |
|
◆ _le_test_IsSkipping()
bool _le_test_IsSkipping |
( |
void |
| ) |
|
◆ _le_test_GetTag()
const char* _le_test_GetTag |
( |
void |
| ) |
|