# 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 basic point operations.

# Getting a missing key in an empty store should return None.
get a
---
"a" → 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
---
"a" → "1"
"b" → "2"
"c" → None

# Replacing a key should return the new value.
set a=foo
get a
---
"a" → "foo"

# Deleting a key should remove it, but not affect other keys.
remove a
get a
get b
---
"a" → None
"b" → "2"

# removes are idempotent.
remove a
get a
---
"a" → None

# Writing a removed key works fine.
set a=1
get a
---
"a" → "1"

# Scan the final state.
scan
---
"a" → "1"
"b" → "2"
