Merge remote-tracking branch 'krobelus/hashset-no-braces'

This commit is contained in:
Maxime Coste 2022-09-09 15:40:08 +02:00
commit 1b4a6a03ee

View File

@ -95,8 +95,8 @@ UnitTest test_hash_set{[] {
// Basic usage // Basic usage
{ {
HashSet<int> set; HashSet<int> set;
set.insert({10}); set.insert(10);
set.insert({20}); set.insert(20);
kak_assert(set.find_index(0) == -1); kak_assert(set.find_index(0) == -1);
kak_assert(set.find_index(10) == 0); kak_assert(set.find_index(10) == 0);
kak_assert(set.find_index(20) == 1); kak_assert(set.find_index(20) == 1);
@ -113,8 +113,8 @@ UnitTest test_hash_set{[] {
// Replace Multiple entries with the same key // Replace Multiple entries with the same key
{ {
HashSet<int> set; HashSet<int> set;
set.insert({10}); set.insert(10);
set.insert({10}); set.insert(10);
kak_assert(set.find_index(10) == 0); kak_assert(set.find_index(10) == 0);
kak_assert(set.size() == 1); kak_assert(set.size() == 1);
set.remove(10); set.remove(10);
@ -124,15 +124,15 @@ UnitTest test_hash_set{[] {
// Multiple entries with the same key // Multiple entries with the same key
{ {
MultiHashSet<int> set; MultiHashSet<int> set;
set.insert({10}); set.insert(10);
set.insert({10}); set.insert(10);
kak_assert(set.find_index(10) == 0); kak_assert(set.find_index(10) == 0);
set.remove(10); set.remove(10);
kak_assert(set.find_index(10) == 0); kak_assert(set.find_index(10) == 0);
set.remove(10); set.remove(10);
kak_assert(set.find_index(10) == -1); kak_assert(set.find_index(10) == -1);
set.insert({20}); set.insert(20);
set.insert({20}); set.insert(20);
set.remove_all(20); set.remove_all(20);
kak_assert(set.find_index(20) == -1); kak_assert(set.find_index(20) == -1);
} }
@ -140,7 +140,7 @@ UnitTest test_hash_set{[] {
// Check hash compatible support // Check hash compatible support
{ {
HashSet<String> set; HashSet<String> set;
set.insert({"test"}); set.insert("test");
kak_assert(set["test"_sv] == "test"); kak_assert(set["test"_sv] == "test");
set.remove("test"_sv); set.remove("test"_sv);
} }