From 5e6584a51a61b2613788fbed65f2d7e8e9b382a0 Mon Sep 17 00:00:00 2001 From: Paul Fd Date: Mon, 6 Apr 2020 19:41:10 +0200 Subject: [PATCH] Basic parsing tests --- tests/RegionT.cpp | 108 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/tests/RegionT.cpp b/tests/RegionT.cpp index b98f9f51..31e58fcd 100644 --- a/tests/RegionT.cpp +++ b/tests/RegionT.cpp @@ -471,6 +471,24 @@ TEST_CASE("[Region] Parsing opcodes") region.parseOpcode({ "pan_oncc45", "4.2" }); REQUIRE(region.panCC.contains(45)); REQUIRE(region.panCC[45].value == 0.042_a); + region.parseOpcode({ "pan_curvecc17", "18" }); + REQUIRE(region.panCC[17].curve == 18); + region.parseOpcode({ "pan_curvecc17", "15482" }); + REQUIRE(region.panCC[17].curve == 255); + region.parseOpcode({ "pan_curvecc17", "-2" }); + REQUIRE(region.panCC[17].curve == 0); + region.parseOpcode({ "pan_smoothcc14", "85" }); + REQUIRE(region.panCC[14].smooth == 85); + region.parseOpcode({ "pan_smoothcc14", "15482" }); + REQUIRE(region.panCC[14].smooth == 127); + region.parseOpcode({ "pan_smoothcc14", "-2" }); + REQUIRE(region.panCC[14].smooth == 0); + region.parseOpcode({ "pan_stepcc120", "24" }); + REQUIRE(region.panCC[120].steps == 24); + region.parseOpcode({ "pan_stepcc120", "15482" }); + REQUIRE(region.panCC[120].steps == 127); + region.parseOpcode({ "pan_stepcc120", "-2" }); + REQUIRE(region.panCC[120].steps == 0); } SECTION("width") @@ -492,6 +510,24 @@ TEST_CASE("[Region] Parsing opcodes") region.parseOpcode({ "width_oncc45", "4.2" }); REQUIRE(region.widthCC.contains(45)); REQUIRE(region.widthCC[45].value == 0.042_a); + region.parseOpcode({ "width_curvecc17", "18" }); + REQUIRE(region.widthCC[17].curve == 18); + region.parseOpcode({ "width_curvecc17", "15482" }); + REQUIRE(region.widthCC[17].curve == 255); + region.parseOpcode({ "width_curvecc17", "-2" }); + REQUIRE(region.widthCC[17].curve == 0); + region.parseOpcode({ "width_smoothcc14", "85" }); + REQUIRE(region.widthCC[14].smooth == 85); + region.parseOpcode({ "width_smoothcc14", "15482" }); + REQUIRE(region.widthCC[14].smooth == 127); + region.parseOpcode({ "width_smoothcc14", "-2" }); + REQUIRE(region.widthCC[14].smooth == 0); + region.parseOpcode({ "width_stepcc120", "24" }); + REQUIRE(region.widthCC[120].steps == 24); + region.parseOpcode({ "width_stepcc120", "15482" }); + REQUIRE(region.widthCC[120].steps == 127); + region.parseOpcode({ "width_stepcc120", "-2" }); + REQUIRE(region.widthCC[120].steps == 0); } SECTION("position") @@ -513,6 +549,24 @@ TEST_CASE("[Region] Parsing opcodes") region.parseOpcode({ "position_oncc45", "4.2" }); REQUIRE(region.positionCC.contains(45)); REQUIRE(region.positionCC[45].value == 0.042_a); + region.parseOpcode({ "position_curvecc17", "18" }); + REQUIRE(region.positionCC[17].curve == 18); + region.parseOpcode({ "position_curvecc17", "15482" }); + REQUIRE(region.positionCC[17].curve == 255); + region.parseOpcode({ "position_curvecc17", "-2" }); + REQUIRE(region.positionCC[17].curve == 0); + region.parseOpcode({ "position_smoothcc14", "85" }); + REQUIRE(region.positionCC[14].smooth == 85); + region.parseOpcode({ "position_smoothcc14", "15482" }); + REQUIRE(region.positionCC[14].smooth == 127); + region.parseOpcode({ "position_smoothcc14", "-2" }); + REQUIRE(region.positionCC[14].smooth == 0); + region.parseOpcode({ "position_stepcc120", "24" }); + REQUIRE(region.positionCC[120].steps == 24); + region.parseOpcode({ "position_stepcc120", "15482" }); + REQUIRE(region.positionCC[120].steps == 127); + region.parseOpcode({ "position_stepcc120", "-2" }); + REQUIRE(region.positionCC[120].steps == 0); } SECTION("amp_keycenter") @@ -1452,6 +1506,24 @@ TEST_CASE("[Region] Parsing opcodes") region.parseOpcode({ "amplitude_oncc2", "30" }); REQUIRE(region.amplitudeCC.contains(2)); REQUIRE(region.amplitudeCC[2].value == 0.30_a); + region.parseOpcode({ "amplitude_curvecc17", "18" }); + REQUIRE(region.amplitudeCC[17].curve == 18); + region.parseOpcode({ "amplitude_curvecc17", "15482" }); + REQUIRE(region.amplitudeCC[17].curve == 255); + region.parseOpcode({ "amplitude_curvecc17", "-2" }); + REQUIRE(region.amplitudeCC[17].curve == 0); + region.parseOpcode({ "amplitude_smoothcc14", "85" }); + REQUIRE(region.amplitudeCC[14].smooth == 85); + region.parseOpcode({ "amplitude_smoothcc14", "15482" }); + REQUIRE(region.amplitudeCC[14].smooth == 127); + region.parseOpcode({ "amplitude_smoothcc14", "-2" }); + REQUIRE(region.amplitudeCC[14].smooth == 0); + region.parseOpcode({ "amplitude_stepcc120", "24" }); + REQUIRE(region.amplitudeCC[120].steps == 24); + region.parseOpcode({ "amplitude_stepcc120", "15482" }); + REQUIRE(region.amplitudeCC[120].steps == 127); + region.parseOpcode({ "amplitude_stepcc120", "-2" }); + REQUIRE(region.amplitudeCC[120].steps == 0); } SECTION("volume_oncc/gain_cc") @@ -1466,6 +1538,24 @@ TEST_CASE("[Region] Parsing opcodes") region.parseOpcode({ "gain_oncc4", "-1" }); REQUIRE(region.volumeCC.contains(4)); REQUIRE(region.volumeCC[4].value == -1.0_a); + region.parseOpcode({ "volume_curvecc17", "18" }); + REQUIRE(region.volumeCC[17].curve == 18); + region.parseOpcode({ "volume_curvecc17", "15482" }); + REQUIRE(region.volumeCC[17].curve == 255); + region.parseOpcode({ "volume_curvecc17", "-2" }); + REQUIRE(region.volumeCC[17].curve == 0); + region.parseOpcode({ "volume_smoothcc14", "85" }); + REQUIRE(region.volumeCC[14].smooth == 85); + region.parseOpcode({ "volume_smoothcc14", "15482" }); + REQUIRE(region.volumeCC[14].smooth == 127); + region.parseOpcode({ "volume_smoothcc14", "-2" }); + REQUIRE(region.volumeCC[14].smooth == 0); + region.parseOpcode({ "volume_stepcc120", "24" }); + REQUIRE(region.volumeCC[120].steps == 24); + region.parseOpcode({ "volume_stepcc120", "15482" }); + REQUIRE(region.volumeCC[120].steps == 127); + region.parseOpcode({ "volume_stepcc120", "-2" }); + REQUIRE(region.volumeCC[120].steps == 0); } SECTION("tune_cc/pitch_cc") @@ -1480,6 +1570,24 @@ TEST_CASE("[Region] Parsing opcodes") region.parseOpcode({ "pitch_oncc4", "-1" }); REQUIRE(region.tuneCC.contains(4)); REQUIRE(region.tuneCC[4].value == -1.0); + region.parseOpcode({ "tune_curvecc17", "18" }); + REQUIRE(region.tuneCC[17].curve == 18); + region.parseOpcode({ "pitch_curvecc17", "15482" }); + REQUIRE(region.tuneCC[17].curve == 255); + region.parseOpcode({ "tune_curvecc17", "-2" }); + REQUIRE(region.tuneCC[17].curve == 0); + region.parseOpcode({ "pitch_smoothcc14", "85" }); + REQUIRE(region.tuneCC[14].smooth == 85); + region.parseOpcode({ "tune_smoothcc14", "15482" }); + REQUIRE(region.tuneCC[14].smooth == 127); + region.parseOpcode({ "pitch_smoothcc14", "-2" }); + REQUIRE(region.tuneCC[14].smooth == 0); + region.parseOpcode({ "tune_stepcc120", "24" }); + REQUIRE(region.tuneCC[120].steps == 24); + region.parseOpcode({ "pitch_stepcc120", "15482" }); + REQUIRE(region.tuneCC[120].steps == 127); + region.parseOpcode({ "tune_stepcc120", "-2" }); + REQUIRE(region.tuneCC[120].steps == 0); } }