2024-02-20 00:38:40 +04:00
|
|
|
#include "storm/Log.hpp"
|
|
|
|
|
#include "test/Test.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TEST_CASE("SLogInitialize", "[log]") {
|
|
|
|
|
SECTION("constructs correctly") {
|
|
|
|
|
SLogInitialize();
|
|
|
|
|
REQUIRE(SLogIsInitialized() == 1);
|
|
|
|
|
SLogDestroy();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SECTION("destructs correctly") {
|
|
|
|
|
SLogInitialize();
|
|
|
|
|
SLogDestroy();
|
|
|
|
|
REQUIRE(SLogIsInitialized() == 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_CASE("SLogCreate", "[log]") {
|
|
|
|
|
SECTION("creates new log handle") {
|
|
|
|
|
SLogInitialize();
|
|
|
|
|
|
|
|
|
|
HSLOG log;
|
2024-09-07 12:28:28 -04:00
|
|
|
REQUIRE(SLogCreate("test.log", STORM_LOG_FLAG_DEFAULT, &log) == 1);
|
2024-02-20 00:38:40 +04:00
|
|
|
REQUIRE(log != 0);
|
|
|
|
|
|
|
|
|
|
SLogDestroy();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SECTION("creates new log file") {
|
|
|
|
|
SLogInitialize();
|
|
|
|
|
|
|
|
|
|
HSLOG log;
|
2024-09-07 12:28:28 -04:00
|
|
|
REQUIRE(SLogCreate("test.log", STORM_LOG_FLAG_OPEN_FILE, &log) == 1);
|
2024-02-20 00:38:40 +04:00
|
|
|
REQUIRE(log != 0);
|
|
|
|
|
|
|
|
|
|
SLogDestroy();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_CASE("SLogWrite", "[log]") {
|
|
|
|
|
SLogInitialize();
|
|
|
|
|
|
|
|
|
|
HSLOG log;
|
2024-09-07 12:28:28 -04:00
|
|
|
REQUIRE(SLogCreate("test.log", STORM_LOG_FLAG_DEFAULT, &log) == 1);
|
2024-02-20 00:38:40 +04:00
|
|
|
REQUIRE(log != 0);
|
|
|
|
|
|
|
|
|
|
SLogWrite(log, "SLogWrite Test");
|
|
|
|
|
|
|
|
|
|
SLogDestroy();
|
|
|
|
|
}
|