forked from kspalaiologos/asm2ws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mktest.sh
executable file
·45 lines (33 loc) · 912 Bytes
/
mktest.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
_prompt() {
echo "$(tput setaf 7)$1:$(tput sgr0) "
cat > "$name.$2"
}
printf "$(tput setaf 7)test name:$(tput sgr0) "
read name
read -n 1 -p "$(tput setaf 7)type: (r)ebuild/(b)uild$(tput sgr0) " ans;
echo ""
cd tests
case $ans in
r|R)
cd "ws-rebuild"
_prompt "program" "bak"
_prompt "input" "ws.in"
_prompt "output" "ws.out"
cp "$name.ws.in" "$name.ws.asm.ws.in"
cp "$name.ws.out" "$name.ws.asm.ws.out"
[ $(wc -c < "$name.ws.in") -eq 0 ] \
&& rm "$name.ws.in" \
&& rm "$name.ws.asm.ws.in"
../../wsi -m "$name.bak" > "$name.ws"
;;
b|B)
cd "ws-build-run"
_prompt "program" "asm"
_prompt "input" "asm.ws.in"
_prompt "output" "asm.ws.out"
[ $(wc -c < "$name.asm.ws.in") -eq 0 ] && rm "$name.asm.ws.in"
;;
*)
exit;;
esac