summaryrefslogtreecommitdiff
path: root/tests/core
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-09-01 17:38:39 +0200
committerGitHub <noreply@github.com>2022-09-01 17:38:39 +0200
commit41156a1e83b1110dcd08e08d2fc063dfd7cd6899 (patch)
treea2583b37bb55d340828914f17a5b8e8634b6d23c /tests/core
parentd214956925c4d336c0a4f0d36e45cef30fdaab3c (diff)
parentcc424bcb18585f09148d12e28f8d4b9f54c8445d (diff)
Merge pull request #63968 from KoBeWi/finding_stuff_in_a_dictionary
Diffstat (limited to 'tests/core')
-rw-r--r--tests/core/variant/test_dictionary.h18
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