Remove unit tests from main branch
This commit is contained in:
parent
2388c57d5e
commit
1d01c7012c
2 changed files with 1 additions and 60 deletions
|
@ -15,7 +15,7 @@ include(FetchContent)
|
||||||
FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git
|
FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git
|
||||||
GIT_TAG 2553fc41450301cd09a9271c8d2c3e0cf3546b73)
|
GIT_TAG 2553fc41450301cd09a9271c8d2c3e0cf3546b73)
|
||||||
FetchContent_MakeAvailable(cpr)
|
FetchContent_MakeAvailable(cpr)
|
||||||
find_package(Boost 1.75 COMPONENTS program_options unit_test_framework REQUIRED)
|
find_package(Boost 1.75 COMPONENTS program_options REQUIRED)
|
||||||
|
|
||||||
set(Boost_USE_STATIC_LIBS ON)
|
set(Boost_USE_STATIC_LIBS ON)
|
||||||
|
|
||||||
|
@ -52,20 +52,10 @@ add_executable(endgame-analyzer
|
||||||
${SOURCES}
|
${SOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(unit-tests
|
|
||||||
test/unit_test.cpp
|
|
||||||
${SOURCES}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(endgame-analyzer cpr)
|
target_link_libraries(endgame-analyzer cpr)
|
||||||
target_link_libraries(endgame-analyzer Boost::program_options)
|
target_link_libraries(endgame-analyzer Boost::program_options)
|
||||||
target_link_libraries(endgame-analyzer readline)
|
target_link_libraries(endgame-analyzer readline)
|
||||||
|
|
||||||
target_link_libraries(unit-tests cpr)
|
|
||||||
target_link_libraries(unit-tests Boost::program_options)
|
|
||||||
target_link_libraries(unit-tests readline)
|
|
||||||
target_link_libraries(unit-tests ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
|
||||||
|
|
||||||
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG")
|
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG")
|
||||||
# This enables assertions in the RelWithDebInfo build type (assuming gcc or clang)
|
# This enables assertions in the RelWithDebInfo build type (assuming gcc or clang)
|
||||||
string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
#define BOOST_TEST_MAIN
|
|
||||||
|
|
||||||
#include <boost/test/unit_test.hpp>
|
|
||||||
#include <boost/json.hpp>
|
|
||||||
|
|
||||||
#include "game_state.h"
|
|
||||||
#include "parse_game.h"
|
|
||||||
|
|
||||||
using namespace Hanabi;
|
|
||||||
|
|
||||||
std::string const game_json_str = R"({"id":1058099,"players":["NoVarkusKahlsen","RamaNoVarjan","PurpleJoeVar"],"deck":[{"suitIndex":3,"rank":5},{"suitIndex":2,"rank":2},{"suitIndex":4,"rank":5},{"suitIndex":3,"rank":1},{"suitIndex":1,"rank":3},{"suitIndex":2,"rank":1},{"suitIndex":1,"rank":2},{"suitIndex":4,"rank":2},{"suitIndex":2,"rank":3},{"suitIndex":2,"rank":5},{"suitIndex":4,"rank":1},{"suitIndex":3,"rank":1},{"suitIndex":0,"rank":3},{"suitIndex":4,"rank":1},{"suitIndex":3,"rank":4},{"suitIndex":4,"rank":1},{"suitIndex":0,"rank":4},{"suitIndex":4,"rank":4},{"suitIndex":3,"rank":1},{"suitIndex":0,"rank":3},{"suitIndex":0,"rank":1},{"suitIndex":2,"rank":1},{"suitIndex":2,"rank":1},{"suitIndex":3,"rank":3},{"suitIndex":1,"rank":1},{"suitIndex":3,"rank":2},{"suitIndex":1,"rank":4},{"suitIndex":1,"rank":4},{"suitIndex":3,"rank":2},{"suitIndex":0,"rank":4},{"suitIndex":0,"rank":2},{"suitIndex":0,"rank":1},{"suitIndex":0,"rank":2},{"suitIndex":4,"rank":2},{"suitIndex":2,"rank":4},{"suitIndex":1,"rank":1},{"suitIndex":1,"rank":3},{"suitIndex":3,"rank":4},{"suitIndex":2,"rank":2},{"suitIndex":4,"rank":4},{"suitIndex":2,"rank":4},{"suitIndex":2,"rank":3},{"suitIndex":1,"rank":2},{"suitIndex":1,"rank":1},{"suitIndex":0,"rank":5},{"suitIndex":1,"rank":5},{"suitIndex":0,"rank":1},{"suitIndex":3,"rank":3},{"suitIndex":4,"rank":3},{"suitIndex":4,"rank":3}],"actions":[{"type":2,"target":1,"value":2},{"type":0,"target":5,"value":0},{"type":2,"target":0,"value":2},{"type":2,"target":2,"value":0},{"type":0,"target":15,"value":0},{"type":3,"target":1,"value":2},{"type":2,"target":1,"value":4},{"type":3,"target":0,"value":5},{"type":1,"target":10,"value":0},{"type":0,"target":1,"value":0},{"type":2,"target":2,"value":3},{"type":3,"target":1,"value":3},{"type":1,"target":3,"value":0},{"type":0,"target":7,"value":0},{"type":2,"target":0,"value":3},{"type":3,"target":2,"value":4},{"type":0,"target":20,"value":0},{"type":1,"target":11,"value":0},{"type":0,"target":18,"value":0},{"type":3,"target":2,"value":1},{"type":1,"target":13,"value":0},{"type":0,"target":23,"value":0},{"type":2,"target":2,"value":3},{"type":0,"target":24,"value":0},{"type":0,"target":25,"value":0},{"type":0,"target":8,"value":0},{"type":1,"target":22,"value":0},{"type":0,"target":27,"value":0},{"type":1,"target":21,"value":0},{"type":2,"target":0,"value":0},{"type":0,"target":30,"value":0},{"type":0,"target":6,"value":0},{"type":3,"target":0,"value":3},{"type":0,"target":4,"value":0},{"type":1,"target":28,"value":0},{"type":3,"target":1,"value":5},{"type":0,"target":34,"value":0},{"type":0,"target":9,"value":0},{"type":0,"target":12,"value":0},{"type":2,"target":2,"value":1},{"type":1,"target":31,"value":0},{"type":0,"target":26,"value":0},{"type":1,"target":19,"value":0},{"type":1,"target":33,"value":0},{"type":2,"target":1,"value":0},{"type":1,"target":32,"value":0},{"type":0,"target":16,"value":0},{"type":2,"target":1,"value":0},{"type":3,"target":1,"value":5},{"type":0,"target":44,"value":0},{"type":3,"target":1,"value":5},{"type":1,"target":36,"value":0},{"type":0,"target":45,"value":0},{"type":3,"target":1,"value":3},{"type":3,"target":1,"value":3},{"type":0,"target":47,"value":0},{"type":0,"target":14,"value":0},{"type":0,"target":0,"value":0},{"type":0,"target":48,"value":0},{"type":0,"target":17,"value":0}],"seed":"p3v0s23"})";
|
|
||||||
boost::json::value const game_json = boost::json::parse(game_json_str);
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE(parsing)
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(parse_deck)
|
|
||||||
{
|
|
||||||
BOOST_CHECK_NO_THROW(auto deck = Parsing::parse_deck(game_json.at("deck")));
|
|
||||||
auto const [deck, num_suits] = Parsing::parse_deck(game_json.at("deck"));
|
|
||||||
BOOST_CHECK_EQUAL(num_suits, 5);
|
|
||||||
BOOST_REQUIRE_EQUAL(deck.size(), 50);
|
|
||||||
BOOST_CHECK_EQUAL(deck[0], Cards::b5);
|
|
||||||
BOOST_CHECK_EQUAL(deck[1], Cards::g2);
|
|
||||||
BOOST_CHECK_EQUAL(deck[2], Cards::p5);
|
|
||||||
BOOST_CHECK_EQUAL(deck[3], Cards::b1);
|
|
||||||
BOOST_CHECK_EQUAL(deck[4], Cards::y3);
|
|
||||||
BOOST_CHECK_EQUAL(deck[5], Cards::g1);
|
|
||||||
BOOST_CHECK_EQUAL(deck[6], Cards::y2);
|
|
||||||
BOOST_CHECK_EQUAL(deck[7], Cards::p2);
|
|
||||||
BOOST_CHECK_EQUAL(deck[8], Cards::g3);
|
|
||||||
BOOST_CHECK_EQUAL(deck[9], Cards::g5);
|
|
||||||
BOOST_CHECK_EQUAL(deck[10], Cards::p1);
|
|
||||||
BOOST_CHECK_EQUAL(deck[11], Cards::b1);
|
|
||||||
BOOST_CHECK_EQUAL(deck[12], Cards::r3);
|
|
||||||
BOOST_CHECK_EQUAL(deck[13], Cards::p1);
|
|
||||||
BOOST_CHECK_EQUAL(deck[14], Cards::b4);
|
|
||||||
}
|
|
||||||
BOOST_AUTO_TEST_CASE(parse_actions)
|
|
||||||
{
|
|
||||||
BOOST_CHECK_NO_THROW(auto actions = Parsing::parse_actions(game_json.at("actions")));
|
|
||||||
std::vector<Parsing::HanabLiveAction> actions = Parsing::parse_actions(game_json.at("actions"));
|
|
||||||
BOOST_CHECK_EQUAL(actions[0].type, ActionType::color_clue);
|
|
||||||
}
|
|
||||||
BOOST_AUTO_TEST_CASE(parse_game)
|
|
||||||
{
|
|
||||||
BOOST_CHECK_NO_THROW(auto game = Parsing::parse_game(game_json.as_object()));
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
|
Loading…
Reference in a new issue