# A parcel locker's drop-off feature, tested at four levels: unit tests
# for the rules, one contract test run against both stores, acceptance
# tests for the service with test doubles, and an integration test with
# the real file store across a restart. Each level has its own ctest
# label, so `ctest -L unit` runs only the fastest tests.
add_library(tst_lockers STATIC lockers.cpp store.cpp service.cpp)
target_include_directories(tst_lockers PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

lld_add_example(tst_lockers_demo SOURCES main.cpp EXPECTED_OUTPUT expected_output.txt)
target_link_libraries(tst_lockers_demo PRIVATE tst_lockers)

lld_add_test(tst_lockers_unit_tests SOURCES tests/test_rules.cpp LABELS unit)
target_link_libraries(tst_lockers_unit_tests PRIVATE tst_lockers)

lld_add_test(tst_lockers_memory_store_tests SOURCES tests/test_memory_store.cpp LABELS contract)
target_link_libraries(tst_lockers_memory_store_tests PRIVATE tst_lockers)

lld_add_test(tst_lockers_file_store_tests
  SOURCES tests/test_file_store.cpp LABELS "contract;integration")
target_link_libraries(tst_lockers_file_store_tests PRIVATE tst_lockers)

lld_add_test(tst_lockers_acceptance_tests SOURCES tests/test_acceptance.cpp LABELS acceptance)
target_link_libraries(tst_lockers_acceptance_tests PRIVATE tst_lockers)

lld_add_test(tst_lockers_integration_tests SOURCES tests/test_restart.cpp LABELS integration)
target_link_libraries(tst_lockers_integration_tests PRIVATE tst_lockers)
