Skip to content

Commit

Permalink
added double list tests and remade concatenate function into a splice…
Browse files Browse the repository at this point in the history
… function
  • Loading branch information
TheGAzed committed Dec 29, 2024
1 parent b658b00 commit 55e6b59
Show file tree
Hide file tree
Showing 8 changed files with 1,029 additions and 284 deletions.
670 changes: 392 additions & 278 deletions headers/double_list.h

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions test/double_list/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
add_executable(list_test main.c
add_executable(double_list_test main.c
infinite_allocated_double_list_test.c
finite_allocated_double_list_test.c
finite_preprocessor_double_list_test.c
infinite_realloc_double_list_test.c
)
target_link_libraries(list_test PRIVATE greatest project_headers)
add_test(NAME LIST_TEST COMMAND list_test)
target_link_libraries(double_list_test PRIVATE greatest project_headers)
add_test(NAME DOUBLE_LIST_TEST COMMAND double_list_test)
25 changes: 25 additions & 0 deletions test/double_list/double_list_test.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef DOUBLE_LIST_TEST_H
#define DOUBLE_LIST_TEST_H

#include <greatest.h>

typedef union type_dst {
int sub_one;
char * sub_two;
} type_dst_u;

#define DOUBLE_LIST_DATA_TYPE type_dst_u

#define TEST_STRING "thegazed"
void destroy_element(DOUBLE_LIST_DATA_TYPE * element);
DOUBLE_LIST_DATA_TYPE copy_element(const DOUBLE_LIST_DATA_TYPE element);

void operation_int(DOUBLE_LIST_DATA_TYPE * element, void * args);
void operation_string(DOUBLE_LIST_DATA_TYPE * element, void * args);

SUITE_EXTERN(infinite_allocated_double_list_test);
SUITE_EXTERN(finite_allocated_double_list_test);
SUITE_EXTERN(infinite_realloc_double_list_test);
SUITE_EXTERN(finite_preprocessor_double_list_test);

#endif // DOUBLE_LIST_TEST_H
8 changes: 8 additions & 0 deletions test/double_list/finite_allocated_double_list_test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "double_list_test.h"

#define DOUBLE_LIST_MODE FINITE_ALLOCATED_DOUBLE_LIST
#define MAXIMUM_FINITE_DOUBLE_LIST (1 << 4)
#include <double_list.h>

SUITE (finite_allocated_double_list_test) {
}
8 changes: 8 additions & 0 deletions test/double_list/finite_preprocessor_double_list_test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "double_list_test.h"

#define DOUBLE_LIST_MODE FINITE_PRERPOCESSOR_DOUBLE_LIST
#define PREPROCESSOR_DOUBLE_LIST_SIZE (1 << 4)
#include <double_list.h>

SUITE (finite_preprocessor_double_list_test) {
}
Loading

0 comments on commit 55e6b59

Please sign in to comment.