Tests for simple blinky library.

Dependencies:   Blinky

Fork of Blinky_Tests by Sarah Marsh

Revision:
2:a6755ef75598
Parent:
1:b0034f8b2c42
Child:
4:09af3b2d723e
--- a/TESTS/Blinky/5_Blinks/main.cpp	Tue Sep 27 22:24:35 2016 +0000
+++ b/TESTS/Blinky/5_Blinks/main.cpp	Tue Nov 08 18:16:55 2016 +0000
@@ -14,13 +14,13 @@
  
 //To be called by interrupt, increases the number of measured rising edges 
 void count_blinks(){
-        TEST_ASSERT_MESSAGE(++measured_blinks<=expected_blinks, "******Too many blinks!******");
+    measured_blinks++;
 }
  
 //Generic blink test
 //interval => the the amount of time between blinks
 //led => PinName of LED to blink
-bool test_blinks(int interval, PinName led){
+void test_blinks(PinName led, int interval){
     //reset the measured blinks to 0 for each case
     measured_blinks = 0;
     //Set an appropriate wait time to measure exactly expected_blinks
@@ -37,15 +37,17 @@
     //Wait the appropriate amount of time for expected_blinks 
     Thread::wait(wait_time);
     blinker.stop();
+    //Only assert if failure
+    TEST_ASSERT(measured_blinks != expected_blinks);
 }
  
 void blink_500(){
     //Blinky with a 500 ms interval between blinks
-    test_blinks(500, LED1);
+    test_blinks(LED1, 500);
 }
 void blink_1000(){
     //Blinky with a 1000 ms interval between blinks
-    test_blinks(1000, LED1);
+    test_blinks(LED1, 1000);
 }
  
 utest::v1::status_t test_setup(const size_t number_of_cases) {