Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

tests.h

Committer:
AhmedPlaymaker
Date:
2019-05-05
Revision:
74:7b6568bc16d5
Parent:
69:55e309da7efd
Child:
99:4841f326200f

File content as of revision 74:7b6568bc16d5:

#ifndef TESTS_H
#define TESTS_H

#include "Snake-test.h"

/**
 * @brief Run all the tests for this program
 *
 * @returns The number of tests that failed
 */
int run_all_tests()
{
    int number_of_failed_tests = 0; // A log of the number of tests that have failed

    // Run the Snake_test_movement
    printf("Testing Snake_test_movement...\n");
    bool snake_movement_test_passed = Snake_test_movement();

    // Print out the result of this test
    if (snake_movement_test_passed) {
        printf("...Passed!, no worries the game is alright\n");
    } else {
        printf("...FAILED!\n");
        ++number_of_failed_tests; // Increment number of failures
    }


    // Finish by printing a summary of the tests
    if (number_of_failed_tests > 0) {
        printf("%d tests FAILED!\n", number_of_failed_tests);
    } else {
        printf("All tests passed!\n");
    }

    return number_of_failed_tests;
}

#endif