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
Snake-test.h
00001 #ifndef SNAKE_TEST_H 00002 #define SNAKE_TEST_H 00003 00004 00005 /** 00006 * \brief Check that food changes position within game area 00007 * 00008 * \returns true if all the tests passed 00009 */ 00010 00011 bool snake_test_movement() 00012 { 00013 bool success_flag = true; 00014 00015 Snake snake; 00016 00017 // next diretion test 00018 00019 snake.set_current_direction(S); 00020 snake.set_snake_direction(N,S); 00021 Direction next = snake.get_snake_direction(); 00022 snake.set_snake_position(next); 00023 Vector2D pos = snake.get_snake_position(); 00024 00025 00026 printf("%c", next); 00027 00028 printf("Position %f, %f", pos.x, pos.y); 00029 00030 if(next == !S) { 00031 00032 success_flag = false; 00033 00034 } 00035 00036 if((pos.x != 0) && (pos.y != 1)) { 00037 00038 success_flag = false; 00039 00040 } 00041 00042 return success_flag; 00043 00044 00045 } 00046 #endif
Generated on Wed Aug 3 2022 05:55:53 by
1.7.2