diff options
| author | Tyge Løvset <[email protected]> | 2021-09-19 12:33:56 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-09-19 12:33:56 +0200 |
| commit | b667a161ef058fa7ecf6ac8833dcfaf0242b913c (patch) | |
| tree | a568fb9a506cae492fdaf466965803ed62015b1c | |
| parent | 4dbd7580db4d64c2fd8e8a5c1d2127109f5001a0 (diff) | |
| parent | 0f5362fb4e2ef345782ac096b3f18e96dc854230 (diff) | |
| download | STC-modified-b667a161ef058fa7ecf6ac8833dcfaf0242b913c.tar.gz STC-modified-b667a161ef058fa7ecf6ac8833dcfaf0242b913c.zip | |
Merge branch 'master' of github.com:tylov/STC into master
| -rw-r--r-- | .github/workflows/workflow.yml | 23 | ||||
| -rw-r--r-- | CMakeLists.txt | 21 | ||||
| -rw-r--r-- | benchmarks/.gitignore | 1 | ||||
| -rw-r--r-- | examples/birthday.c | 3 | ||||
| -rw-r--r-- | examples/bits.c | 3 |
5 files changed, 49 insertions, 2 deletions
diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml new file mode 100644 index 00000000..5ceacd43 --- /dev/null +++ b/.github/workflows/workflow.yml @@ -0,0 +1,23 @@ +name: "Main Workflow" +on: + pull_request: + push: + +jobs: + build_and_test: + runs-on: ubuntu-latest + env: + CFLAGS: -Wall -Wno-unused-function -ggdb3 -fsanitize=address -fsanitize=undefined -fsanitize=pointer-compare -fsanitize=pointer-subtract + CXXFLAGS: -Wall -Wno-unused-function -ggdb3 -fsanitize=address -fsanitize=undefined -fsanitize=pointer-compare -fsanitize=pointer-subtract + steps: + - name: 'Checkout' + uses: actions/checkout@v2 + - name: 'Build & Test' + uses: ashutoshvarma/action-cmake-build@master + with: + cc: gcc + cxx: g++ + build-type: Release + configure-options: -DBUILD_TESTING=1 + ctest-options: --output-on-failure + run-test: true diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..f834aceb --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.1) +project(stc) +add_library(stc INTERFACE) +target_include_directories(stc INTERFACE include) + +include(CTest) +if(BUILD_TESTING) + file(GLOB examples examples/*.c) + foreach(file IN LISTS examples) + get_filename_component(name "${file}" NAME_WE) + add_executable(${name} ${file}) + target_link_libraries(${name} PRIVATE stc m) + add_test(NAME ${name} COMMAND ${name}) + endforeach() + foreach(name IN ITEMS cdeq clist cmap csmap cvec) + add_executable(${name} benchmarks/${name}_benchmark.cpp) + target_link_libraries(${name} PRIVATE stc m) + add_test(NAME ${name} COMMAND ${name}) + endforeach() +endif() + diff --git a/benchmarks/.gitignore b/benchmarks/.gitignore new file mode 100644 index 00000000..b883f1fd --- /dev/null +++ b/benchmarks/.gitignore @@ -0,0 +1 @@ +*.exe diff --git a/examples/birthday.c b/examples/birthday.c index d2630911..eca105df 100644 --- a/examples/birthday.c +++ b/examples/birthday.c @@ -27,6 +27,7 @@ static void test_repeats(void) if (v > 1) printf("repeated value %zu (%d) at 2^%d\n", k, v, (int) log2(i));
}
}
+ cmap_ic_del(&m);
}
#define i_tag x
@@ -62,4 +63,4 @@ int main() seed = time(NULL);
test_distribution();
test_repeats();
-}
\ No newline at end of file +}
diff --git a/examples/bits.c b/examples/bits.c index 84bdbb6b..d8c6f762 100644 --- a/examples/bits.c +++ b/examples/bits.c @@ -9,6 +9,7 @@ int main() char buf[256];
cbits_to_str(s1, buf, 0, -1);
printf("buf: %s: %zu\n", buf, cbits_count(s1));
+ cbits_del(&s1);
cbits_reset(&set, 9);
cbits_resize(&set, 43, false);
@@ -58,4 +59,4 @@ int main() puts("");
}
}
-}
\ No newline at end of file +}
|
