Added unit testing framework
Juniper Beatitudes [email protected]
Sun, 19 Jul 2026 13:01:59 -0500
4 files changed,
44 insertions(+),
2 deletions(-)
M
.gitmodules
→
.gitmodules
@@ -7,3 +7,6 @@ url = https://github.com/pq-code-package/mlkem-native.git
[submodule "subprojects/TinyCrypT"] path = subprojects/TinyCrypT url = https://gitea.eyes-like-fire.org/juniper/TinyCrypT.git +[submodule "subprojects/Unity"] + path = subprojects/Unity + url = https://github.com/ThrowTheSwitch/Unity.git
M
meson.build
→
meson.build
@@ -1,6 +1,6 @@
project('Circe', 'c', version: '0.1.0') -## EXTERNAL DEPENDENCIES +## TINYCRYPT tct_subproj = subproject('TinyCrypT') tct_dependency = tct_subproj.get_variable('TinyCrypT_dep')@@ -65,6 +65,24 @@
core_dep = declare_dependency(include_directories: core_incdir, link_with: core_target) set_variable(meson.project_name() + '_core_dep', core_dep) +## UNITY TESTS + +unity_proj = subproject('Unity') +unity_dep = unity_proj.get_variable('unity_dep') +runner_gen = unity_proj.get_variable('gen_test_runner') + if not meson.is_subproject() and not meson.is_cross_build() - # Tests go here + example_test = meson.source_root() / 'test/test_example.c' + example_test_runner = runner_gen.process(example_test) + test( + 'example_tests', + executable( + 'example_tests', + [example_test_runner, example_test], + include_directories: [], + link_with: [], + dependencies: unity_dep, + install: false, + ), + ) endif
A
test/test_example.c
@@ -0,0 +1,19 @@
+#include "unity.h" + +void +setUp (void) +{ + // set stuff up here +} + +void +tearDown (void) +{ + // clean stuff up here +} + +void +test_example (void) +{ + TEST_ASSERT (0 == 0); +}