From 510b10b96b546fcc6c6b6be85050305ddd192a41 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sat, 5 Feb 2022 17:30:11 +0800 Subject: 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. --- src/test/check_bsr.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'src/test/check_bsr.c') 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"); -- cgit v1.2.3-18-g5258