#include "../src/set.c" #include "../src/testing.h" static void test_HASH_OUTPUT_LENGTH() { test_start("HASH_OUTPUT_LENGTH"); { testing("Enforce that SipHash's output matches endiannessbs's input"); return; // FIXME printf("\n"); printf("HASH_OUTPUT_LENGTH: %u\n", HASH_OUTPUT_LENGTH); printf("ENDIANNESSBS_64BIT_LENGTH: %u\n", ENDIANNESSBS_64BIT_LENGTH); assert(HASH_OUTPUT_LENGTH == ENDIANNESSBS_64BIT_LENGTH); test_ok(); } } static int test_set_new(void) { int rc = -1; const struct Set *s = NULL; test_start("set_new()"); { testing("simple allocation"); const size_t size = sizeof(long long); if (set_new(size, &s)) { logerr("set_new()"); goto out; } assert(s->value_size == size); set_free(&s); test_ok(); } rc = 0; out: if (s != NULL) { set_free(&s); } return rc; } static int test_set_free(void) { int rc = -1; const struct Set *s = NULL; test_start("set_free()"); { testing("*s becomes NULL again after set_free(&s)"); assert(s == NULL); if (set_new(1U, &s)) { logerr("set_new()"); goto out; } assert(s != NULL); set_free(&s); assert(s == NULL); test_ok(); } rc = 0; out: if (s != NULL) { set_free(&s); } return rc; } static int test_set_add(void) { int rc = -1; // FIXME rc = 0; return rc; } int main(void) { int rc = EXIT_FAILURE; test_HASH_OUTPUT_LENGTH(); if (test_set_new()) { logerr("test_set_new()"); goto out; } if (test_set_free()) { logerr("test_set_free()"); goto out; } if (test_set_add()) { logerr("test_set_add()"); goto out; } rc = EXIT_SUCCESS; out: return rc; }