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:
@@ -125,61 +125,3 @@ int lso_decode_service_request(
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
#include "bacnet/bacapp.h"
|
||||
|
||||
void testLSO(Test *pTest)
|
||||
{
|
||||
uint8_t apdu[1000];
|
||||
int len;
|
||||
|
||||
BACNET_LSO_DATA data;
|
||||
BACNET_LSO_DATA rxdata;
|
||||
|
||||
memset(&rxdata, 0, sizeof(rxdata));
|
||||
|
||||
characterstring_init_ansi(&data.requestingSrc, "foobar");
|
||||
data.operation = LIFE_SAFETY_OP_RESET;
|
||||
data.processId = 0x1234;
|
||||
data.use_target = true;
|
||||
data.targetObject.instance = 0x1000;
|
||||
data.targetObject.type = OBJECT_BINARY_INPUT;
|
||||
|
||||
len = lso_encode_apdu(apdu, 100, &data);
|
||||
|
||||
lso_decode_service_request(&apdu[4], len, &rxdata);
|
||||
|
||||
ct_test(pTest, data.operation == rxdata.operation);
|
||||
ct_test(pTest, data.processId == rxdata.processId);
|
||||
ct_test(pTest, data.use_target == rxdata.use_target);
|
||||
ct_test(pTest, data.targetObject.instance == rxdata.targetObject.instance);
|
||||
ct_test(pTest, data.targetObject.type == rxdata.targetObject.type);
|
||||
ct_test(pTest,
|
||||
memcmp(data.requestingSrc.value, rxdata.requestingSrc.value,
|
||||
rxdata.requestingSrc.length) == 0);
|
||||
}
|
||||
|
||||
#ifdef TEST_LSO
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Test *pTest;
|
||||
bool rc;
|
||||
|
||||
pTest = ct_create("BACnet Life Safety Operation", NULL);
|
||||
/* individual tests */
|
||||
rc = ct_addTestFunction(pTest, testLSO);
|
||||
assert(rc);
|
||||
|
||||
ct_setStream(pTest, stdout);
|
||||
ct_run(pTest);
|
||||
(void)ct_report(pTest);
|
||||
ct_destroy(pTest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST_COV */
|
||||
#endif /* BAC_TEST */
|
||||
|
||||
Reference in New Issue
Block a user