summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/check_crf.c (renamed from src/test/check_cnp.c)48
1 files changed, 47 insertions, 1 deletions
diff --git a/src/test/check_cnp.c b/src/test/check_crf.c
index 2fbaac7..d99a838 100644
--- a/src/test/check_cnp.c
+++ b/src/test/check_crf.c
@@ -1,6 +1,6 @@
#include <stdio.h>
#include "../util.h"
-#include "../cnp.h"
+#include "../crf.h"
int
main(int UNUSED argc, char ** UNUSED argv)
@@ -8,8 +8,12 @@ main(int UNUSED argc, char ** UNUSED argv)
procr *pr = NULL;
procu *pu = NULL;
+ spa *spap = NULL;
+
prodecor *prod = NULL;
+ /* check crf */
+
crf *crfp = new_crf();
pair2 p = { 0 };
p.x = 0;
@@ -57,6 +61,47 @@ main(int UNUSED argc, char ** UNUSED argv)
#undef TABLE
#undef KEY
+ /* check spa */
+
+ spap = new_spa();
+
+ if (spap == NULL) {
+ fleprintf0("fail to have new spa\n");
+ goto cleanup;
+ }
+
+ pair3 p3 = (pair3) { 0 };
+ p3.x = 0;
+ p3.y = 1;
+ p3.z = 10;
+
+ if (spa_insert(spap, p3)) {
+ fleprintf0("Fail to insert\n");
+ goto cleanup;
+ }
+
+ printf("Successfully inserted into SPA\n");
+
+ if (spa_belong(spap, p3)) {
+ printf("Successfully found p3\n");
+ } else {
+ fleprintf0("Fail to find p3\n");
+ goto cleanup;
+ }
+
+ pair2 first_two = (pair2) { 0 };
+ first_two.x = 0;
+ first_two.y = 1;
+
+ if (spa_find(spap, first_two)) {
+ printf("Successfully found p2\n");
+ } else {
+ fleprintf0("Fail to find p2\n");
+ goto cleanup;
+ }
+
+ /* check prodecor */
+
BOOL error = 0;
pr = new_procr(10, &error);
@@ -97,6 +142,7 @@ main(int UNUSED argc, char ** UNUSED argv)
if (pr) destroy_procr(pr);
if (pu) destroy_procu(pu);
+ if (spap) destroy_spa(spap);
if (prod) free(prod);
return 0;