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
shot-test.h
00001 #ifndef SHOT_TEST_H 00002 #define SHOT_TEST_H 00003 00004 /** SHOT test 00005 *@brief checks that shot move in correct direction 00006 *@author Zeyu Feng 00007 *@date 15 May 2020 00008 *@return ture if all tests are passed 00009 */ 00010 00011 bool shot_test() 00012 { 00013 //Initialise 1 shots 00014 shot shots; 00015 shots.set_size(1); 00016 //create a 1 size vector 00017 shots.update_shot(); 00018 /*set x=23, y=32, type(3),direction(0):(*i).x +=1 00019 (*i).y +=1(South-east)*/ 00020 shots.set_shot(23,32,3,0); 00021 shots.update(); 00022 00023 Vector2D read_pos = shots.get_shot(); 00024 //printf("shot position = %f, %f\n",read_pos.x,read_pos.y); 00025 00026 bool success_flag = true; 00027 00028 if (read_pos.x !=24 || read_pos.y !=33){ 00029 success_flag = false; 00030 } 00031 00032 return success_flag; 00033 } 00034 00035 #endif 00036
Generated on Thu Jul 14 2022 12:45:25 by
