add_executable(brq_handoff_tests tests.cpp)
target_link_libraries(brq_handoff_tests PRIVATE TwoBufQueue)
brq_warnings(brq_handoff_tests)
if(MSVC)
  target_compile_options(brq_handoff_tests PRIVATE /UNDEBUG)
else()
  target_compile_options(brq_handoff_tests PRIVATE -UNDEBUG)
endif()
foreach(case sync limits errors tickets manual retry wake config reentrant foreign stop_callback sync_concurrent sync_stress
    spsc_poll spsc_wait mpsc_poll mpsc_wait spmc_poll spmc_wait mpmc_poll mpmc_wait
    keep_sync_stress keep_sync_concurrent keep_retry keep_wake
    keep_spsc_poll keep_spsc_wait keep_mpsc_poll keep_mpsc_wait keep_spmc_poll keep_spmc_wait keep_mpmc_poll keep_mpmc_wait)
  add_test(NAME handoff_queue_${case} COMMAND brq_handoff_tests ${case})
  set_tests_properties(handoff_queue_${case} PROPERTIES TIMEOUT 30 LABELS "functional;handoff_queue")
endforeach()

add_executable(brq_cancel_modes cancel_modes.cpp)
target_link_libraries(brq_cancel_modes PRIVATE TwoBufQueue)
brq_warnings(brq_cancel_modes)
if(MSVC)
  target_compile_options(brq_cancel_modes PRIVATE /UNDEBUG)
else()
  target_compile_options(brq_cancel_modes PRIVATE -UNDEBUG)
endif()
foreach(case order receive stale parallel first_order race sync config two_buf)
  add_test(NAME handoff_queue_cancel_${case} COMMAND brq_cancel_modes ${case})
  set_tests_properties(handoff_queue_cancel_${case} PROPERTIES TIMEOUT 30 LABELS "functional;handoff_queue")
endforeach()

add_executable(brq_lock_free_queue lock_free_queue.cpp)
target_link_libraries(brq_lock_free_queue PRIVATE TwoBufQueue)
brq_warnings(brq_lock_free_queue)
if(MSVC)
  target_compile_options(brq_lock_free_queue PRIVATE /UNDEBUG)
else()
  target_compile_options(brq_lock_free_queue PRIVATE -UNDEBUG)
endif()
add_test(NAME handoff_queue_lock_free_queue COMMAND brq_lock_free_queue)
set_tests_properties(handoff_queue_lock_free_queue PROPERTIES TIMEOUT 120 LABELS "functional;handoff_queue")

foreach(component queue reader)
  add_executable(brq_standalone_${component} standalone_${component}.cpp)
  target_link_libraries(brq_standalone_${component} PRIVATE TwoBufQueue)
  brq_warnings(brq_standalone_${component})
  if(MSVC)
    target_compile_options(brq_standalone_${component} PRIVATE /UNDEBUG)
  else()
    target_compile_options(brq_standalone_${component} PRIVATE -UNDEBUG)
  endif()
  add_test(NAME handoff_queue_standalone_${component} COMMAND brq_standalone_${component})
  set_tests_properties(handoff_queue_standalone_${component} PROPERTIES TIMEOUT 15 LABELS "functional;handoff_queue")
endforeach()

add_executable(brq_nonintrusive nonintrusive.cpp)
target_link_libraries(brq_nonintrusive PRIVATE TwoBufQueue)
brq_warnings(brq_nonintrusive)
if(MSVC)
  target_compile_options(brq_nonintrusive PRIVATE /UNDEBUG)
else()
  target_compile_options(brq_nonintrusive PRIVATE -UNDEBUG)
endif()
add_test(NAME handoff_queue_nonintrusive COMMAND brq_nonintrusive)
set_tests_properties(handoff_queue_nonintrusive PROPERTIES TIMEOUT 30 LABELS "functional;handoff_queue;warm_pool")

