Files
Bigfoot/Bigfoot/Tests/System/Time/Time.cpp
T
rboullard dc534acdd5
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 43s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 48s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 27s
Bigfoot / Sonarqube (game) (push) Successful in 5m8s
Bigfoot / Sonarqube (toolmode) (push) Failing after 5m13s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 32s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 1m21s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m24s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 1m4s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 1m8s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 49s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 54s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 29s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 36s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 1m21s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 26s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 45s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 1m1s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m5s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 50s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 55s
Bigfoot / Clang Format Checks (push) Successful in 12s
sonarqube-game ERROR
sonarqube-tool ERROR
Bigfoot / Sonarqube (toolmode) (pull_request) Failing after 5m25s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m32s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 1m5s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 1m15s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 38s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 55s
Bigfoot / Sonarqube (game) (pull_request) Failing after 5m0s
SonarQube Pass (#3)
Add Game project analysis

Reviewed-on: #3
Co-authored-by: Romain BOULLARD <romain.boullard@protonmail.com>
2026-09-02 00:01:33 +00:00

97 lines
2.6 KiB
C++

/*********************************************************************
* \file Time.cpp
*
* \author Romain BOULLARD
* \date December 2025
*********************************************************************/
#include <System/Time/Time.hpp>
#include <System/Time/Time_generated.hpp>
#include <gtest/gtest.h>
namespace Bigfoot
{
class TimeFixture: public ::testing::Test
{
public:
Time m_time {1'767'643'746'680'609};
Time m_earlierTime {1'767'643'746'680'608};
};
/****************************************************************************************/
TEST_F(TimeFixture, ComparisonOperators_ShouldOrderTimesByEpoch)
{
EXPECT_LT(m_earlierTime, m_time);
EXPECT_LE(m_earlierTime, m_time);
EXPECT_GT(m_time, m_earlierTime);
EXPECT_GE(m_time, m_earlierTime);
}
/****************************************************************************************/
TEST_F(TimeFixture, GetYear_ShouldReturnTheYear)
{
EXPECT_EQ(m_time.GetYear(), 2026);
}
/****************************************************************************************/
TEST_F(TimeFixture, GetMonth_ShouldReturnTheMonth)
{
EXPECT_EQ(m_time.GetMonth(), 1);
}
/****************************************************************************************/
TEST_F(TimeFixture, GetDay_ShouldReturnTheDay)
{
EXPECT_EQ(m_time.GetDay(), 5);
}
/****************************************************************************************/
TEST_F(TimeFixture, GetHour_ShouldReturnTheHour)
{
EXPECT_EQ(m_time.GetHour(), 20);
}
/****************************************************************************************/
TEST_F(TimeFixture, GetMinute_ShouldReturnTheMinute)
{
EXPECT_EQ(m_time.GetMinute(), 9);
}
/****************************************************************************************/
TEST_F(TimeFixture, GetSecond_ShouldReturnTheSecond)
{
EXPECT_EQ(m_time.GetSecond(), 6);
}
/****************************************************************************************/
TEST_F(TimeFixture, GetMicrosecond_ShouldReturnTheMicrosecond)
{
EXPECT_EQ(m_time.GetMicrosecond(), 680'609);
}
/****************************************************************************************/
TEST_F(TimeFixture, Pack_ShouldGiveAFlatTimeWithTheSameEpoch)
{
const ::Flat::Bigfoot::Time flatTime = flatbuffers::Pack(m_time);
EXPECT_EQ(flatTime.epoch(), m_time.GetEpoch());
}
/****************************************************************************************/
TEST_F(TimeFixture, UnPack_ShouldGiveBackTheOriginalTime)
{
const ::Flat::Bigfoot::Time flatTime = flatbuffers::Pack(m_time);
EXPECT_EQ(flatbuffers::UnPack(flatTime), m_time);
}
} // namespace Bigfoot