Yufan Zhong / Mbed 2 deprecated GOLD_MINER

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers tests.h Source File

tests.h

00001 #ifndef TESTS_H
00002 #define TESTS_H
00003 
00004 #include "Claw-test.h"
00005 #include "Winch-test.h"
00006 #include "Gold-test.h"
00007 #include "Monster-test.h"
00008 /**
00009  * @brief Run all the tests for this program
00010  *
00011  * @returns The number of tests that failed
00012  */
00013 int run_all_tests()
00014 {
00015     int n_tests_failed = 0; // A log of the number of tests that have failed
00016 
00017     // Run the Claw_test_movement test
00018     printf("Testing Claw_test_movement...\n");
00019     bool claw_test_passed = Claw_test_movement();
00020 
00021     // Print out the result of this test
00022     if (claw_test_passed) {
00023         printf("...Passed!\n");
00024     }
00025     else {
00026         printf("...FAILED!\n");
00027         ++n_tests_failed; // Increment number of failures
00028     }
00029     
00030     
00031 ///////////////
00032     // Run the Winch_test_movement test
00033     printf("Testing Winch_test_movement...\n");
00034     bool winch_test_passed = Winch_test_movement();
00035 
00036     // Print out the result of this test
00037     if (winch_test_passed) {
00038         printf("...Passed!\n");
00039     }
00040     else {
00041         printf("...FAILED!\n");
00042         ++n_tests_failed; // Increment number of failures
00043     }
00044 
00045 
00046 ///////////////
00047     // Run the Gold_test_movement test
00048     printf("Testing Gold_test_movement...\n");
00049     bool gold_test_passed = Gold_test_movement();
00050 
00051     // Print out the result of this test
00052     if (gold_test_passed) {
00053         printf("...Passed!\n");
00054     }
00055     else {
00056         printf("...FAILED!\n");
00057         ++n_tests_failed; // Increment number of failures
00058     }
00059 
00060 
00061 
00062 ///////////////
00063     // Run the Monster_test_movement test
00064     printf("Testing Monster_test_movement...\n");
00065     bool monster_test_passed = Monster_test_movement();
00066 
00067     // Print out the result of this test
00068     if (monster_test_passed) {
00069         printf("...Passed!\n");
00070     }
00071     else {
00072         printf("...FAILED!\n");
00073         ++n_tests_failed; // Increment number of failures
00074     }
00075 
00076 
00077 
00078 ///////////////
00079     // Finish by printing a summary of the tests
00080     if (n_tests_failed > 0) {
00081         printf("%d tests FAILED!\n", n_tests_failed);
00082     }
00083     else {
00084         printf("All tests passed!\n");
00085     }
00086 
00087     return n_tests_failed;
00088 }
00089 
00090 #endif