ladybird/Tests/AK/TestIntegerMath.cpp

21 lines
502 B
C++
Raw Normal View History

/*
* 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);
}