From aa26d4850969ea90c43a8bd975b0480412ca791c Mon Sep 17 00:00:00 2001 From: trinitou Date: Fri, 19 Jan 2024 01:05:35 +0100 Subject: [PATCH] Add instanciation test for clap::helpers::Host --- CMakeLists.txt | 1 + tests/create-an-actual-host.cc | 36 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 tests/create-an-actual-host.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ff468e..671b2e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,7 @@ if (${CLAP_HELPERS_BUILD_TESTS}) endif() add_executable(${PROJECT_NAME}-tests EXCLUDE_FROM_ALL + tests/create-an-actual-host.cc tests/create-an-actual-plugin.cc tests/hex-encoder.cc tests/host.cc diff --git a/tests/create-an-actual-host.cc b/tests/create-an-actual-host.cc new file mode 100644 index 0000000..c11196e --- /dev/null +++ b/tests/create-an-actual-host.cc @@ -0,0 +1,36 @@ +/* + * Actually use host.hh / host.hxx to create a host. Assert that it is constructable + */ + +#include "clap/helpers/host.hh" +#include "clap/helpers/host.hxx" + +#include + +#include + +struct test_host : clap::helpers::Host +{ + test_host() : clap::helpers::Host( + "Test Case Host", + "Free Audio", + "http://cleveraudio.org", + "1.0.0") {} + + bool threadCheckIsMainThread() const noexcept override { return true; }; + bool threadCheckIsAudioThread() const noexcept override { return false; }; + + void requestRestart() noexcept override {}; + void requestProcess() noexcept override {}; + void requestCallback() noexcept override {}; +}; + +CATCH_TEST_CASE("Create an Actual Host") +{ + CATCH_SECTION("Test Host is Creatable") + { + CATCH_REQUIRE(std::is_constructible::value); + } +}