simple regex and test

This commit is contained in:
2024-06-10 21:37:31 +02:00
parent bf91297e83
commit 3792fe5b1e
9 changed files with 83 additions and 1 deletions

16
test/CMakeLists.txt Normal file
View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.9...3.24 FATAL_ERROR)
project(solanaceae)
add_executable(solanaceae_factorio_test1
./test1.cpp
)
target_compile_features(solanaceae_factorio_test1 PUBLIC cxx_std_17)
target_link_libraries(solanaceae_factorio_test1 PUBLIC
solanaceae_factorio
)
add_test(NAME solanaceae_factorio_test1 COMMAND solanaceae_factorio_test1)
########################################

21
test/test1.cpp Normal file
View File

@ -0,0 +1,21 @@
#include "log_parse.hpp"
#include <cassert>
int main(void) {
{
const auto parse_res = log_parse_line(" 442.539 Script @__Factorio-Event-Logger__/logger.lua:65: [RESEARCH CANCELLED] worker-robots-speed");
assert(parse_res.has_value());
assert(parse_res.value().event == "RESEARCH CANCELLED");
assert(parse_res.value().info == "worker-robots-speed");
}
{
const auto parse_res = log_parse_line(" 224.089 Info ServerMultiplayerManager.cpp:944: updateTick(38228812) received stateChanged peerID(2) oldState(ConnectedLoadingMap) newState(TryingToCatchUp)");
assert(!parse_res.has_value());
}
return 0;
}