add testing
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Bruno Rybársky 2022-05-29 19:35:57 +02:00
parent b7a53bdb43
commit f99024bb75
3 changed files with 58 additions and 5 deletions

BIN
main

Binary file not shown.

27
main.c

@ -12,10 +12,12 @@
#include <math.h>
#include <string.h>
uint16_t Hole_Div = 40;
uint16_t SCR_X;
uint16_t SCR_Y;
#define FPS (60)
uint16_t FPS = 60;
char blank_char = 32;
char wall_char = 35;
char goal_char = 71;
@ -26,6 +28,7 @@ uint16_t wall_color = 1;
uint16_t goal_color = 2;
uint16_t player_color = 3;
uint16_t border_color = 4;
uint16_t Quit_on_pass = 0;
char letter = ' ';
struct Object {
uint16_t x;
@ -236,9 +239,26 @@ int main(int argc, char * argv[]) {
SCR_Y = atoi(argv[2]);
Hole_Div = atoi(argv[3]);
}
if(argc == 5){
SCR_X = atoi(argv[1]);
SCR_Y = atoi(argv[2]);
Hole_Div = atoi(argv[3]);
FPS = atoi(argv[4]);
}
if (argc == 6){
SCR_X = atoi(argv[1]);
SCR_Y = atoi(argv[2]);
Hole_Div = atoi(argv[3]);
FPS = atoi(argv[4]);
if(strcmp(argv[5],"-n") == 0){
Quit_on_pass = 1;
}
}
generate_maze();
if(Quit_on_pass == 0){
render_maze();
draw_maze();
}
while (1) {
inputs_tmp = keyinput();
if (inputs_tmp == 1) {
@ -250,10 +270,15 @@ int main(int argc, char * argv[]) {
} else {
orient = 0;
}
if(Quit_on_pass == 1){
return 4;
}
generate_maze();
}
if(Quit_on_pass == 0){
render_maze();
draw_maze();
}
usleep(round(1000000 / FPS));
}
endwin();

28
test.sh Normal file

@ -0,0 +1,28 @@
#!/bin/bash
RANDOM=$$$(date +%s)
X=""
CNT=0
CNTX=0
CNTA=0
CNTB=0
CNTXB=0
CNTAB=0
while [ $CNTX -lt 50 ]; do
let CNT=0
while [ $CNT -lt 162 ]; do
X+="wd"
let CNT=CNT+1
done
let CNTA=0
while [ $CNTA -lt 162 ]; do
X+="wa"
let CNTA=CNTA+1
done
let CNTX=CNTX+1
done
X+="q"
echo $X