Started to convert from catch2 to fuc2.
This commit is contained in:
parent
4deda37665
commit
b8b42d5681
10 changed files with 615 additions and 493 deletions
|
|
@ -1,28 +1,40 @@
|
|||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <fuc2/testing.hpp>
|
||||
#include "game/config.hpp"
|
||||
#include <iostream>
|
||||
|
||||
TEST_CASE("confirm basic config loader ops", "[config]") {
|
||||
settings::Config::set_base_dir("./");
|
||||
auto config = settings::get("devices");
|
||||
auto data_list = config.json();
|
||||
auto the_keys = config.keys();
|
||||
using namespace fuc2;
|
||||
|
||||
REQUIRE(the_keys.size() > 0);
|
||||
namespace config_tests {
|
||||
void test_confirm_basic_config_loader_ops() {
|
||||
settings::Config::set_base_dir("./");
|
||||
auto config = settings::get("devices");
|
||||
auto data_list = config.json();
|
||||
auto the_keys = config.keys();
|
||||
|
||||
for(auto& [key, data] : data_list.items()) {
|
||||
auto wide1 = config.wstring(key, "name");
|
||||
auto& comps = data["components"];
|
||||
CHECK(the_keys.size() > 0);
|
||||
|
||||
for(auto& comp_data : comps) {
|
||||
REQUIRE(comp_data.contains("_type"));
|
||||
for(auto& [key, data] : data_list.items()) {
|
||||
auto wide1 = config.wstring(key, "name");
|
||||
auto& comps = data["components"];
|
||||
|
||||
for(auto& comp_data : comps) {
|
||||
CHECK(comp_data.contains("_type"));
|
||||
}
|
||||
}
|
||||
|
||||
auto indexed = settings::get("tests/config_test.json");
|
||||
auto& test_0 = indexed[0];
|
||||
CHECK(test_0["test"] == 0);
|
||||
|
||||
auto& test_1 = indexed[1];
|
||||
CHECK(test_1["test"] == 1);
|
||||
}
|
||||
|
||||
auto indexed = settings::get("tests/config_test.json");
|
||||
auto& test_0 = indexed[0];
|
||||
REQUIRE(test_0["test"] == 0);
|
||||
fuc2::Set TESTS{
|
||||
.name="config",
|
||||
.tests={
|
||||
TEST(test_confirm_basic_config_loader_ops),
|
||||
}
|
||||
};
|
||||
|
||||
auto& test_1 = indexed[1];
|
||||
REQUIRE(test_1["test"] == 1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue