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
Diff: tests.h
- Revision:
- 1:00a4ea97c4cd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests.h Mon May 07 21:24:25 2018 +0000
@@ -0,0 +1,72 @@
+#ifndef TESTS_H
+#define TESTS_H
+
+#include "Coin-test.h"
+#include "Hscore-test.h"
+#include "CoinWithBag-test.h"
+#include "CoinWithBoundary-test.h"
+
+/**
+ * @brief Run all the tests for this program
+ *
+ * @returns The number of tests that failed
+ */
+int run_all_tests()
+{
+ int n_tests_failed = 0; // A log of the number of tests that have failed
+
+ // Run the Ball_test_movement test
+ printf("Testing Coin_test_movement...\n");
+ bool test1_passed = Coin_test_movement();
+
+ printf("Testing GetHscore_test_value...\n");
+ bool test2_passed = GetHscore_test_value();
+
+ printf("Testing CoinWithBag_test_collide...\n");
+ bool test3_passed = CoinWithBag_test_collide();
+
+ printf("Testing CoinWithBoundary_test_collide...\n");
+ bool test4_passed = CoinWithBoundary_test_collide();
+
+ // Print out the result of this test
+ if (test1_passed) {
+ printf("...Passed!\n");
+ }
+ else {
+ printf("...Failed!\n");
+ ++n_tests_failed; // Increment number of failures
+ }
+ if (test2_passed) {
+ printf("...Passed!\n");
+ }
+ else {
+ printf("...Failed!\n");
+ ++n_tests_failed; // Increment number of failures
+ }
+ if (test3_passed) {
+ printf("...Passed!\n");
+ }
+ else {
+ printf("...Failed!\n");
+ ++n_tests_failed; // Increment number of failures
+ }
+ if (test4_passed) {
+ printf("...Passed!\n");
+ }
+ else {
+ printf("...Failed!\n");
+ ++n_tests_failed; // Increment number of failures
+ }
+
+ // Finish by printing a summary of the tests
+ if (n_tests_failed > 0) {
+ printf("%d tests FAILED!\n", n_tests_failed);
+ }
+ else {
+ printf("All tests passed!\n");
+ }
+
+ return n_tests_failed;
+}
+
+#endif
\ No newline at end of file
