diff options
author | Andreas Kling <kling@serenityos.org> | 2021-06-24 19:53:42 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-24 19:57:01 +0200 |
commit | ee3a73ddbb90f6ebab22e099c34e1aae400a81d1 (patch) | |
tree | 57c053e3124f18ee3239fe8dbad831b7708e3ee8 /Tests/AK/TestVariant.cpp | |
parent | 6215a9c2cbdfe0c631ed339e5266580d271a3882 (diff) | |
download | serenity-ee3a73ddbb90f6ebab22e099c34e1aae400a81d1.zip |
AK: Rename downcast<T> => verify_cast<T>
This makes it much clearer what this cast actually does: it will
VERIFY that the thing we're casting is a T (using is<T>()).
Diffstat (limited to 'Tests/AK/TestVariant.cpp')
-rw-r--r-- | Tests/AK/TestVariant.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Tests/AK/TestVariant.cpp b/Tests/AK/TestVariant.cpp index 1495fda1a6..2c1b0c725f 100644 --- a/Tests/AK/TestVariant.cpp +++ b/Tests/AK/TestVariant.cpp @@ -77,17 +77,17 @@ TEST_CASE(move_moves) EXPECT(second_variant.has<NoCopy>()); } -TEST_CASE(downcast) +TEST_CASE(verify_cast) { Variant<i8, i16, i32, i64> one_integer_to_rule_them_all { static_cast<i32>(42) }; - auto fake_integer = one_integer_to_rule_them_all.downcast<i8, i32>(); + auto fake_integer = one_integer_to_rule_them_all.verify_cast<i8, i32>(); EXPECT(fake_integer.has<i32>()); EXPECT(one_integer_to_rule_them_all.has<i32>()); EXPECT_EQ(fake_integer.get<i32>(), 42); EXPECT_EQ(one_integer_to_rule_them_all.get<i32>(), 42); fake_integer = static_cast<i8>(60); - one_integer_to_rule_them_all = fake_integer.downcast<i8, i16>().downcast<i8, i32, float>().downcast<i8, i16, i32, i64>(); + one_integer_to_rule_them_all = fake_integer.verify_cast<i8, i16>().verify_cast<i8, i32, float>().verify_cast<i8, i16, i32, i64>(); EXPECT(fake_integer.has<i8>()); EXPECT(one_integer_to_rule_them_all.has<i8>()); EXPECT_EQ(fake_integer.get<i8>(), 60); |