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.
Dependencies: mbed
Fork of el17ajf by
UnitTests/UnitTests.h@41:91b0c73b9e02, 2019-05-09 (annotated)
- Committer:
- el17ajf
- Date:
- Thu May 09 12:10:29 2019 +0000
- Revision:
- 41:91b0c73b9e02
- Child:
- 44:44aa01af687e
Commented remaining parts, added unit tests
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el17ajf | 41:91b0c73b9e02 | 1 | class UnitTests { |
el17ajf | 41:91b0c73b9e02 | 2 | public: |
el17ajf | 41:91b0c73b9e02 | 3 | /** |
el17ajf | 41:91b0c73b9e02 | 4 | * @brief Runs all unit tests, and prints their name |
el17ajf | 41:91b0c73b9e02 | 5 | */ |
el17ajf | 41:91b0c73b9e02 | 6 | static void runAllTests(); |
el17ajf | 41:91b0c73b9e02 | 7 | private: |
el17ajf | 41:91b0c73b9e02 | 8 | /** |
el17ajf | 41:91b0c73b9e02 | 9 | * @brief |
el17ajf | 41:91b0c73b9e02 | 10 | * @param description A description of the test to print if it fails |
el17ajf | 41:91b0c73b9e02 | 11 | * @param result The result of the test, if it's false the error will print |
el17ajf | 41:91b0c73b9e02 | 12 | */ |
el17ajf | 41:91b0c73b9e02 | 13 | static void assertTrue(const char * description, bool result); |
el17ajf | 41:91b0c73b9e02 | 14 | |
el17ajf | 41:91b0c73b9e02 | 15 | /** |
el17ajf | 41:91b0c73b9e02 | 16 | * @brief Test the tetromino is the same after being rotated 360 degrees |
el17ajf | 41:91b0c73b9e02 | 17 | */ |
el17ajf | 41:91b0c73b9e02 | 18 | static void testTetromino(); |
el17ajf | 41:91b0c73b9e02 | 19 | |
el17ajf | 41:91b0c73b9e02 | 20 | /** |
el17ajf | 41:91b0c73b9e02 | 21 | * @brief Test the blocks are instanciated correctly |
el17ajf | 41:91b0c73b9e02 | 22 | */ |
el17ajf | 41:91b0c73b9e02 | 23 | static void testBlock(); |
el17ajf | 41:91b0c73b9e02 | 24 | |
el17ajf | 41:91b0c73b9e02 | 25 | /** |
el17ajf | 41:91b0c73b9e02 | 26 | * @brief Tests that preferences are saved and retrived correctly |
el17ajf | 41:91b0c73b9e02 | 27 | */ |
el17ajf | 41:91b0c73b9e02 | 28 | static void testPrefs(); |
el17ajf | 41:91b0c73b9e02 | 29 | |
el17ajf | 41:91b0c73b9e02 | 30 | /** |
el17ajf | 41:91b0c73b9e02 | 31 | * @brief Test that the space is taken up when a tetromino |
el17ajf | 41:91b0c73b9e02 | 32 | * is inserted into the grid |
el17ajf | 41:91b0c73b9e02 | 33 | */ |
el17ajf | 41:91b0c73b9e02 | 34 | static void testGrid(); |
el17ajf | 41:91b0c73b9e02 | 35 | }; |