# Standalone turn-driver tests.
#
# test_catalog needs nothing but the catalog and always runs.
# test_turn reads the owner's saves via SOTS_SAVES_DIR at run time and skips cleanly when it
# is unset -- no .sav ever enters this repo.
add_executable(app_test_catalog test_catalog.cpp)
target_link_libraries(app_test_catalog PRIVATE sots_app)
add_test(NAME app_catalog COMMAND app_test_catalog)

add_executable(app_test_turn test_turn.cpp)
target_link_libraries(app_test_turn PRIVATE sots_app)
add_test(NAME app_turn COMMAND app_test_turn)

# The trade-raid word count is pinned against a scripted generator, so it always runs.
add_executable(app_test_trade_raid test_trade_raid.cpp)
target_link_libraries(app_test_trade_raid PRIVATE sots_app)
add_test(NAME app_trade_raid COMMAND app_test_trade_raid)

# The alliance mask, as a rule. Pins the three things the corpus cannot separate -- the bit
# index, the OR, and the guard -- so it always runs.
add_executable(app_test_alliance test_alliance.cpp)
target_link_libraries(app_test_alliance PRIVATE sots_app)
add_test(NAME app_alliance COMMAND app_test_alliance)

# The treaty-turn stamp, as a rule. Pins the five things the corpus cannot separate -- the
# relation codes, the bit's source, the missing alliance-id guard, the -1 initialiser and the
# append order -- so it always runs.
add_executable(app_test_treaty test_treaty.cpp)
target_link_libraries(app_test_treaty PRIVATE sots_app)
add_test(NAME app_treaty COMMAND app_test_treaty)

# The turn-record model against the record the game itself archived; needs the owner's saves.
add_executable(app_test_turn_record test_turn_record.cpp)
target_link_libraries(app_test_turn_record PRIVATE sots_app)
add_test(NAME app_turn_record COMMAND app_test_turn_record)

foreach(_t app_test_catalog app_test_turn app_test_trade_raid app_test_alliance
         app_test_treaty app_test_turn_record)
  target_include_directories(${_t} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
  target_compile_options(${_t} PRIVATE -Wall -Wextra -Wpedantic)
endforeach()
