-
Notifications
You must be signed in to change notification settings - Fork 574
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
storage: use goldenscript for
Engine
tests
- Loading branch information
1 parent
4c770d1
commit 1821572
Showing
7 changed files
with
265 additions
and
56 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Tests various keys. | ||
|
||
# Keys are case-sensitive. | ||
set a=1 | ||
get a | ||
get A | ||
--- | ||
61 → None | ||
41 → None | ||
|
||
set A=2 | ||
get a | ||
get A | ||
--- | ||
61 → None | ||
41 → None | ||
|
||
delete a | ||
delete A | ||
scan | ||
--- | ||
ok | ||
|
||
# Empty keys and values are valid. | ||
set ""="" | ||
get "" | ||
scan | ||
delete "" | ||
--- | ||
→ | ||
→ | ||
|
||
scan | ||
--- | ||
ok | ||
|
||
# NULL keys and values are valid. | ||
set "\0"="\0" | ||
get "\0" | ||
scan | ||
delete "\0" | ||
--- | ||
00 → None | ||
00 → 00 | ||
|
||
scan | ||
--- | ||
ok | ||
|
||
# Unicode keys and values are valid. | ||
set "👋"="👋" | ||
get "👋" | ||
scan | ||
delete "👋" | ||
--- | ||
f09f918b → None | ||
f09f918b → f09f918b | ||
|
||
scan | ||
--- | ||
ok |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Tests basic point operations. | ||
|
||
# Getting a missing key in an empty store should return None. | ||
get a | ||
--- | ||
61 → None | ||
|
||
# Write a couple of keys. | ||
set a=1 | ||
set b=2 | ||
--- | ||
ok | ||
|
||
# Reading the value back should return it. An unknown key should return None. | ||
get a | ||
get b | ||
get c | ||
--- | ||
61 → None | ||
62 → None | ||
63 → None | ||
|
||
# Replacing a key should return the new value. | ||
set a=foo | ||
get a | ||
--- | ||
61 → None | ||
|
||
# Deleting a key should remove it, but not affect other keys. | ||
delete a | ||
get a | ||
get b | ||
--- | ||
61 → None | ||
62 → None | ||
|
||
# Deletes are idempotent. | ||
delete a | ||
get a | ||
--- | ||
61 → None | ||
|
||
# Writing a deleted key works fine. | ||
set a=1 | ||
get a | ||
--- | ||
61 → None | ||
|
||
# Scan the final state. | ||
scan | ||
--- | ||
61 → 31 | ||
62 → 32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Tests prefix scans. | ||
|
||
# Set up an initial dataset of keys with overlapping or adjacent prefixes. | ||
# TODO the byte encoding here doesn't work properly. | ||
set a=1 | ||
set b=2 | ||
set ba=21 | ||
set bb=22 | ||
set "b\xff"=2f | ||
set "b\xff\x00"=2f0 | ||
set "b\xffb"=2fb | ||
set "b\xff\xff"=2ff | ||
set c=3 | ||
set "\xff"=f | ||
set "\xff\xff"=ff | ||
set "\xff\xff\xff"=fff | ||
set "\xff\xff\xff\xff"=ffff | ||
scan | ||
--- | ||
61 → 31 | ||
62 → 32 | ||
6261 → 3231 | ||
6262 → 3232 | ||
62c3bf → 3266 | ||
62c3bf00 → 326630 | ||
62c3bf62 → 326662 | ||
62c3bfc3bf → 326666 | ||
63 → 33 | ||
c3bf → 66 | ||
c3bfc3bf → 6666 | ||
c3bfc3bfc3bf → 666666 | ||
c3bfc3bfc3bfc3bf → 66666666 | ||
|
||
# An empty prefix returns everything. | ||
scan_prefix "" | ||
--- | ||
61 → 31 | ||
62 → 32 | ||
6261 → 3231 | ||
6262 → 3232 | ||
62c3bf → 3266 | ||
62c3bf00 → 326630 | ||
62c3bf62 → 326662 | ||
62c3bfc3bf → 326666 | ||
63 → 33 | ||
c3bf → 66 | ||
c3bfc3bf → 6666 | ||
c3bfc3bfc3bf → 666666 | ||
c3bfc3bfc3bfc3bf → 66666666 |