From 39e03bbc264ad869a985e89c723bd76d8b16d243 Mon Sep 17 00:00:00 2001 From: wes Date: Tue, 11 Jul 2017 19:22:08 -0400 Subject: [PATCH] add small test case, fix Makefile --- Makefile | 2 +- bfilter.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f57fb87..4c00a99 100644 --- a/Makefile +++ b/Makefile @@ -2,5 +2,5 @@ default: $(MAKE) lib lib: bfilter.c bfilter.h - $(CC) -g -DLIB -c -fpic -Wall -Wextra -pedantic -Wpointer-arith -Werror -std=c99 -lfnv -lm -L. -O3 ./bfilter.c -Wl,-rpath,/; + $(CC) -g -DLIB -c -fpic -Wall -Wextra -pedantic -Wpointer-arith -std=c99 -lfnv -lm -L. -O3 ./bfilter.c -Wl,-rpath./; $(CC) -shared -o bfilter.so bfilter.o; diff --git a/bfilter.py b/bfilter.py index 666a29a..19f742f 100755 --- a/bfilter.py +++ b/bfilter.py @@ -61,3 +61,14 @@ class BloomFilter: def __getitem__(self, key): return lib.bfilter_get(self.bitset, key.encode("UTF-8"), self.k) == 1 + + +if __name__ == "__main__": + test = BloomFilter() + print(test) + test.add("one") + test.add("two") + test.add("three") + + assert test["three"] + assert not test["four"]