Issue 87 execute tests with GitHub ci (#234)
* Enable lcov coverage in unit testing via cmake. * fix pipeline build error * add compile options for unit test to silence some warnings * remove all BAC_TEST unit tests in src/bacnet/ folder. They are now in test/bacnet/ folders using ztest. * removed key.c - only used for unit test. * produce XML test result output for parsing * produce junit XML test result output * change lint workflow to quality * update readme badge for quality results Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
@@ -181,67 +181,3 @@ unsigned indtext_count(INDTEXT_DATA *data_list)
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include <assert.h>
|
||||
#include "ctest.h"
|
||||
|
||||
static INDTEXT_DATA data_list[] = { { 1, "Joshua" }, { 2, "Mary" },
|
||||
{ 3, "Anna" }, { 4, "Christopher" }, { 5, "Patricia" }, { 0, NULL } };
|
||||
|
||||
void testIndexText(Test *pTest)
|
||||
{
|
||||
unsigned i; /*counter */
|
||||
const char *pString;
|
||||
unsigned index;
|
||||
bool valid;
|
||||
unsigned count = 0;
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
pString = indtext_by_index(data_list, i);
|
||||
if (pString) {
|
||||
count++;
|
||||
valid = indtext_by_string(data_list, pString, &index);
|
||||
ct_test(pTest, valid == true);
|
||||
ct_test(pTest, index == i);
|
||||
ct_test(pTest,
|
||||
index == indtext_by_string_default(data_list, pString, index));
|
||||
}
|
||||
}
|
||||
ct_test(pTest, indtext_count(data_list) == count);
|
||||
ct_test(pTest, indtext_by_string(data_list, "Harry", NULL) == false);
|
||||
ct_test(pTest, indtext_by_string(data_list, NULL, NULL) == false);
|
||||
ct_test(pTest, indtext_by_string(NULL, NULL, NULL) == false);
|
||||
ct_test(pTest, indtext_by_index(data_list, 0) == NULL);
|
||||
ct_test(pTest, indtext_by_index(data_list, 10) == NULL);
|
||||
ct_test(pTest, indtext_by_index(NULL, 10) == NULL);
|
||||
/* case insensitive versions */
|
||||
ct_test(pTest, indtext_by_istring(data_list, "JOSHUA", NULL) == true);
|
||||
ct_test(pTest, indtext_by_istring(data_list, "joshua", NULL) == true);
|
||||
valid = indtext_by_istring(data_list, "ANNA", &index);
|
||||
ct_test(
|
||||
pTest, index == indtext_by_istring_default(data_list, "ANNA", index));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TEST_INDEX_TEXT
|
||||
int main(void)
|
||||
{
|
||||
Test *pTest;
|
||||
bool rc;
|
||||
|
||||
pTest = ct_create("index text", NULL);
|
||||
|
||||
/* individual tests */
|
||||
rc = ct_addTestFunction(pTest, testIndexText);
|
||||
assert(rc);
|
||||
|
||||
ct_setStream(pTest, stdout);
|
||||
ct_run(pTest);
|
||||
(void)ct_report(pTest);
|
||||
|
||||
ct_destroy(pTest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST_INDEX_TEXT */
|
||||
|
||||
Reference in New Issue
Block a user