Files

23 lines
504 B
C++
Raw Permalink Normal View History

2024-08-08 14:38:35 +09:00
/*
* SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
*
* SPDX-License-Identifier: MIT
*/
2024-08-08 14:30:50 +09:00
/*
UnitTest for M5Utility
*/
#include <gtest/gtest.h>
#include <M5Utility.hpp>
2024-09-25 18:24:01 +09:00
TEST(Utility, is_powerof2)
{
2024-08-08 14:30:50 +09:00
EXPECT_FALSE(m5::math::is_powerof2(0));
EXPECT_TRUE(m5::math::is_powerof2(1));
EXPECT_TRUE(m5::math::is_powerof2(2));
EXPECT_FALSE(m5::math::is_powerof2(3));
constexpr auto b = m5::math::is_powerof2(-1);
EXPECT_FALSE(b);
EXPECT_FALSE(m5::math::is_powerof2(-2));
}