diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-10-16 18:58:50 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-10-16 18:58:50 +0000 |
commit | 734aea5b10f4d7470d29c07ae51fbd9d9b588205 (patch) | |
tree | abe9d3be9dd9cecdf0d6dcb96863b3378742e547 /test/lib | |
parent | 3aafb1ec45b251b45a6a52a7492b649b1ee5c41d (diff) | |
download | ChibiOS-734aea5b10f4d7470d29c07ae51fbd9d9b588205.tar.gz ChibiOS-734aea5b10f4d7470d29c07ae51fbd9d9b588205.tar.bz2 ChibiOS-734aea5b10f4d7470d29c07ae51fbd9d9b588205.zip |
Enhanced test system, not complete yet.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10837 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test/lib')
-rw-r--r-- | test/lib/ch_test.c | 11 | ||||
-rw-r--r-- | test/lib/ch_test.h | 18 |
2 files changed, 15 insertions, 14 deletions
diff --git a/test/lib/ch_test.c b/test/lib/ch_test.c index 11d7ac095..c78cebea2 100644 --- a/test/lib/ch_test.c +++ b/test/lib/ch_test.c @@ -217,13 +217,14 @@ void test_emit_token_i(char token) { *
* @param[in] stream pointer to a @p BaseSequentialStream object for test
* output
+ * @param[in] tsp test suite to execute
* @return A failure boolean value casted to @p msg_t.
* @retval false if no errors occurred.
* @retval true if one or more tests failed.
*
* @api
*/
-msg_t test_execute(BaseSequentialStream *stream, testsuite_t ts) {
+msg_t test_execute(BaseSequentialStream *stream, const testsuite_t *tsp) {
int i, j;
test_chp = stream;
@@ -251,21 +252,21 @@ msg_t test_execute(BaseSequentialStream *stream, testsuite_t ts) { test_global_fail = false;
i = 0;
- while (ts[i] != NULL) {
+ while (tsp->sequences[i] != NULL) {
j = 0;
- while (ts[i][j] != NULL) {
+ while (tsp->sequences[i]->cases[j] != NULL) {
print_line();
test_print("--- Test Case ");
test_printn(i + 1);
test_print(".");
test_printn(j + 1);
test_print(" (");
- test_print(ts[i][j]->name);
+ test_print(tsp->sequences[i]->cases[j]->name);
test_println(")");
#if TEST_DELAY_BETWEEN_TESTS > 0
osalThreadSleepMilliseconds(TEST_DELAY_BETWEEN_TESTS);
#endif
- execute_test(ts[i][j]);
+ execute_test(tsp->sequences[i]->cases[j]);
if (test_local_fail) {
test_print("--- Result: FAILURE (#");
test_printn(test_step);
diff --git a/test/lib/ch_test.h b/test/lib/ch_test.h index 3b805d6b5..236b6ed23 100644 --- a/test/lib/ch_test.h +++ b/test/lib/ch_test.h @@ -68,23 +68,23 @@ typedef struct { /**
* @brief Structure representing a test sequence.
*/
-typedef const struct {
- const char *name; /**< @brief Name of the test sequence. */
- testcase_t *cases; /**< @brief Test cases array. */
+typedef struct {
+ const char *name; /**< @brief Name of the test sequence. */
+ const testcase_t * const * cases; /**< @brief Test cases array. */
} testsequence_t;
/**
* @brief Type of a test suite.
*/
-typedef const struct {
- const char *name; /**< @brief Name of the test suite. */
- testsequence_t *sequences; /**< @brief Test sequences array. */
-} ts_t;
+typedef struct {
+ const char *name; /**< @brief Name of the test suite. */
+ const testsequence_t * const * sequences; /**< @brief Test sequences array. */
+} testsuite_t;
/**
* @brief Type of a test suite.
*/
-typedef const testcase_t * const *testsuite_t[];
+//typedef const testcase_t * const *testsuite_t[];
/*===========================================================================*/
/* Module macros. */
@@ -194,7 +194,7 @@ extern "C" { void test_println(const char *msgp);
void test_emit_token(char token);
void test_emit_token_i(char token);
- msg_t test_execute(BaseSequentialStream *stream, testsuite_t ts);
+ msg_t test_execute(BaseSequentialStream *stream, const testsuite_t *tsp);
#ifdef __cplusplus
}
#endif
|