Some checks failed
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Failing after 5m37s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Has been cancelled
Bigfoot / Clang Format Checks (push) Has been cancelled
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Has been cancelled
74 lines
2.1 KiB
C++
74 lines
2.1 KiB
C++
/*********************************************************************
|
|
* \file Version.cpp
|
|
*
|
|
* \author Romain BOULLARD
|
|
* \date October 2025
|
|
*********************************************************************/
|
|
#include <Utils/Version.hpp>
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
namespace Bigfoot
|
|
{
|
|
class VersionFixture: public ::testing::Test
|
|
{
|
|
protected:
|
|
const Version m_detailed {1, 2, 3};
|
|
const Version m_combined {(1 << 16) | (2 << 8) | 3};
|
|
};
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(VersionFixture, string)
|
|
{
|
|
EXPECT_STREQ(static_cast<std::string>(m_detailed).data(), "1.2.3");
|
|
EXPECT_STREQ(static_cast<std::string>(m_combined).data(), "1.2.3");
|
|
}
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(VersionFixture, uint32_t)
|
|
{
|
|
EXPECT_EQ(static_cast<std::uint32_t>(m_detailed), (1 << 16) | (2 << 8) | 3);
|
|
EXPECT_EQ(static_cast<std::uint32_t>(m_combined), (1 << 16) | (2 << 8) | 3);
|
|
}
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(VersionFixture, GetMajor_ShouldBeEqualToTheMajorPartOfTheVersion)
|
|
{
|
|
EXPECT_EQ(m_detailed.GetMajor(), 1);
|
|
EXPECT_EQ(m_combined.GetMajor(), 1);
|
|
}
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(VersionFixture, GetMinor_ShouldBeEqualToTheMinorPartOfTheVersion)
|
|
{
|
|
EXPECT_EQ(m_detailed.GetMinor(), 2);
|
|
EXPECT_EQ(m_combined.GetMinor(), 2);
|
|
}
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(VersionFixture, GetPatch_ShouldBeEqualToThePatchPartOfTheVersion)
|
|
{
|
|
EXPECT_EQ(m_detailed.GetPatch(), 3);
|
|
EXPECT_EQ(m_combined.GetPatch(), 3);
|
|
}
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(VersionFixture, Comparisons)
|
|
{
|
|
constexpr Version other {2, 6, 4};
|
|
|
|
EXPECT_GT(other, m_detailed);
|
|
EXPECT_GE(other, other);
|
|
EXPECT_LT(m_detailed, other);
|
|
EXPECT_LE(other, other);
|
|
EXPECT_EQ(other, other);
|
|
EXPECT_NE(other, m_detailed);
|
|
}
|
|
} // namespace Bigfoot
|