-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for clap::helpers::Host #50
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <type_traits> | ||
|
||
#include <catch2/catch_all.hpp> | ||
|
||
struct test_host : clap::helpers::Host<clap::helpers::MisbehaviourHandler::Terminate, | ||
clap::helpers::CheckingLevel::Maximal> | ||
{ | ||
test_host() : clap::helpers::Host<clap::helpers::MisbehaviourHandler::Terminate, | ||
clap::helpers::CheckingLevel::Maximal>( | ||
"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<test_host>::value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <clap/helpers/plugin-proxy.hxx> | ||
#include <clap/helpers/host.hh> | ||
#include <clap/helpers/host.hxx> | ||
|
||
#include <catch2/catch_all.hpp> | ||
|
||
template class clap::helpers::Host<clap::helpers::MisbehaviourHandler::Terminate, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we want to use a macros to expand all the combinations? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good idea, maybe in a later PR? |
||
clap::helpers::CheckingLevel::Maximal>; | ||
template class clap::helpers::Host<clap::helpers::MisbehaviourHandler::Terminate, | ||
clap::helpers::CheckingLevel::Minimal>; | ||
template class clap::helpers::Host<clap::helpers::MisbehaviourHandler::Terminate, | ||
clap::helpers::CheckingLevel::None>; | ||
template class clap::helpers::Host<clap::helpers::MisbehaviourHandler::Ignore, | ||
clap::helpers::CheckingLevel::Maximal>; | ||
|
||
template class clap::helpers::PluginProxy<clap::helpers::MisbehaviourHandler::Terminate, | ||
clap::helpers::CheckingLevel::Maximal>; | ||
template class clap::helpers::PluginProxy<clap::helpers::MisbehaviourHandler::Terminate, | ||
clap::helpers::CheckingLevel::Minimal>; | ||
template class clap::helpers::PluginProxy<clap::helpers::MisbehaviourHandler::Terminate, | ||
clap::helpers::CheckingLevel::None>; | ||
template class clap::helpers::PluginProxy<clap::helpers::MisbehaviourHandler::Ignore, | ||
clap::helpers::CheckingLevel::Maximal>; | ||
|
||
CATCH_TEST_CASE("Host - Link") { | ||
clap::helpers::Host<clap::helpers::MisbehaviourHandler::Terminate, | ||
clap::helpers::CheckingLevel::Maximal> *h0 = nullptr; | ||
clap::helpers::Host<clap::helpers::MisbehaviourHandler::Terminate, | ||
clap::helpers::CheckingLevel::Minimal> *h1 = nullptr; | ||
clap::helpers::Host<clap::helpers::MisbehaviourHandler::Terminate, | ||
clap::helpers::CheckingLevel::None> *h2 = nullptr; | ||
clap::helpers::Host<clap::helpers::MisbehaviourHandler::Ignore, | ||
clap::helpers::CheckingLevel::Maximal> *h3 = nullptr; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ouch, maybe it is time to require C++17? ;-)
It is 2024 so it is already 7 years old.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I would be fine with that
Maybe @baconpaul can tell? My original idea was to use
clap::helpers::Host
for clap-wrapper as well. So it should meet the requirements there, too. I think somewhere I read that they wrote something like "c++17 min" but just want to ensure that it would be OK.The CMakeLists.txt defaulted to 11 before we started upgrading it recently and still does I think. So I guess we would have to change it there as well (?)
(edit: I justed looked it up: at least the
clap-helpers-tests
default to 11 so that it looks like it is the minimum.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok just removed the CLAP_IF_CONSTEXPR
We can solve the rest (c++11 etc) later