Skip to content

Commit 45eda58

Browse files
committed
🛠 Proper tests for the module here
1 parent 47a6d19 commit 45eda58

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

‎tests/idk/constexpr_inline_struggles/include/uses_size.h

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
ZTD_USE(ZTD_EXTERN_C_OPEN)
4343

4444
extern const char* ztd_idk_tests_c_foo;
45+
extern const size_t ztd_idk_tests_c_foo_size;
4546
size_t ztd_idk_tests_use_size(const char* p);
4647
size_t ztd_idk_tests_use_size_cpp(const char* p);
4748

‎tests/idk/constexpr_inline_struggles/source/c_foo.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@
3030

3131
#include <uses_size.h>
3232

33-
const char* ztd_idk_tests_c_foo = "foo!?#jdkgniofkwgeunwgjgwbuohi904h";
33+
const char* ztd_idk_tests_c_foo = "foo!?#jdkgniofkwgeunwgjgwbuohi904h";
34+
const size_t ztd_idk_tests_c_foo_size = 34;

‎tests/idk/constexpr_inline_struggles/source/main.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,12 @@
3333
int main(int argc, char* argv[]) {
3434
(void)argc;
3535
(void)argv;
36-
return ztd_idk_tests_use_size(ztd_idk_tests_c_foo) + ztd_idk_tests_use_size_cpp(ztd_idk_tests_c_foo);
36+
const size_t expected = ztd_idk_tests_c_foo_size * 2;
37+
if (expected != ztd_idk_tests_use_size(ztd_idk_tests_c_foo)) {
38+
return 1;
39+
}
40+
if (expected != ztd_idk_tests_use_size_cpp(ztd_idk_tests_c_foo)) {
41+
return 2;
42+
}
43+
return 0;
3744
}

‎tests/idk/constexpr_inline_struggles/source/uses_size.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@
3535
#include <stddef.h>
3636

3737
ZTD_USE(ZTD_EXTERN_C) size_t ztd_idk_tests_use_size(const char* p) {
38-
return ztdc_c_string_ptr_size(p) + ztdc_c_string_ptr_size_limit(256, p);
38+
return ztdc_c_string_ptr_size_c(p) + ztdc_c_string_ptr_size_limit_c(256, p);
3939
}

‎tests/idk/constexpr_inline_struggles/source/uses_size.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@
3535
#include <cstddef>
3636

3737
ZTD_USE(ZTD_EXTERN_C) size_t ztd_idk_tests_use_size_cpp(const char* p) {
38-
return ztdc_c_string_ptr_size(p) + ztdc_c_string_ptr_size_limit(256, p);
38+
return ztdc_c_string_ptr_size_c(p) + ztdc_c_string_ptr_size_limit_c(256, p);
3939
}

0 commit comments

Comments
 (0)