Files
reflect-cpp/tests
Dr. Patrick Urbanke (劉自成) d73d98f1c8 Change back to tomlplusplus (#401)
For a long time, tomlplusplus did generate a config.cmake file, which made it difficult to use on vcpkg. As a fix, we switched to toml11.

But this has now finally been added to vcpkg, and since tomlplusplus is faster than toml11 in terms of compile time and runtime, we are changing back.
2025-04-08 13:59:24 +08:00
..
2025-02-03 19:27:10 +01:00
2025-02-03 19:27:10 +01:00
2025-02-03 19:27:10 +01:00
2025-04-08 13:59:24 +08:00
2025-02-03 19:27:10 +01:00

Compiling and running the tests

reflect-cpp uses vcpkg for dependency management, including gtest, which is required for the tests.

# bootstrap vcpkg if you haven't done so already 
git submodule update --init
./vcpkg/bootstrap-vcpkg.sh # Linux, macOS
./vcpkg/bootstrap-vcpkg.bat # Windows
# You may be prompted to install additional dependencies.

JSON only

To compile the tests, do the following:

cmake -S . -B build -DCMAKE_CXX_STANDARD=20 -DCMAKE_BUILD_TYPE=Release -DREFLECTCPP_BUILD_TESTS=ON
cmake --build build -j 4 # gcc, clang
cmake --build build --config Release -j 4 # MSVC

To run the tests, do the following:

./build/tests/json/reflect-cpp-json-tests

All serialization formats

To compile the tests with serialization formats other than JSON, do the following:

cmake -S . -B build -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_AVRO=ON -DREFLECTCPP_BSON=ON -DREFLECTCPP_CAPNPROTO=ON -DREFLECTCPP_CBOR=ON -DREFLECTCPP_FLEXBUFFERS=ON -DREFLECTCPP_MSGPACK=ON -DREFLECTCPP_XML=ON -DREFLECTCPP_TOML=ON -DREFLECTCPP_UBJSON=ON -DREFLECTCPP_YAML=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build -j 4 # gcc, clang
cmake --build build --config Release -j 4 # MSVC

To run the tests, do the following:

./build/tests/avro/reflect-cpp-avro-tests
./build/tests/bson/reflect-cpp-bson-tests
./build/tests/capnproto/reflect-cpp-capnproto-tests
./build/tests/cbor/reflect-cpp-cbor-tests
./build/tests/flexbuffers/reflect-cpp-flexbuffers-tests
./build/tests/msgpack/reflect-cpp-msgpack-tests
./build/tests/json/reflect-cpp-json-tests
./build/tests/toml/reflect-cpp-toml-tests
./build/tests/ubjson/reflect-cpp-ubjson-tests
./build/tests/xml/reflect-cpp-xml-tests
./build/tests/yaml/reflect-cpp-yaml-tests