Zikang Qian / Mbed 2 deprecated el17z2q

Dependencies:   mbed

Fork of el17z2q by ELEC2645 (2017/18)

Revision:
1:00a4ea97c4cd
Child:
2:6dc7bc55c1cb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Bag/Hscore-test.h	Mon May 07 21:24:25 2018 +0000
@@ -0,0 +1,44 @@
+#ifndef HSCORE_TEST_H
+#define HSCORE_TEST_H
+
+/** Coin-test Class
+* @brief Comfirm that int get_Hscore() function work
+* @author Zikang Qian
+* @date April, 2018
+*/
+
+/** \returns true if all the tests passed
+ */
+bool GetHscore_test_value()
+{
+    // Initialise bag object with a width of 18, height of 2 and speed of 1
+    Bag bag;
+    
+    int test_score_1 = 5;
+    bag.add_score(test_score_1);  
+    int read_Hscroe_1 = bag.get_Hscore();
+    printf("%f", read_Hscore_1);
+
+    int test_score_2 = 3;
+    bag.add_score(test_score_2);
+    int read_Hscroe_2 = bag.get_Hscore();
+    printf("%f", read_Hscore_2);
+   
+    // Update the position
+    bag.update();
+    
+    // Now check that both the positions are as expected
+    bool success = true;
+    
+    // Fail the test if the initial position is wrong
+    if (read_Hscroe_1 != 5) {
+        success = false;
+    }
+    
+    if (read_Hscroe_2 != 5) {
+        success = false;
+    }
+
+    return success;
+}
+#endif
\ No newline at end of file