diff --git a/cmake/avendish.tests.cmake b/cmake/avendish.tests.cmake index 3467e20..57314fc 100644 --- a/cmake/avendish.tests.cmake +++ b/cmake/avendish.tests.cmake @@ -44,5 +44,6 @@ if(BUILD_TESTING) avnd_add_executable_test(test_introspection_many tests/test_introspection_many.cpp) avnd_add_catch_test(test_gain tests/objects/gain.cpp) + avnd_add_catch_test(test_patternal tests/objects/patternal.cpp) endif() diff --git a/tests/objects/patternal.cpp b/tests/objects/patternal.cpp new file mode 100644 index 0000000..39ea226 --- /dev/null +++ b/tests/objects/patternal.cpp @@ -0,0 +1,27 @@ +#include + +#include + +// Tests for the Patternal object +TEST_CASE("Test Patternal patterns", "[advanced][patternal]") +{ + SECTION("The input pattern is stored correctly") { + // Instanciate the object: + patternal::Processor patternalProcessor; + + // Create the input pattern: + patternalProcessor.inputs.patterns.value = { + (patternal::Pattern) {42, {127, 127, 127, 127}}, // hi-hat + (patternal::Pattern) {38, {0, 127, 0, 127}}, // snare + (patternal::Pattern) {35, {127, 0, 127, 0}}, // bass drum + }; + + // Check that the input pattern is stored correctly: + REQUIRE(patternalProcessor.inputs.patterns.value[0].note == 42); + REQUIRE(patternalProcessor.inputs.patterns.value[0].pattern[0] == 127); + REQUIRE(patternalProcessor.inputs.patterns.value[1].note == 38); + REQUIRE(patternalProcessor.inputs.patterns.value[1].pattern[0] == 0); + REQUIRE(patternalProcessor.inputs.patterns.value[2].note == 35); + REQUIRE(patternalProcessor.inputs.patterns.value[2].pattern[0] == 127); + } +}