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:
@@ -119,50 +119,3 @@ size_t memcopy(void *dest,
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ctest.h"
|
||||
|
||||
void test_memcopy(Test *pTest)
|
||||
{
|
||||
char *data1 = "Joshua";
|
||||
char *data2 = "Anna";
|
||||
char buffer[480] = "";
|
||||
char big_buffer[480] = "";
|
||||
size_t len = 0;
|
||||
|
||||
len = memcopy(&buffer[0], &data1[0], 0, sizeof(data1), sizeof(buffer));
|
||||
ct_test(pTest, len == sizeof(data1));
|
||||
ct_test(pTest, memcmp(&buffer[0], &data1[0], len) == 0);
|
||||
len = memcopy(&buffer[0], &data2[0], len, sizeof(data2), sizeof(buffer));
|
||||
ct_test(pTest, len == sizeof(data2));
|
||||
len = memcopy(
|
||||
&buffer[0], &big_buffer[0], 1, sizeof(big_buffer), sizeof(buffer));
|
||||
ct_test(pTest, len == 0);
|
||||
}
|
||||
|
||||
#ifdef TEST_MEM_COPY
|
||||
int main(void)
|
||||
{
|
||||
Test *pTest;
|
||||
bool rc;
|
||||
|
||||
pTest = ct_create("Memory Copy", NULL);
|
||||
|
||||
/* individual tests */
|
||||
rc = ct_addTestFunction(pTest, test_memcopy);
|
||||
assert(rc);
|
||||
|
||||
ct_setStream(pTest, stdout);
|
||||
ct_run(pTest);
|
||||
(void)ct_report(pTest);
|
||||
|
||||
ct_destroy(pTest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* BAC_TEST */
|
||||
|
||||
Reference in New Issue
Block a user