diff unit-tests/BTrack Tests/tests/Test_BTrack.cpp @ 20:baf35f208814 develop

Replaced switch statements in OnsetDetectionFunction with enums. Renamed lots of functions so that they have better names, in camel case. Added some unit tests for initialisation of BTrack.
author Adam <adamstark.uk@gmail.com>
date Thu, 23 Jan 2014 15:31:11 +0000
parents 88c8d3862eee
children
line wrap: on
line diff
--- a/unit-tests/BTrack Tests/tests/Test_BTrack.cpp	Thu Jan 23 12:17:06 2014 +0000
+++ b/unit-tests/BTrack Tests/tests/Test_BTrack.cpp	Thu Jan 23 15:31:11 2014 +0000
@@ -8,6 +8,40 @@
 #include "../../../src/BTrack.h"
 
 //======================================================================
+//==================== CHECKING INITIALISATION =========================
+//======================================================================
+BOOST_AUTO_TEST_SUITE(checkingInitialisation)
+
+//======================================================================
+BOOST_AUTO_TEST_CASE(constructorWithNoArguments)
+{
+    BTrack b;
+    
+    BOOST_CHECK_EQUAL(b.getHopSize(), 512);
+}
+
+//======================================================================
+BOOST_AUTO_TEST_CASE(constructorWithHopSize)
+{
+    BTrack b(1024);
+    
+    BOOST_CHECK_EQUAL(b.getHopSize(), 1024);
+}
+
+//======================================================================
+BOOST_AUTO_TEST_CASE(constructorWithHopSizeAndFrameSize)
+{
+    BTrack b(256,512);
+    
+    BOOST_CHECK_EQUAL(b.getHopSize(), 256);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+//======================================================================
+//======================================================================
+
+
+//======================================================================
 //=================== PROCESSING SIMPLE VALUES =========================
 //======================================================================
 BOOST_AUTO_TEST_SUITE(processingSimpleValues)
@@ -31,7 +65,7 @@
         
         currentInterval++;
         
-        if (b.playbeat == 1)
+        if (b.beatDueInCurrentFrame())
         {
             numBeats++;
             
@@ -77,7 +111,7 @@
         
         currentInterval++;
         
-        if (b.playbeat == 1)
+        if (b.beatDueInCurrentFrame())
         {
             numBeats++;
             
@@ -123,7 +157,7 @@
         
         currentInterval++;
         
-        if (b.playbeat == 1)
+        if (b.beatDueInCurrentFrame())
         {
             numBeats++;
             
@@ -178,7 +212,7 @@
         
         currentInterval++;
         
-        if (b.playbeat == 1)
+        if (b.beatDueInCurrentFrame())
         {
             numBeats++;
             
@@ -210,7 +244,8 @@
 
 
 BOOST_AUTO_TEST_SUITE_END()
-
+//======================================================================
+//======================================================================