first commit
This commit is contained in:
commit
5893b00dd2
1669 changed files with 1982740 additions and 0 deletions
22
libraries/M5Utility/test/math_test.cpp
Normal file
22
libraries/M5Utility/test/math_test.cpp
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
/*
|
||||
UnitTest for M5Utility
|
||||
*/
|
||||
#include <gtest/gtest.h>
|
||||
#include <M5Utility.hpp>
|
||||
|
||||
TEST(Utility, is_powerof2)
|
||||
{
|
||||
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));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue