summaryrefslogtreecommitdiff
path: root/src/test/check_bsr.c
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2022-02-05 17:30:11 +0800
committerJSDurand <mmemmew@gmail.com>2022-02-05 17:30:11 +0800
commit510b10b96b546fcc6c6b6be85050305ddd192a41 (patch)
tree997d6c3f2c0a1ad6e27127d54a94655527e57864 /src/test/check_bsr.c
parent3fb5430080199a6d92a63f8259fe4a88df9b83ba (diff)
replace some hash table usage by tuples
Previously I used hash tables, which consume too much memory. Now the critical parts are replaced by a new hand-written library called "tuple.h". Now we can easily parse larger inputs. I haven't tested its limits, though.
Diffstat (limited to 'src/test/check_bsr.c')
-rw-r--r--src/test/check_bsr.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/test/check_bsr.c b/src/test/check_bsr.c
index 81a84a7..7f729ca 100644
--- a/src/test/check_bsr.c
+++ b/src/test/check_bsr.c
@@ -114,23 +114,39 @@ main(int UNUSED argc, char ** UNUSED argv)
BOOL error = 0;
- bsr *bsrp = new_bsr(&error, g);
+ bsr *bsrp = new_bsr(g, 10, &error);
if (error) goto cleanup;
- bsr_add(g, bsrp, 0, 0, 1, 0, 1, 2);
- bsr_add(g, bsrp, 0, 1, 1, 0, 1, 2);
- bsr_add(g, bsrp, 0, 1, 2, 0, 1, 2);
-
+ if (bsr_add(g, bsrp, (pair6) { 0, 0, 1, 0, 1, 2 })) {
+ fleprintf0("Fail to add to BSR\n");
+ goto cleanup;
+ }
+
+ if (bsr_add(g, bsrp, (pair6) { 0, 1, 1, 0, 1, 2 })) {
+ fleprintf0("Fail to add to BSR\n");
+ goto cleanup;
+ }
+
+ if (bsr_add(g, bsrp, (pair6) { 0, 1, 2, 0, 1, 2 })) {
+ fleprintf0("Fail to add to BSR\n");
+ goto cleanup;
+ }
+
+ if (bsr_add(g, bsrp, (pair6) { 0, 1, 3, 0, 1, 3 })) {
+ fleprintf0("Fail to add to BSR\n");
+ goto cleanup;
+ }
+
if (bsr_find(bsrp, g, &error,
- 0, 0, 1, 0, 1, 2)) {
+ (pair6) { 0, 0, 1, 0, 1, 2 })) {
printf("Successfully found 0, 0, 1, 0, 1, 2\n");
} else {
fleprintf0("Fail to find 0, 0, 1, 0, 1, 2\n");
}
if (bsr_find(bsrp, g, &error,
- 0, 0, 1, 0, 1, 3)) {
+ (pair6) { 0, 0, 1, 0, 1, 3 })) {
fleprintf0("Accidentally found 0, 0, 1, 0, 1, 3\n");
} else {
printf("Indeed cannot find 0, 0, 1, 0, 1, 3\n");