Set up test framework with demo test
This commit is contained in:
parent
9dd0c42ca7
commit
2a8be1c462
@ -1,5 +1,6 @@
|
||||
add_library(gemhadar_lib
|
||||
"fd_io.c"
|
||||
"url.c"
|
||||
)
|
||||
target_include_directories(gemhadar_lib PUBLIC "include")
|
||||
set_property(TARGET gemhadar_lib PROPERTY C_STANDARD 11)
|
||||
|
6
lib/include/url.h
Normal file
6
lib/include/url.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef URL_H
|
||||
#define URL_H
|
||||
|
||||
int foo(void);
|
||||
|
||||
#endif
|
@ -1,6 +1,9 @@
|
||||
add_library(test_lib
|
||||
"test_io.c"
|
||||
)
|
||||
target_include_directories(test_lib PUBLIC "include")
|
||||
add_library(test_lib "test_io.c")
|
||||
set_property(TARGET test_lib PROPERTY C_STANDARD 11)
|
||||
target_include_directories(test_lib PUBLIC "include")
|
||||
target_link_libraries(test_lib gemhadar_lib)
|
||||
|
||||
add_executable(url_tests "url_tests.c")
|
||||
set_property(TARGET test_lib PROPERTY C_STANDARD 11)
|
||||
target_link_libraries(url_tests gemhadar_lib test_lib)
|
||||
add_test(NAME "URL tests" COMMAND url_tests)
|
||||
|
19
test/url_tests.c
Normal file
19
test/url_tests.c
Normal file
@ -0,0 +1,19 @@
|
||||
#include "greatest.h"
|
||||
#include "url.h"
|
||||
|
||||
TEST foo_returns_42(void)
|
||||
{
|
||||
ASSERT_EQ(42, foo());
|
||||
PASS();
|
||||
}
|
||||
|
||||
GREATEST_MAIN_DEFS();
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
GREATEST_MAIN_BEGIN();
|
||||
|
||||
RUN_TEST(foo_returns_42);
|
||||
|
||||
GREATEST_MAIN_END();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user