From bbb3211e7544770cae0ca6840dd9bf207e7a0435 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Zbyszy=C5=84ski?= <m.zbyszynski@gold.ac.uk>
Date: Thu, 5 Oct 2017 13:36:34 +0100
Subject: [PATCH] adding test for createNewPhrase() api

---
 .../regression_synth/regression_synth.jucer    |  8 ++++----
 tests/src/test_RapidLib.cpp                    | 18 +++++++-----------
 2 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/examples/JUCE/regression_synth/regression_synth.jucer b/examples/JUCE/regression_synth/regression_synth.jucer
index 2eacc1e..989f6a6 100644
--- a/examples/JUCE/regression_synth/regression_synth.jucer
+++ b/examples/JUCE/regression_synth/regression_synth.jucer
@@ -104,9 +104,9 @@
     <VS2015 targetFolder="Builds/VisualStudio2015">
       <CONFIGURATIONS>
         <CONFIGURATION name="Debug" winWarningLevel="4" generateManifest="1" winArchitecture="32-bit"
-                       isDebug="1" optimisation="1" targetName="RAPID_JUCE" headerPath="../../../../dependencies/Maximilian/"/>
+                       isDebug="1" optimisation="1" targetName="regression_synth" headerPath="../../../../dependencies/Maximilian/"/>
         <CONFIGURATION name="Release" winWarningLevel="4" generateManifest="1" winArchitecture="32-bit"
-                       isDebug="0" optimisation="3" targetName="RAPID_JUCE" headerPath="../../../../dependencies/Maximilian"/>
+                       isDebug="0" optimisation="3" targetName="regression_synth" headerPath="../../../../dependencies/Maximilian"/>
       </CONFIGURATIONS>
       <MODULEPATHS>
         <MODULEPATH id="juce_core" path="../JUCE/modules"/>
@@ -127,9 +127,9 @@
     </VS2015>
     <XCODE_MAC targetFolder="Builds/MacOSX">
       <CONFIGURATIONS>
-        <CONFIGURATION name="Debug" isDebug="1" optimisation="1" targetName="RAPID_JUCE"
+        <CONFIGURATION name="Debug" isDebug="1" optimisation="1" targetName="regression_synth"
                        headerPath="../../../../dependencies/Maximilian"/>
-        <CONFIGURATION name="Release" isDebug="0" optimisation="3" targetName="RAPID_JUCE"
+        <CONFIGURATION name="Release" isDebug="0" optimisation="3" targetName="regression_synth"
                        headerPath="../../../../dependencies/Maximilian"/>
       </CONFIGURATIONS>
       <MODULEPATHS>
diff --git a/tests/src/test_RapidLib.cpp b/tests/src/test_RapidLib.cpp
index 801865c..3af7104 100644
--- a/tests/src/test_RapidLib.cpp
+++ b/tests/src/test_RapidLib.cpp
@@ -22,10 +22,6 @@ SCENARIO("Test NN Regression", "[machineLearning]")
         std::vector<double> output = { 3.0 };
         REQUIRE(myData.recordSingleElement("label", input, output) == 1); //FIXME: Label is stupd here. -MZ
         
-        //testing alternate API
-        auto newPhrase = myData.createNewPhrase("lab1");
-        newPhrase->addElement(input, output);
-        
         input = { 2.0, 44.2 };
         output = { 20.14 };
         REQUIRE(myData.recordSingleElement("label", input, output) == 3);
@@ -128,19 +124,19 @@ SCENARIO("Test DTW classification", "[machineLearning]")
         REQUIRE(myData.addElement(input, output) == 5);
         myData.stopRecording();
         
-        myData.startRecording("setTwo");
+        //alternate API
+        auto setTwo = myData.createNewPhrase("setTwo");
         input = { 1., 4. };
-        myData.addElement(input, output);
+        setTwo->addElement(input, output);
         input = { 2., -3. };
-        myData.addElement(input, output);
+        setTwo->addElement(input, output);
         input = { 1., 5. };
-        myData.addElement(input, output);
+        setTwo->addElement(input, output);
         input = { -2., 1. };
-        myData.addElement(input, output);
-        myData.stopRecording();
+        setTwo->addElement(input, output);
         
         REQUIRE(myDTW.train(myData) == true);
-
+        
         std::vector<std::vector<double> > inputSet1;
         inputSet1.push_back( {1., 4.});
         inputSet1.push_back( {2., -3.});
-- 
GitLab