Add Demo for easier during-development testing
This commit is contained in:
@@ -40,6 +40,7 @@ add_definitions(-DHAVE_CONFIG_H)
|
||||
set(CONFIG_HEADER ${CMAKE_CURRENT_BINARY_DIR/config.h})
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(demo)
|
||||
add_subdirectory(tests)
|
||||
|
||||
enable_testing()
|
||||
|
||||
5
demo/CMakeLists.txt
Normal file
5
demo/CMakeLists.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
set(DEMO_SOURCES demo.c)
|
||||
|
||||
add_executable(demo EXCLUDE_FROM_ALL ${DEMO_SOURCES})
|
||||
target_link_libraries(demo PRIVATE EmberLib)
|
||||
target_include_directories(demo PRIVATE ${EmberLib_INCLUDE_DIRS})
|
||||
18
demo/demo.c
Normal file
18
demo/demo.c
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Created by Aaron Helton on 11/22/19
|
||||
*/
|
||||
#include <EmberLib/arraylist_new.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int *array = init_arraylist(int);
|
||||
for(int i = 0; i < 100; i++)
|
||||
{
|
||||
arraylist_push(array, i);
|
||||
printf("Arraylist Length: %zu | ", arraylist_length(array));
|
||||
printf("Arraylist Capacity: %zu | ", arraylist_capacity(array));
|
||||
printf("Arraylist Memory: %zu\n", arraylist_memory_footprint(array));
|
||||
}
|
||||
destroy_arraylist(array);
|
||||
}
|
||||
Reference in New Issue
Block a user