inverse_move_tests.c (402B)
1 #include "../test.h" 2 3 extern char *movestr[]; 4 5 int64_t readmoves(const char *, size_t n, uint8_t [n]); 6 uint8_t inverse_move(uint8_t); 7 8 void run(void) { 9 uint8_t moves[2]; 10 11 char moves_string[STRLENMAX]; 12 13 fgets(moves_string, STRLENMAX, stdin); 14 if (readmoves(moves_string, 2, moves) != 1) { 15 printf("Test error: cannot read moves\n"); 16 return; 17 } 18 19 printf("%s\n", movestr[inverse_move(moves[0])]); 20 }