initialize dynamic array library with tests and configuration files
This commit is contained in:
37
src/test_dynamic_array.c
Normal file
37
src/test_dynamic_array.c
Normal file
@@ -0,0 +1,37 @@
|
||||
#include "unity.h"
|
||||
|
||||
#include "dynamic_array.h"
|
||||
|
||||
|
||||
void setUp() {
|
||||
}
|
||||
|
||||
void tearDown() {
|
||||
}
|
||||
|
||||
|
||||
void test_array_builder_without_options(void) {
|
||||
Array *array = array_builder(NULL);
|
||||
TEST_ASSERT_EQUAL(DEFAULT_ARRAY_SIZE, array->capacity);
|
||||
}
|
||||
|
||||
|
||||
void test_array_builder_with_options(void) {
|
||||
const int EXPECTED_CAPACITY = 20;
|
||||
|
||||
Array *array = array_builder(&(ArrayBuilderOptions){
|
||||
.initial_size = EXPECTED_CAPACITY
|
||||
});
|
||||
TEST_ASSERT_EQUAL(EXPECTED_CAPACITY, array->capacity);
|
||||
}
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
|
||||
RUN_TEST(test_array_builder_without_options);
|
||||
RUN_TEST(test_array_builder_with_options);
|
||||
|
||||
return UNITY_END();
|
||||
}
|
||||
Reference in New Issue
Block a user