mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 02:22:30 +00:00
chore(log): add test file
This commit is contained in:
parent
96c121717b
commit
786759d49d
1 changed files with 51 additions and 0 deletions
51
test/Log.cpp
Normal file
51
test/Log.cpp
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#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;
|
||||
REQUIRE(SLogCreate("test.log", SLOG_FLAG_DEFAULT, &log) == 1);
|
||||
REQUIRE(log != 0);
|
||||
|
||||
SLogDestroy();
|
||||
}
|
||||
|
||||
SECTION("creates new log file") {
|
||||
SLogInitialize();
|
||||
|
||||
HSLOG log;
|
||||
REQUIRE(SLogCreate("test.log", SLOG_FLAG_OPEN_FILE, &log) == 1);
|
||||
REQUIRE(log != 0);
|
||||
|
||||
SLogDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("SLogWrite", "[log]") {
|
||||
SLogInitialize();
|
||||
|
||||
HSLOG log;
|
||||
REQUIRE(SLogCreate("test.log", SLOG_FLAG_DEFAULT, &log) == 1);
|
||||
REQUIRE(log != 0);
|
||||
|
||||
SLogWrite(log, "SLogWrite Test");
|
||||
|
||||
SLogDestroy();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue