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
GameEngine/CoinWithBoundary-test.h
- Committer:
- yzjdxl
- Date:
- 2018-05-07
- Revision:
- 1:00a4ea97c4cd
- Child:
- 2:6dc7bc55c1cb
File content as of revision 1:00a4ea97c4cd:
#ifndef COINWITHBOUNDARY_TEST_H #define COINWITHBOUNDARY_TEST_H /** CoinWithBoundayr-test Class * @brief Check that the coin object correctly collides with boundary * @author Zikang Qian * @date April, 2018 */ /** \returns true if all the tests passed */ bool CoinWithBoundary_test_collide() { Coin coin; Bag bag; GameEngine game; coin.init(2.5,1); game.init(17,2,2.5,1); Vector2D initial_coin_position = {5,0}; coin.set_position(initial_coin_position); Vecotr2D read_coin_position = coin.get_position; printf("%f, %f\n", read_coin_position.x, read_coin_position.y); // Set the velocity to -2, 3 Vector2D velocity = {0, 48}; coin.set_velocity(velocity); // Update the position coin.update(); int nodead = game.update(pad); // Now check that both the positions are as expected bool success = true; // Fail the test if the initial position is wrong if (nodead != 0) { success = false; } return success; } #endif