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:
Steve Karg
2022-02-28 20:09:46 -06:00
committed by GitHub
parent 585cdb4a7d
commit c3a4c229fe
182 changed files with 231 additions and 16779 deletions
-70
View File
@@ -1567,73 +1567,3 @@ unsigned property_list_special_count(
return count;
}
#endif
#ifdef BAC_TEST
#include <assert.h>
#include <string.h>
#include "ctest.h"
void testPropList(Test *pTest)
{
unsigned i = 0, j = 0;
unsigned count = 0;
BACNET_PROPERTY_ID property = MAX_BACNET_PROPERTY_ID;
unsigned object_id = 0, object_name = 0, object_type = 0;
struct special_property_list_t property_list = { 0 };
for (i = 0; i < OBJECT_PROPRIETARY_MIN; i++) {
count = property_list_special_count((BACNET_OBJECT_TYPE)i, PROP_ALL);
ct_test(pTest, count >= 3);
object_id = 0;
object_name = 0;
object_type = 0;
for (j = 0; j < count; j++) {
property = property_list_special_property(
(BACNET_OBJECT_TYPE)i, PROP_ALL, j);
if (property == PROP_OBJECT_TYPE) {
object_type++;
}
if (property == PROP_OBJECT_IDENTIFIER) {
object_id++;
}
if (property == PROP_OBJECT_NAME) {
object_name++;
}
}
ct_test(pTest, object_type == 1);
ct_test(pTest, object_id == 1);
ct_test(pTest, object_name == 1);
/* test member function */
property_list_special((BACNET_OBJECT_TYPE)i, &property_list);
ct_test(pTest,
property_list_member(
property_list.Required.pList, PROP_OBJECT_TYPE));
ct_test(pTest,
property_list_member(
property_list.Required.pList, PROP_OBJECT_IDENTIFIER));
ct_test(pTest,
property_list_member(
property_list.Required.pList, PROP_OBJECT_NAME));
}
}
#ifdef TEST_PROPLIST
int main(void)
{
Test *pTest;
bool rc;
pTest = ct_create("BACnet Property List", NULL);
/* individual tests */
rc = ct_addTestFunction(pTest, testPropList);
assert(rc);
ct_setStream(pTest, stdout);
ct_run(pTest);
(void)ct_report(pTest);
ct_destroy(pTest);
return 0;
}
#endif /* TEST_PROPLIST */
#endif /* BAC_TEST */