add more tests

This commit is contained in:
2025-11-21 14:01:55 +01:00
parent 314dafa164
commit 6e4d9dfc0f

View File

@@ -24,15 +24,29 @@ steps:
- apk update
- apk add --no-cache bash build-base pcre2 pcre2-dev db db-dev
- rm -f test.db
- build/dbtool -d test.db -i -k "test" -v "blah"
- build/dbtool -d test.db -i -k "foo" -v "bar"
# insert keys
- build/dbtool -d test.db -i -k test -v blah
- build/dbtool -d test.db -i -k foo -v bar
# look if the appear in the dump
- build/dbtool -d test.db -D | grep blah
# count 'em
- build/dbtool -d test.db -D | wc -l | grep 2
# search for key
- build/dbtool -d test.db -s -k test
# search for key regex
- build/dbtool -d test.db -S -k 't$'
# deletion doesn't work with berkeley currently?
#- build/dbtool -d test.db -r -k foo
#- build/dbtool -d test.db -D | wc -l | grep 1
# remove key
- build/dbtool -d test.db -r -k foo
# count must match
- build/dbtool -d test.db -D | wc -l | grep 1
# modify a key
- build/dbtool -d test.db -u -k test -v modified
# check modified key
- build/dbtool -d test.db -s -k test | grep modified
# use splitting with regex
- printf "today:100\nyesterday:500\n" | build/dbtool -d test.db -i -f -t '^([^:]*):([^:]*)'
# check if it works
- cat /etc/passwd | build/dbtool -d test.db -s -k today | grep 100
build-gdbm:
@@ -56,12 +70,27 @@ steps:
- apk update
- apk add --no-cache bash build-base pcre2 pcre2-dev gdbm gdbm-dev
- rm -f test.db
- build/dbtool -d test.db -i -k "test" -v "blah"
- build/dbtool -d test.db -i -k "foo" -v "bar"
# insert keys
- build/dbtool -d test.db -i -k test -v blah
- build/dbtool -d test.db -i -k foo -v bar
# look if the appear in the dump
- build/dbtool -d test.db -D | grep blah
# count 'em
- build/dbtool -d test.db -D | wc -l | grep 2
# search for key
- build/dbtool -d test.db -s -k test
# search for key regex
- build/dbtool -d test.db -S -k 't$'
# remove key
- build/dbtool -d test.db -r -k foo
# count must match
- build/dbtool -d test.db -D | wc -l | grep 1
# modify a key
- build/dbtool -d test.db -u -k test -v modified
# check modified key
- build/dbtool -d test.db -s -k test | grep modified
# use splitting with regex
- printf "today:100\nyesterday:500\n" | build/dbtool -d test.db -i -f -t '^([^:]*):([^:]*)'
# check if it works
- cat /etc/passwd | build/dbtool -d test.db -s -k today | grep 100