diff options
author | justanothercatgirl <sotov2070@gmail.com> | 2024-06-20 14:29:58 +0300 |
---|---|---|
committer | justanothercatgirl <sotov2070@gmail.com> | 2024-06-20 14:29:58 +0300 |
commit | 86263835b2f9727531d8941733df8e05705354bf (patch) | |
tree | dc28138b234b2456cb384b786839f35715f32a66 /tests/obscure.c | |
parent | 3966bcd9601b6871f9e6d08656d517b5e916c77d (diff) |
added tests for an array of pointers
Diffstat (limited to 'tests/obscure.c')
-rw-r--r-- | tests/obscure.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/obscure.c b/tests/obscure.c new file mode 100644 index 0000000..190ff09 --- /dev/null +++ b/tests/obscure.c @@ -0,0 +1,24 @@ +#include <stdio.h> + +#define CONTAINER_IMPLEMENTATION +#include "../include/container.h" + +typedef char* packet_t; + +int main() { + packet_t *data = array_new(packet_t, 0); + packet_t el_0 = malloc(128); + memset(el_0, 42, 128); + packet_t el_1 = malloc(128); + memset(el_1, 69, 128); + array_push(data, el_0); + array_push(data, el_1); + for (size_t i = 0; i < array_size(data); ++i) { + for (size_t j = 0; j < 128; ++j) { + printf("%.2X ", data[i][j]); + } + putchar('\n'); + } + return (data[0][69] == 42 && data[1][42] == 69 ? 0 : 1); + // OS will free it for me +} |