# Copyright (c) reifydb.com 2025
# This file is licensed under the AGPL-3.0-or-later

# This file includes and modifies code from the toydb project (https://github.com/erikgrinaker/toydb),
# originally licensed under the Apache License, Version 2.0.
# Original copyright:
#   Copyright (c) 2024 Erik Grinaker
#
# The original Apache License can be found at:
#   http://www.apache.org/licenses/LICENSE-2.0


# Tests various keys.

# Keys are case-sensitive.
set a=1
get a
get A
---
"a" → "1"
"A" → None

set A=2
get a
get A
---
"a" → "1"
"A" → "2"

remove a
remove A
scan
---
ok

# Empty keys and values are valid.
set ""=""
get ""
scan
remove ""
---
"" → ""
"" → ""

scan
---
ok

# NUL keys and values are valid.
set "\0"="\0"
get "\0"
scan
remove "\0"
---
"\x00" → "\x00"
"\x00" → "\x00"

scan
---
ok

# Unicode keys and values work, but are shown as raw UTF-8 bytes.
set "👋"="👋"
get "👋"
scan
remove "👋"
---
"\xf0\x9f\x91\x8b" → "\xf0\x9f\x91\x8b"
"\xf0\x9f\x91\x8b" → "\xf0\x9f\x91\x8b"

scan
---
ok
