Rework Dictionary::TryGet to use std::optional.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -48,16 +48,14 @@ TEST_CASE("Create Dictionary, insert value, then update value") {
|
||||
TEST_CASE("Create Dictionary, insert value, try get value") {
|
||||
auto dic = Dictionary<int, int>(5);
|
||||
dic.Insert(10, 5);
|
||||
int result = 0;
|
||||
CHECK(dic.TryGet(10, result));
|
||||
CHECK(result == 5);
|
||||
auto v = dic.TryGet(10);
|
||||
CHECK(v.has_value());
|
||||
CHECK(v.value() == 5);
|
||||
}
|
||||
|
||||
TEST_CASE("Create Dictionary, insert value, try get non existing value") {
|
||||
auto dic = Dictionary<int, int>(5);
|
||||
int result = 0;
|
||||
CHECK_FALSE(dic.TryGet(10, result));
|
||||
CHECK(result == 0);
|
||||
CHECK_FALSE(dic.TryGet(10).has_value());
|
||||
}
|
||||
|
||||
TEST_CASE("Create Dictionary, insert value, Has") {
|
||||
|
||||
Reference in New Issue
Block a user