meta: add support for simple unit test
This commit is contained in:
13
test/CMakeLists.txt
Normal file
13
test/CMakeLists.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
file(GLOB test_sources *.c)
|
||||
|
||||
foreach (test_file ${test_sources})
|
||||
get_filename_component(test_name ${test_file} NAME_WE)
|
||||
|
||||
add_executable(${test_name} ${test_file})
|
||||
target_link_libraries(${test_name} ivy-common ivy-lang ivy-asm ivy-rt mie)
|
||||
set_target_properties(${test_name} PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/test"
|
||||
)
|
||||
endforeach (test_file)
|
||||
20
test/name-map.c
Normal file
20
test/name-map.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <mie/name.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
struct mie_name_map *map = mie_name_map_create();
|
||||
struct mie_name n1;
|
||||
struct mie_name n2;
|
||||
struct mie_name n3;
|
||||
|
||||
mie_name_map_put(map, &n1, "tmp");
|
||||
mie_name_map_put(map, &n2, "tmp");
|
||||
mie_name_map_put(map, &n3, "tmp");
|
||||
|
||||
printf("%s\n", n1.n_str);
|
||||
printf("%s\n", n2.n_str);
|
||||
printf("%s\n", n3.n_str);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user