Compare commits
No commits in common. "c186195e240b1b8ba06863efc59c676ff7a88dfa" and "219812f20e792e61ee7515315f3e0e43e0576ccf" have entirely different histories.
c186195e24
...
219812f20e
10
.drone.yml
10
.drone.yml
@ -38,7 +38,7 @@ name: tag
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Build release
|
- name: Build release
|
||||||
image: registry.riba-interactive.de/alpine-build:4
|
image: registry.riba-interactive.de/alpine-build:3
|
||||||
commands:
|
commands:
|
||||||
- cmake -S. -Bcmake-build-ci -DCMAKE_BUILD_TYPE=Release
|
- cmake -S. -Bcmake-build-ci -DCMAKE_BUILD_TYPE=Release
|
||||||
- cd cmake-build-ci
|
- cd cmake-build-ci
|
||||||
@ -58,18 +58,12 @@ name: Build and Test
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Build and run tests
|
- name: Build and run tests
|
||||||
image: registry.riba-interactive.de/alpine-build:4
|
image: registry.riba-interactive.de/alpine-build:3
|
||||||
commands:
|
commands:
|
||||||
- cmake -S. -Bcmake-build-ci -DCMAKE_BUILD_TYPE=Debug -DENABLE_TEST_COVERAGE=on
|
- cmake -S. -Bcmake-build-ci -DCMAKE_BUILD_TYPE=Debug -DENABLE_TEST_COVERAGE=on
|
||||||
- cd cmake-build-ci
|
- cd cmake-build-ci
|
||||||
- cmake --build .
|
- cmake --build .
|
||||||
- make coverage
|
- make coverage
|
||||||
- name: Generate memory report
|
|
||||||
image: registry.riba-interactive.de/reportly:latest
|
|
||||||
settings:
|
|
||||||
input_path: Testing
|
|
||||||
report_output: reports/memory_report.md
|
|
||||||
verbose: true
|
|
||||||
|
|
||||||
- name: Report test and coverage
|
- name: Report test and coverage
|
||||||
image: alpine
|
image: alpine
|
||||||
|
|||||||
@ -33,11 +33,9 @@ if ((CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME OR MODERN_CMAKE_BUILD_TESTING)
|
|||||||
if (ENABLE_TEST_COVERAGE)
|
if (ENABLE_TEST_COVERAGE)
|
||||||
include(CodeCoverage)
|
include(CodeCoverage)
|
||||||
|
|
||||||
set(MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --leak-check=full")
|
|
||||||
|
|
||||||
setup_target_for_coverage_lcov(
|
setup_target_for_coverage_lcov(
|
||||||
NAME coverage
|
NAME coverage
|
||||||
EXECUTABLE ${CMAKE_CTEST_COMMAND} -T memcheck
|
EXECUTABLE ${CMAKE_CTEST_COMMAND}
|
||||||
EXCLUDE "tests/*"
|
EXCLUDE "tests/*"
|
||||||
LCOV_ARGS --rc lcov_branch_coverage=1
|
LCOV_ARGS --rc lcov_branch_coverage=1
|
||||||
GENHTML_ARGS --rc genhtml_branch_coverage=1
|
GENHTML_ARGS --rc genhtml_branch_coverage=1
|
||||||
|
|||||||
@ -8,5 +8,4 @@ RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/a
|
|||||||
flex \
|
flex \
|
||||||
git \
|
git \
|
||||||
ncurses-dev\
|
ncurses-dev\
|
||||||
lcov@testing \
|
lcov@testing
|
||||||
valgrind
|
|
||||||
@ -109,22 +109,12 @@ spec("hashtable") {
|
|||||||
|
|
||||||
it("should not work with the str having NULL as string") {
|
it("should not work with the str having NULL as string") {
|
||||||
str key = STR_NULL_INIT;
|
str key = STR_NULL_INIT;
|
||||||
value *value = value_new(1337);
|
check(value_hashtable_insert(hashtable, key, value_new(1337)) == 0);
|
||||||
check(value_hashtable_insert(hashtable, key, value) == 0);
|
|
||||||
check(value != NULL, "value should not be NULL");
|
|
||||||
//value_destroy(&value);
|
|
||||||
free(value);
|
|
||||||
free(value);
|
|
||||||
value_new(1234);
|
|
||||||
free(NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
it("should return 0 with NULL as this param") {
|
it("should return 0 with NULL as this param") {
|
||||||
str key = STR_STATIC_INIT("leet");
|
str key = STR_STATIC_INIT("leet");
|
||||||
value *value = value_new(1);
|
check(value_hashtable_insert(NULL, key, value_new(1)) == 0, "return should be 0");
|
||||||
check(value_hashtable_insert(NULL, key, value) == 0, "return should be 0");
|
|
||||||
check(value != NULL, "value should not be NULL");
|
|
||||||
value_destroy(&value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
it("should not allow double entry") {
|
it("should not allow double entry") {
|
||||||
@ -134,10 +124,7 @@ spec("hashtable") {
|
|||||||
check(value_hashtable_insert(hashtable, key, value_new(1337)) == 1);
|
check(value_hashtable_insert(hashtable, key, value_new(1337)) == 1);
|
||||||
check(value_hashtable_has(hashtable, key) == 1, "hashtable should have the key");
|
check(value_hashtable_has(hashtable, key) == 1, "hashtable should have the key");
|
||||||
|
|
||||||
value *value = value_new(1337);
|
check(value_hashtable_insert(hashtable, key, value_new(1337)) == 0);
|
||||||
check(value_hashtable_insert(hashtable, key, value) == 0, "return should be 0");
|
|
||||||
check(value != NULL, "value should not be NULL");
|
|
||||||
value_destroy(&value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,6 +167,7 @@ spec("hashtable") {
|
|||||||
check(value_hashtable_markStolenCheck(hashtable, key, (value_hashtable_value_check_fn) value_check_counter, &counter) == 1);
|
check(value_hashtable_markStolenCheck(hashtable, key, (value_hashtable_value_check_fn) value_check_counter, &counter) == 1);
|
||||||
check(value_hashtable_isStolenCheck(hashtable, key, (value_hashtable_value_check_fn) value_check_counter, &counter) == 1);
|
check(value_hashtable_isStolenCheck(hashtable, key, (value_hashtable_value_check_fn) value_check_counter, &counter) == 1);
|
||||||
value_destroy(&resultValue);
|
value_destroy(&resultValue);
|
||||||
|
check(resultValue == NULL, "resultValue should be NULL");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,15 +206,12 @@ spec("hashtable") {
|
|||||||
describe("value_hashtable_markStolen()") {
|
describe("value_hashtable_markStolen()") {
|
||||||
it("should mark the value for the given key as stolen") {
|
it("should mark the value for the given key as stolen") {
|
||||||
str key = STR_STATIC_INIT("leet");
|
str key = STR_STATIC_INIT("leet");
|
||||||
value *value = NULL;
|
|
||||||
check(value_hashtable_has(hashtable, key) == 0,"hashtable should not have the key already");
|
check(value_hashtable_has(hashtable, key) == 0,"hashtable should not have the key already");
|
||||||
check(value_hashtable_insert(hashtable, key, value_new(1337)) == 1);
|
check(value_hashtable_insert(hashtable, key, value_new(1337)) == 1);
|
||||||
check(value_hashtable_has(hashtable, key) == 1, "hashtable should have the key");
|
check(value_hashtable_has(hashtable, key) == 1, "hashtable should have the key");
|
||||||
value = value_hashtable_lookup(hashtable, key);
|
|
||||||
check(value != NULL, "value should not be NULL");
|
|
||||||
check(value_hashtable_markStolen(hashtable, key) == 1, "hashtable should mark the value for the key as stolen");
|
check(value_hashtable_markStolen(hashtable, key) == 1, "hashtable should mark the value for the key as stolen");
|
||||||
check(value_hashtable_isStolen(hashtable, key) == 1, "hashtable should have the value for the key marked as stolen");
|
check(value_hashtable_isStolen(hashtable, key) == 1, "hashtable should have the value for the key marked as stolen");
|
||||||
value_destroy(&value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
it("should return 0 the given key that is not existing") {
|
it("should return 0 the given key that is not existing") {
|
||||||
@ -239,12 +224,8 @@ spec("hashtable") {
|
|||||||
|
|
||||||
it("should work with the empty str") {
|
it("should work with the empty str") {
|
||||||
str key = STR_STATIC_INIT("");
|
str key = STR_STATIC_INIT("");
|
||||||
value *value = NULL;
|
|
||||||
check(value_hashtable_insert(hashtable, key, value_new(1337)) == 1);
|
check(value_hashtable_insert(hashtable, key, value_new(1337)) == 1);
|
||||||
value = value_hashtable_lookup(hashtable, key);
|
|
||||||
check(value != NULL, "value should not be NULL");
|
|
||||||
check(value_hashtable_markStolen(hashtable, key) == 1, "return should be 1");
|
check(value_hashtable_markStolen(hashtable, key) == 1, "return should be 1");
|
||||||
value_destroy(&value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
it("should not work with the str having NULL as string") {
|
it("should not work with the str having NULL as string") {
|
||||||
@ -322,7 +303,6 @@ spec("hashtable") {
|
|||||||
str otherKey2 = STR_STATIC_INIT("otherKey2");
|
str otherKey2 = STR_STATIC_INIT("otherKey2");
|
||||||
str otherKey3 = STR_STATIC_INIT("otherKey3");
|
str otherKey3 = STR_STATIC_INIT("otherKey3");
|
||||||
str otherKey4 = STR_STATIC_INIT("otherKey4");
|
str otherKey4 = STR_STATIC_INIT("otherKey4");
|
||||||
value *value = NULL;
|
|
||||||
|
|
||||||
check(value_hashtable_has(hashtable, key) == 0,"hashtable should not have the key already");
|
check(value_hashtable_has(hashtable, key) == 0,"hashtable should not have the key already");
|
||||||
check(value_hashtable_insert(hashtable, key, value_new(1337)) == 1);
|
check(value_hashtable_insert(hashtable, key, value_new(1337)) == 1);
|
||||||
@ -333,11 +313,8 @@ spec("hashtable") {
|
|||||||
check(value_hashtable_insert(hashtable, otherKey3, value_new(1337)) == 1);
|
check(value_hashtable_insert(hashtable, otherKey3, value_new(1337)) == 1);
|
||||||
check(value_hashtable_insert(hashtable, otherKey4, value_new(1337)) == 1);
|
check(value_hashtable_insert(hashtable, otherKey4, value_new(1337)) == 1);
|
||||||
|
|
||||||
value = value_hashtable_lookup(hashtable, key);
|
|
||||||
check(value != NULL, "value should not be NULL");
|
|
||||||
check(value_hashtable_markStolen(hashtable, key) == 1, "hashtable should mark the value for the key as stolen");
|
check(value_hashtable_markStolen(hashtable, key) == 1, "hashtable should mark the value for the key as stolen");
|
||||||
check(value_hashtable_isStolen(hashtable, key) == 1, "hashtable should have the value for the key marked as stolen");
|
check(value_hashtable_isStolen(hashtable, key) == 1, "hashtable should have the value for the key marked as stolen");
|
||||||
value_destroy(&value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,10 +78,7 @@ spec("list") {
|
|||||||
for_it_end();
|
for_it_end();
|
||||||
|
|
||||||
it("should return 0 with NULL as this param") {
|
it("should return 0 with NULL as this param") {
|
||||||
value *value = value_new(1);
|
check(value_list_push(NULL, value_new(1)) == 0, "return should not be 0");
|
||||||
check(value_list_push(NULL, value) == 0, "return should not be 0");
|
|
||||||
check(value != NULL, "value should not be NULL");
|
|
||||||
value_destroy(&value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
it("should return 0 with NULL as valueElement param") {
|
it("should return 0 with NULL as valueElement param") {
|
||||||
@ -133,9 +130,7 @@ spec("list") {
|
|||||||
for_it_end();
|
for_it_end();
|
||||||
|
|
||||||
it("should return 0 with NULL as this param") {
|
it("should return 0 with NULL as this param") {
|
||||||
value *value = value_new(1);
|
check(value_list_unshift(NULL, value_new(1)) == 0, "return should not be 0");
|
||||||
check(value_list_unshift(NULL, value) == 0, "return should not be 0");
|
|
||||||
//value_destroy(&value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
it("should return 0 with NULL as valueElement param") {
|
it("should return 0 with NULL as valueElement param") {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user