mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Tests/AK: Add some quick tests for AK::clamp_to
This commit is contained in:
parent
f6a4973578
commit
172f4588a7
Notes:
sideshowbarker
2024-07-17 05:21:12 +09:00
Author: https://github.com/Zaggy1024 Commit: https://github.com/LadybirdBrowser/ladybird/commit/172f4588a7 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/230 Reviewed-by: https://github.com/ADKaster
1 changed files with 13 additions and 0 deletions
|
@ -116,3 +116,16 @@ TEST_CASE(ceil_log2)
|
|||
EXPECT_EQ(AK::ceil_log2<u64>(13835058055282163712ull), 64ull);
|
||||
EXPECT_EQ(AK::ceil_log2<u64>(18446744073709551615ull), 64ull);
|
||||
}
|
||||
|
||||
TEST_CASE(clamp_to)
|
||||
{
|
||||
EXPECT_EQ((AK::clamp_to<i32>(NumericLimits<u64>::max())), NumericLimits<i32>::max());
|
||||
|
||||
EXPECT_EQ((AK::clamp_to<u32>(-10)), 0u);
|
||||
|
||||
EXPECT_EQ((AK::clamp_to<i32>(NumericLimits<i64>::min())), NumericLimits<i32>::min());
|
||||
EXPECT_EQ((AK::clamp_to<i32>(NumericLimits<i64>::max())), NumericLimits<i32>::max());
|
||||
|
||||
EXPECT_EQ(AK::clamp_to<i64>(-9223372036854775808.0), NumericLimits<i64>::min());
|
||||
EXPECT_EQ(AK::clamp_to<i64>(9223372036854775807.0), NumericLimits<i64>::max());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue