Compare commits

..

1 commit

Author SHA1 Message Date
dcvz c2106f1ce1 Add toml test 2024-05-14 17:13:57 +02:00
3 changed files with 69032 additions and 0 deletions

View file

@ -91,3 +91,21 @@ target_link_libraries(RSPRecomp fmt rabbitizer)
target_sources(RSPRecomp PRIVATE
${CMAKE_SOURCE_DIR}/RSPRecomp/src/rsp_recomp.cpp)
# TOML Test
include(FetchContent)
FetchContent_Declare(
tomlplusplus
GIT_REPOSITORY https://github.com/marzer/tomlplusplus.git
GIT_TAG v3.4.0
)
FetchContent_MakeAvailable(tomlplusplus)
project(toml_test)
add_executable(toml_test)
target_sources(toml_test PRIVATE ${CMAKE_SOURCE_DIR}/tests/toml_test.cpp)
target_include_directories(toml_test PRIVATE "${CMAKE_SOURCE_DIR}/lib/toml11")
target_link_libraries(toml_test tomlplusplus::tomlplusplus)
file(COPY ${CMAKE_SOURCE_DIR}/tests/test.toml DESTINATION ${CMAKE_BINARY_DIR})

68987
tests/test.toml Normal file

File diff suppressed because it is too large Load diff

27
tests/toml_test.cpp Normal file
View file

@ -0,0 +1,27 @@
#include <cstdio>
#include <iostream>
#define TOML_IMPLEMENTATION
#define TOML_HEADER_ONLY 0
// toml++ header, uncomment to use
#include <toml++/toml.hpp>
// toml11 header, uncomment to use
//#include <toml.hpp>
int main(int argc, char** argv) {
auto time_start = std::chrono::high_resolution_clock::now();
// toml11 parsing
// auto data = toml::parse("test.toml");
// tomlplusplus parsing
auto data = toml::parse_file("test.toml");
std::cout << data << std::endl;
auto time_end = std::chrono::high_resolution_clock::now();
auto time_diff = std::chrono::duration_cast<std::chrono::milliseconds>(time_end - time_start);
printf("Time taken: %lld ms\n", time_diff.count());
return 0;
}