diff options
author | kobewi <kobewi4e@gmail.com> | 2022-08-05 19:08:27 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2022-08-16 13:48:59 +0200 |
commit | cc424bcb18585f09148d12e28f8d4b9f54c8445d (patch) | |
tree | 0266b0d5ded8d7b8219996e34ae4e309d682f4ac /tests | |
parent | d5d22ab035a611a567f73a2ee2d61a81c99c61b5 (diff) |
Add Dictionary.find_key()
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/variant/test_dictionary.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/core/variant/test_dictionary.h b/tests/core/variant/test_dictionary.h index 729035919d..c98434d42c 100644 --- a/tests/core/variant/test_dictionary.h +++ b/tests/core/variant/test_dictionary.h @@ -500,6 +500,24 @@ TEST_CASE("[Dictionary] Recursive self comparison") { d2.clear(); } +TEST_CASE("[Dictionary] Order and find") { + Dictionary d; + d[4] = "four"; + d[8] = "eight"; + d[12] = "twelve"; + d["4"] = "four"; + + Array keys; + keys.append(4); + keys.append(8); + keys.append(12); + keys.append("4"); + + CHECK_EQ(d.keys(), keys); + CHECK_EQ(d.find_key("four"), Variant(4)); + CHECK_EQ(d.find_key("does not exist"), Variant()); +} + } // namespace TestDictionary #endif // TEST_DICTIONARY_H |