From 9f22e53a3ba8f064e69e3a84c371a7f29ee9e05c Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 29 Sep 2024 21:58:22 +0200 Subject: Add complex keys (#774) This allows to add new kinds of keys that need more data without making KeyValue's footprint bigger for common keys. This changes the [_symbol] field into [_payload], which holds the same as the previous field for more common keys but can hold bigger objects for keys of the new "Complex" kind. This also adds a complex key: String keys with a symbol different than the outputted string. Unit tests are added as the Java language is not helpful in making robust code.--- test/juloo.keyboard2/KeyValueTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test/juloo.keyboard2/KeyValueTest.java (limited to 'test/juloo.keyboard2/KeyValueTest.java') diff --git a/test/juloo.keyboard2/KeyValueTest.java b/test/juloo.keyboard2/KeyValueTest.java new file mode 100644 index 0000000..1fde92b --- /dev/null +++ b/test/juloo.keyboard2/KeyValueTest.java @@ -0,0 +1,16 @@ +package juloo.keyboard2; + +import juloo.keyboard2.KeyValue; +import org.junit.Test; +import static org.junit.Assert.*; + +public class KeyValueTest +{ + public KeyValueTest() {} + + @Test + public void equals() + { + assertEquals(KeyValue.makeStringKeyWithSymbol("Foo", "Symbol", 0), KeyValue.makeStringKeyWithSymbol("Foo", "Symbol", 0)); + } +} -- cgit v1.2.3