aboutsummaryrefslogtreecommitdiff
path: root/src/lib/third_party
diff options
context:
space:
mode:
authorWilliam Guglielmo <william@deselmo.com>2017-05-30 21:04:57 +0200
committerGitHub <noreply@github.com>2017-05-30 21:04:57 +0200
commitb08fbe46c0e72ad858655eadc24c7674c495dc06 (patch)
treeb4672da52d6fd542c7a3af9cbc5dd20d6be2b523 /src/lib/third_party
parent4a751f9d05ba742313fc0a88b1b3962ee51dac7d (diff)
Delete test.c
Diffstat (limited to 'src/lib/third_party')
-rw-r--r--src/lib/third_party/src/test.c71
1 files changed, 0 insertions, 71 deletions
diff --git a/src/lib/third_party/src/test.c b/src/lib/third_party/src/test.c
deleted file mode 100644
index 63097fcc3..000000000
--- a/src/lib/third_party/src/test.c
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#include "libcache.h"
-
-
-int main() {
- cache_t cache = cache_new(3);
- long e;
-
- e = 0;
- assert(cache_add(cache, &e, sizeof(e)) == CACHE_NO_ERROR);
- assert(cache_contains(cache, &e, sizeof(e)) == CACHE_CONTAINS_TRUE);
- assert(cache_remove(cache, &e, sizeof(e)) == CACHE_NO_ERROR);
- assert(cache_remove(cache, &e, sizeof(e)) == CACHE_REMOVE_NOT_FOUND);
- assert(cache_contains(cache, &e, sizeof(e)) == CACHE_CONTAINS_FALSE);
- assert(cache_add(cache, &e, sizeof(e)) == CACHE_NO_ERROR);
- assert(cache_contains(cache, &e, sizeof(e)) == CACHE_CONTAINS_TRUE);
- e = 1;
- assert(cache_add(cache, &e, sizeof(e)) == CACHE_NO_ERROR);
- assert(cache_contains(cache, &e, sizeof(e)) == CACHE_CONTAINS_TRUE);
- e = 2;
- assert(cache_add(cache, &e, sizeof(e)) == CACHE_NO_ERROR);
- assert(cache_contains(cache, &e, sizeof(e)) == CACHE_CONTAINS_TRUE);
- e = 3;
- assert(cache_add(cache, &e, sizeof(e)) == CACHE_NO_ERROR);
- assert(cache_contains(cache, &e, sizeof(e)) == CACHE_CONTAINS_TRUE);
- e = 0;
- assert(cache_contains(cache, &e, sizeof(e)) == CACHE_CONTAINS_FALSE);
- e = 1;
- assert(cache_contains(cache, &e, sizeof(e)) == CACHE_CONTAINS_TRUE);
- e = 2;
- assert(cache_contains(cache, &e, sizeof(e)) == CACHE_CONTAINS_TRUE);
- e = 3;
- assert(cache_contains(cache, &e, sizeof(e)) == CACHE_CONTAINS_TRUE);
- e = 1;
- assert(cache_add(cache, &e, sizeof(e)) == CACHE_NO_ERROR);
- e = 4;
- assert(cache_add(cache, &e, sizeof(e)) == CACHE_NO_ERROR);
- e = 0;
- assert(cache_contains(cache, &e, sizeof(e)) == CACHE_CONTAINS_FALSE);
- e = 1;
- assert(cache_contains(cache, &e, sizeof(e)) == CACHE_CONTAINS_TRUE);
- e = 2;
- assert(cache_contains(cache, &e, sizeof(e)) == CACHE_CONTAINS_FALSE);
- e = 3;
- assert(cache_contains(cache, &e, sizeof(e)) == CACHE_CONTAINS_TRUE);
- e = 4;
- assert(cache_contains(cache, &e, sizeof(e)) == CACHE_CONTAINS_TRUE);
- // e = 5;
- // assert(cache_add(cache, &e, sizeof(e)) == CACHE_NO_ERROR);
- // e = 1;
- // assert(cache_contains(cache, &e, sizeof(e)) == CACHE_CONTAINS_FALSE);
-
- for(e = 0; e < 1000; e++) {
- assert(cache_add(cache, &e, sizeof(e)) == CACHE_NO_ERROR);
- assert(cache_contains(cache, &e, sizeof(e)) == CACHE_CONTAINS_TRUE);
- }
- for(e = 0; e < 997; e++) {
- assert(cache_contains(cache, &e, sizeof(e)) == CACHE_CONTAINS_FALSE);
- }
- for(e = 997; e < 1000; e++) {
- assert(cache_contains(cache, &e, sizeof(e)) == CACHE_CONTAINS_TRUE);
- }
-
- cache_free(cache);
-
- puts("OK");
- return 0;
-}