GiteaCI (#1)
Some checks failed
Bigfoot / Build & Test Debug (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test Release (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test Release (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test Debug (Unity Build: OFF) (push) Has been cancelled

Reviewed-on: #1
Co-authored-by: Romain BOULLARD <romain.boullard@protonmail.com>
Co-committed-by: Romain BOULLARD <romain.boullard@protonmail.com>
This commit was merged in pull request #1.
This commit is contained in:
2026-01-28 14:29:12 +00:00
committed by Romain BOULLARD
parent a82ec43e74
commit 6cd9801ef7
71 changed files with 1639 additions and 745 deletions

View File

@@ -1 +0,0 @@

View File

@@ -1,7 +1,15 @@
get_filename_component(PackageName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
project(${PackageName}Tests)
bigfoot_create_bigfile(${PackageName}Tests "Tests/Bigfoot")
set(BigfootDependencies
Engine
System
Utils)
bigfoot_create_bigfile("Tests/Bigfoot")
bigfoot_create_package_tests(
${PackageName}
"")
""
"${BigfootDependencies}")
bigfoot_setup_dependencies("Tests/Bigfoot")

View File

@@ -1,19 +0,0 @@
// AUTO-GENERATED DO NOT TOUCH
/*********************************************************************
* \file BigFileInfo.generated.hpp
*
*********************************************************************/
#ifndef BIGFOOT_BIGFOOT_BIGFILEINFO_GENERATED_HPP
#define BIGFOOT_BIGFOOT_BIGFILEINFO_GENERATED_HPP
#include <string_view>
namespace Bigfoot
{
/*
* BigFile location
*/
constexpr std::string_view BIGFILE_BIGFOOT_LOCATION{"D:/Development/bigfootdev/bigfoot2/build/Bigfoot/Tests/Engine/Bigfoot-bigfile.db"};
}
#endif

View File

@@ -1,19 +0,0 @@
// AUTO-GENERATED DO NOT TOUCH
/*********************************************************************
* \file BigFileInfo.generated.hpp
*
*********************************************************************/
#ifndef BIGFOOT_ENGINE_BIGFILE_BIGFILEINFO_GENERATED_HPP
#define BIGFOOT_ENGINE_BIGFILE_BIGFILEINFO_GENERATED_HPP
#include <string_view>
namespace Bigfoot
{
/*
* BigFile location
*/
constexpr std::string_view BIGFILE_ENGINETESTS_LOCATION{"D:/Development/bigfootdev/bigfoot2/build/Bigfoot/Tests/Engine/EngineTests-bigfile.db"};
}
#endif

View File

@@ -0,0 +1 @@
// to delete when an actual test is in EngineTests

View File

@@ -1,7 +1,14 @@
get_filename_component(PackageName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
project(${PackageName}Tests)
set(Dependencies)
set(BigfootDependencies
System
Utils)
bigfoot_create_package_tests(
${PackageName}
"")
""
"${BigfootDependencies}")
bigfoot_create_logger()
bigfoot_setup_dependencies("Tests/Bigfoot")

View File

@@ -0,0 +1,80 @@
/*********************************************************************
* \file File.cpp
*
* \author Romain BOULLARD
* \date December 2025
*********************************************************************/
#include <System/File.hpp>
#include <gtest/gtest.h>
namespace Bigfoot
{
class FileFixture: public ::testing::Test
{
public:
File m_file {eastl::string_view {"Fixture/file"}};
File m_nonExistent {eastl::string_view {"Fixture/bigfoot"}};
};
/****************************************************************************************/
TEST_F(FileFixture, IsRelative_ShouldReturnTrueOnRelativeFile)
{
EXPECT_TRUE(m_file.IsRelative());
}
/****************************************************************************************/
TEST_F(FileFixture, IsRelative_ShouldReturnFalseOnAbsoluteFile)
{
EXPECT_FALSE(m_file.Absolute().IsRelative());
}
/****************************************************************************************/
TEST_F(FileFixture, IsAbsolute_ShouldReturnTrueOnAbsoluteFile)
{
EXPECT_TRUE(m_file.Absolute().IsAbsolute());
}
TEST_F(FileFixture, IsAbsolute_ShouldReturnFalseOnRelativeFile)
{
EXPECT_FALSE(m_file.IsAbsolute());
}
/****************************************************************************************/
TEST_F(FileFixture, Exists_ShouldReturnTrueOnExistingFile)
{
EXPECT_TRUE(m_file.Exists());
}
/****************************************************************************************/
TEST_F(FileFixture, Exists_ShouldReturnFalseOnNonExistingFile)
{
EXPECT_FALSE(m_nonExistent.Exists());
}
/****************************************************************************************/
TEST_F(FileFixture, Path_ShouldReturnThePath)
{
EXPECT_STREQ(m_file.Path().data(), "Fixture/file");
}
/****************************************************************************************/
TEST_F(FileFixture, Absolute_ShouldReturnTheAbsolutePath)
{
EXPECT_STREQ(std::filesystem::absolute("Fixture/file").string().c_str(), m_file.Absolute().Path().data());
}
/****************************************************************************************/
TEST_F(FileFixture, Relative_ShouldReturnTheRelativePath)
{
EXPECT_STREQ(std::filesystem::relative("Fixture/file").string().c_str(), m_file.Relative().Path().data());
}
} // namespace Bigfoot

View File

@@ -0,0 +1,21 @@
// AUTO-GENERATED DO NOT TOUCH
/*********************************************************************
* \file SystemTestsLogger.generated.hpp
*
*********************************************************************/
#ifndef BIGFOOT_SYSTEMTESTSLOGGER_GENERATED_HPP
#define BIGFOOT_SYSTEMTESTSLOGGER_GENERATED_HPP
#include <System/Log/Log.hpp>
#if defined BIGFOOT_NOT_OPTIMIZED
namespace Bigfoot
{
/*
* Logger
*/
inline Log::LoggerInfo SYSTEMTESTS_LOGGER {"SYSTEMTESTS_LOGGER", Flat::LogLevel::Trace};
} // namespace Bigfoot
#endif
#endif

View File

@@ -4,9 +4,11 @@
* \author Romain BOULLARD
* \date December 2022
*********************************************************************/
#include <Utils/Log.hpp>
#include <System/Log/Log.hpp>
#include <UtilsTests/UtilsTestsLogger.generated.hpp>
#include <Utils/Singleton.hpp>
#include <SystemTests/SystemTestsLogger_generated.hpp>
#if defined BIGFOOT_NOT_OPTIMIZED
@@ -19,51 +21,51 @@ class LogFixture: public ::testing::Test
protected:
void SetUp() override
{
UTILSTESTS_LOGGER = {"UTILSTESTS_LOGGER", Log::LogLevel::Trace};
SYSTEMTESTS_LOGGER = {"UTILSTESTS_LOGGER", Flat::LogLevel::Trace};
}
constexpr Log::LogLevel QuillLogLevelToLogLevel(const quill::LogLevel p_level)
static constexpr Flat::LogLevel QuillLogLevelToLogLevel(const quill::LogLevel p_level)
{
switch (p_level)
{
case quill::LogLevel::Debug:
return Log::LogLevel::Debug;
return Flat::LogLevel::Debug;
case quill::LogLevel::TraceL3:
return Log::LogLevel::Trace;
return Flat::LogLevel::Trace;
case quill::LogLevel::Info:
return Log::LogLevel::Info;
return Flat::LogLevel::Info;
case quill::LogLevel::Warning:
return Log::LogLevel::Warn;
return Flat::LogLevel::Warn;
case quill::LogLevel::Error:
return Log::LogLevel::Error;
return Flat::LogLevel::Error;
case quill::LogLevel::Critical:
return Log::LogLevel::Critical;
return Flat::LogLevel::Critical;
default:
break;
}
return Log::LogLevel::Trace;
return Flat::LogLevel::Trace;
}
Singleton<Log>::Lifetime m_log;
Log m_log;
};
/****************************************************************************************/
TEST_F(LogFixture, RegisterLogger_ShouldRegisterTheLogger)
{
const quill::Logger* logger = Singleton<Log>::Instance().RegisterLogger(UTILSTESTS_LOGGER);
const quill::Logger* logger = m_log.RegisterLogger(SYSTEMTESTS_LOGGER);
EXPECT_TRUE(logger);
EXPECT_EQ(logger, Singleton<Log>::Instance().GetLogger(UTILSTESTS_LOGGER));
EXPECT_EQ(logger->get_logger_name(), UTILSTESTS_LOGGER.m_name);
EXPECT_EQ(QuillLogLevelToLogLevel(logger->get_log_level()), UTILSTESTS_LOGGER.m_level);
EXPECT_EQ(logger, m_log.GetLogger(SYSTEMTESTS_LOGGER));
EXPECT_EQ(logger->get_logger_name(), SYSTEMTESTS_LOGGER.m_name);
EXPECT_EQ(QuillLogLevelToLogLevel(logger->get_log_level()), SYSTEMTESTS_LOGGER.m_level);
}
/****************************************************************************************/
TEST_F(LogFixture, GetLogger_ShouldReturnNullptrIfTheLoggerDoesNotExist)
{
EXPECT_FALSE(Singleton<Log>::Instance().GetLogger(UTILSTESTS_LOGGER));
EXPECT_FALSE(m_log.GetLogger(SYSTEMTESTS_LOGGER));
}
/****************************************************************************************/
@@ -71,60 +73,66 @@ TEST_F(LogFixture, GetLogger_ShouldReturnNullptrIfTheLoggerDoesNotExist)
TEST_F(LogFixture, GetLogger_ShouldReturnTheLoggerIfItExists)
{
[[maybe_unused]]
const quill::Logger* logger = Singleton<Log>::Instance().RegisterLogger(UTILSTESTS_LOGGER);
EXPECT_TRUE(Singleton<Log>::Instance().GetLogger(UTILSTESTS_LOGGER));
const quill::Logger* logger = m_log.RegisterLogger(SYSTEMTESTS_LOGGER);
EXPECT_TRUE(m_log.GetLogger(SYSTEMTESTS_LOGGER));
}
/****************************************************************************************/
TEST_F(LogFixture, ChangeLoggerLogLevel_ShouldChangeTheLoggerLogLevel)
{
const quill::Logger* logger = Singleton<Log>::Instance().RegisterLogger(UTILSTESTS_LOGGER);
const quill::Logger* logger = m_log.RegisterLogger(SYSTEMTESTS_LOGGER);
Singleton<Log>::Instance().ChangeLoggerLogLevel(UTILSTESTS_LOGGER, Log::LogLevel::Critical);
EXPECT_EQ(QuillLogLevelToLogLevel(logger->get_log_level()), Log::LogLevel::Critical);
m_log.ChangeLoggerLogLevel(SYSTEMTESTS_LOGGER, Flat::LogLevel::Critical);
EXPECT_EQ(QuillLogLevelToLogLevel(logger->get_log_level()), Flat::LogLevel::Critical);
}
/****************************************************************************************/
TEST_F(LogFixture, LogDebug)
{
BIGFOOT_LOG_DEBUG(UTILSTESTS_LOGGER, "Hello");
Singleton<Log>::Lifetime singletonLifetime;
BIGFOOT_LOG_DEBUG(SYSTEMTESTS_LOGGER, "Hello");
}
/****************************************************************************************/
TEST_F(LogFixture, LogTrace)
{
BIGFOOT_LOG_TRACE(UTILSTESTS_LOGGER, "Hello");
Singleton<Log>::Lifetime singletonLifetime;
BIGFOOT_LOG_TRACE(SYSTEMTESTS_LOGGER, "Hello");
}
/****************************************************************************************/
TEST_F(LogFixture, LogInfo)
{
BIGFOOT_LOG_INFO(UTILSTESTS_LOGGER, "Hello");
Singleton<Log>::Lifetime singletonLifetime;
BIGFOOT_LOG_INFO(SYSTEMTESTS_LOGGER, "Hello");
}
/****************************************************************************************/
TEST_F(LogFixture, LogWarn)
{
BIGFOOT_LOG_WARN(UTILSTESTS_LOGGER, "Hello");
Singleton<Log>::Lifetime singletonLifetime;
BIGFOOT_LOG_WARN(SYSTEMTESTS_LOGGER, "Hello");
}
/****************************************************************************************/
TEST_F(LogFixture, LogError)
{
BIGFOOT_LOG_ERROR(UTILSTESTS_LOGGER, "Hello");
Singleton<Log>::Lifetime singletonLifetime;
BIGFOOT_LOG_ERROR(SYSTEMTESTS_LOGGER, "Hello");
}
/****************************************************************************************/
TEST_F(LogFixture, LogFatal)
{
BIGFOOT_LOG_FATAL(UTILSTESTS_LOGGER, "Hello");
Singleton<Log>::Lifetime singletonLifetime;
BIGFOOT_LOG_FATAL(SYSTEMTESTS_LOGGER, "Hello");
}
} // namespace Bigfoot
#endif

View File

@@ -0,0 +1,67 @@
/*********************************************************************
* \file Time.cpp
*
* \author Romain BOULLARD
* \date December 2025
*********************************************************************/
#include <System/Time.hpp>
#include <gtest/gtest.h>
namespace Bigfoot
{
class TimeFixture: public ::testing::Test
{
public:
Time m_time {1'767'643'746'680'609};
};
/****************************************************************************************/
TEST_F(TimeFixture, Year_ShouldReturnTheYear)
{
EXPECT_EQ(m_time.Year(), 2026);
}
/****************************************************************************************/
TEST_F(TimeFixture, Month_ShouldReturnTheMonth)
{
EXPECT_EQ(m_time.Month(), 1);
}
/****************************************************************************************/
TEST_F(TimeFixture, Day_ShouldReturnTheDay)
{
EXPECT_EQ(m_time.Day(), 5);
}
/****************************************************************************************/
TEST_F(TimeFixture, Hour_ShouldReturnTheHour)
{
EXPECT_EQ(m_time.Hour(), 20);
}
/****************************************************************************************/
TEST_F(TimeFixture, Minute_ShouldReturnTheMinute)
{
EXPECT_EQ(m_time.Minute(), 9);
}
/****************************************************************************************/
TEST_F(TimeFixture, Second_ShouldReturnTheSecond)
{
EXPECT_EQ(m_time.Second(), 6);
}
/****************************************************************************************/
TEST_F(TimeFixture, Microsecond_ShouldReturnTheMicrosecond)
{
EXPECT_EQ(m_time.Microsecond(), 680'609);
}
} // namespace Bigfoot

View File

@@ -4,7 +4,7 @@
* \author Romain BOULLARD
* \date October 2025
*********************************************************************/
#include <System/UUID.hpp>
#include <System/UUID/UUID.hpp>
#include <ankerl/unordered_dense.h>

View File

@@ -1,9 +1,11 @@
get_filename_component(PackageName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
project(${PackageName}Tests)
set(Dependencies)
bigfoot_create_logger(${PackageName}Tests)
set(BigfootDependencies
Utils)
bigfoot_create_package_tests(
${PackageName}
"")
""
"${BigfootDependencies}")
bigfoot_setup_dependencies("Tests/Bigfoot")

View File

@@ -99,23 +99,4 @@ TEST_F(CasterFixture, ObjectCast)
const Parent& parent = BIGFOOT_OBJECT_CAST(Parent, m_b);
EXPECT_EQ(parent.GetParentValue(), 34);
}
/****************************************************************************************/
TEST_F(CasterFixture, NumericCast)
{
const std::uint32_t a = 128;
const std::uint8_t b = BIGFOOT_NUMERIC_CAST(std::uint8_t, a);
EXPECT_EQ(a, b);
}
/****************************************************************************************/
#ifdef BIGFOOT_NOT_OPTIMIZED
TEST_F(CasterFixture, NumericCast_ShouldAssertIfWeLoseDataDuringTheCast)
{
const std::uint32_t a = 1000;
EXPECT_DEATH(BIGFOOT_NUMERIC_CAST(std::uint8_t, a), "");
}
#endif
} // namespace Bigfoot

View File

@@ -1,21 +0,0 @@
// AUTO-GENERATED DO NOT TOUCH
/*********************************************************************
* \file UtilsTestsLogger.generated.hpp
*
*********************************************************************/
#ifndef BIGFOOT_UTILSTESTSLOGGER_GENERATED_HPP
#define BIGFOOT_UTILSTESTSLOGGER_GENERATED_HPP
#include <Utils/Log.hpp>
#if defined BIGFOOT_NOT_OPTIMIZED
namespace Bigfoot
{
/*
* Logger
*/
inline Log::LoggerInfo UTILSTESTS_LOGGER {"UTILSTESTS_LOGGER", Log::LogLevel::Trace};
}
#endif
#endif