mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:37:46 +00:00
AK: Introduce IntegralMath.h starting with pow<I>
This commit is contained in:
parent
64f135d90f
commit
581c23dc55
3 changed files with 56 additions and 0 deletions
20
Tests/AK/TestIntegerMath.cpp
Normal file
20
Tests/AK/TestIntegerMath.cpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibTest/TestCase.h>
|
||||
|
||||
#include <AK/IntegralMath.h>
|
||||
|
||||
TEST_CASE(pow)
|
||||
{
|
||||
EXPECT_EQ(AK::pow<u64>(10, 0), 1ull);
|
||||
EXPECT_EQ(AK::pow<u64>(10, 1), 10ull);
|
||||
EXPECT_EQ(AK::pow<u64>(10, 2), 100ull);
|
||||
EXPECT_EQ(AK::pow<u64>(10, 3), 1'000ull);
|
||||
EXPECT_EQ(AK::pow<u64>(10, 4), 10'000ull);
|
||||
EXPECT_EQ(AK::pow<u64>(10, 5), 100'000ull);
|
||||
EXPECT_EQ(AK::pow<u64>(10, 6), 1'000'000ull);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue