Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of el17z2q by
Bag/Hscore-test.h
- Committer:
- yzjdxl
- Date:
- 2018-05-07
- Branch:
- GameEngine
- Revision:
- 2:6dc7bc55c1cb
- Parent:
- 1:00a4ea97c4cd
File content as of revision 2:6dc7bc55c1cb:
#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() { // Just quote the get_Hscore() function Bag bag; // int score 5 firstly int test_score_1 = 5; // get the score bag.add_score(test_score_1); int read_Hscroe_1 = bag.get_Hscore(); printf("%f", read_Hscore_1); // then int score 3 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 score bag.update(); // Now check that both the scores are as expected bool success = true; // Fail the test if the score is wrong if (read_Hscroe_1 != 5) { success = false; } if (read_Hscroe_2 != 5) { success = false; } return success; } #endif