A set of definitions to help writing unit tests for Modern C++ code.
More...
A set of definitions to help writing unit tests for Modern C++ code.
◆ RTI_TEST_WAIT
| #define RTI_TEST_WAIT |
( |
|
max_seconds__ | ) |
|
Value: { \
const struct RTITestTime sleepTime__ = { 0, 429496730 }; \
int sleeps__ = 0; \
while (sleeps__ < max_seconds__ * 10) { \
RTITest_sleep(&sleepTime__); \
++sleeps__; \
} \
}
Sleep for a given number of seconds.
- Parameters
-
| max_seconds__ | In. The number of seconds to sleep. |
◆ RTI_TEST_WAIT_FOR
| #define RTI_TEST_WAIT_FOR |
( |
|
expression__, |
|
|
|
max_seconds__ |
|
) |
| |
Value: { \
\
const struct RTITestTime sleepTime__ = { 0, 429496730 }; \
int sleeps__ = 0; \
bool result__ = (expression__); \
while (!result__ && sleeps__ < max_seconds__ * 10) { \
RTITest_sleep(&sleepTime__); \
++sleeps__; \
result__ = (expression__); \
} \
if (!result__) { \
"" __FILE__, \
"" RTI_TEST_TOSTRING(__LINE__), \
"wait for condition failed: " #expression__); \
} \
}
Represents a test failure exception.
Definition: TestAssertion.hpp:42
Wait for an expression to become true. Otherwise, throw a TestFailure exception.
- Parameters
-
| expression__ | In. The expression to be evaluated. |
| max_seconds__ | In. The maximum number of seconds to wait for. |
◆ RTI_TEST_WAIT_FOR_EQUALS
| #define RTI_TEST_WAIT_FOR_EQUALS |
( |
|
expected__, |
|
|
|
actual__, |
|
|
|
max_seconds__ |
|
) |
| |
Value: { \
try { \
RTI_TEST_WAIT_FOR((expected__) == (actual__), (max_seconds__)); \
print_assert_equals_failure(expected__, actual__); \
throw; \
} \
}
Wait for two values to become equal. Otherwise, throw a TestFailure exception.
- Parameters
-
| expected__ | In. The expected value. |
| actual__ | In. The actual value. |
| max_seconds__ | In. The maximum number of seconds to wait for. |
◆ RTI_TEST_WAIT_FOR_GREATER_OR_EQUALS
| #define RTI_TEST_WAIT_FOR_GREATER_OR_EQUALS |
( |
|
actual__, |
|
|
|
limit__, |
|
|
|
max_seconds__ |
|
) |
| |
Value: { \
try { \
RTI_TEST_WAIT_FOR((actual__) >= (limit__), (max_seconds__)); \
print_assert_equals_failure(limit__, actual__); \
throw; \
} \
}
Wait for a value to become equal to or greater than another one. Otherwise, throw a TestFailure exception.
- Parameters
-
| actual__ | In. The actual value. |
| limit__ | In. The limit value. |
| max_seconds__ | In. The maximum number of seconds to wait for. |
◆ RTI_TEST_WAIT_FOR_GREATER_OR_EQUALS_INT
Wait for an integer to become equal to or greater than another one. Otherwise, throw a TestFailure exception.
- Parameters
-
| actual__ | In. The actual value. |
| limit__ | In. The limit value. |
| max_seconds__ | In. The maximum number of seconds to wait for. |
◆ RTI_TEST_WAIT_FOR_EQUALS_INT
Wait for two given integers to become equal.
- Parameters
-
| expected__ | In. The expected value. |
| actual__ | In. The actual value. |
| max_seconds__ | In. The maximum number of seconds to wait for. |