mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:57:35 +00:00
Tests: Move AK tests to Tests/AK
This commit is contained in:
parent
fd0dbd1ebf
commit
67322b0702
64 changed files with 1 additions and 2 deletions
23
Tests/AK/TestBitCast.cpp
Normal file
23
Tests/AK/TestBitCast.cpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2021, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibTest/TestCase.h>
|
||||
|
||||
#include <AK/BitCast.h>
|
||||
|
||||
template<typename A, typename B>
|
||||
void check_cast_both_ways(const A& a, const B& b)
|
||||
{
|
||||
EXPECT_EQ((bit_cast<A, B>(b)), a);
|
||||
EXPECT_EQ((bit_cast<B, A>(a)), b);
|
||||
}
|
||||
|
||||
TEST_CASE(double_int_conversion)
|
||||
{
|
||||
check_cast_both_ways(static_cast<u64>(0), 0.0);
|
||||
check_cast_both_ways(static_cast<u64>(1) << 63, -0.0);
|
||||
check_cast_both_ways(static_cast<u64>(0x4172f58bc0000000), 19880124.0);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue