Created
February 28, 2021 13:31
-
-
Save HirbodBehnam/40b00ab211e32d23484f88057a5b9c4e to your computer and use it in GitHub Desktop.
Some scripts for creating test cases for java applications.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal EnableDelayedExpansion | |
javac %1 | |
set /A Counter=1 | |
set ClassName=%1 | |
set ClassName=%ClassName:~0,-5% | |
:loop | |
set "i=in%Counter%.txt" | |
set "o=out%Counter%.txt" | |
if exist %i% ( | |
java "%ClassName%" < "%i%" > tmp.txt | |
fc tmp.txt "%o%" | |
del tmp.txt | |
set /A Counter=Counter+1 | |
goto loop | |
) else ( | |
echo Done | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
COUNTER=1 | |
javac "$1" | |
JAVA_FILE="$1" | |
CLASS_NAME=${JAVA_FILE:0:-5} | |
while : | |
do | |
[ ! -f "in$COUNTER.txt" ] && break | |
echo "Checking in$COUNTER.txt..." | |
diff <(cat "out$COUNTER.txt") <(java "$CLASS_NAME" < "in$COUNTER.txt") | |
COUNTER=$((COUNTER+1)) | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal EnableDelayedExpansion | |
javac %1 | |
set /A Counter=1 | |
set ClassName=%1 | |
set ClassName=%ClassName:~0,-5% | |
:loop | |
set "i=in%Counter%.txt" | |
set "o=out%Counter%.txt" | |
if exist %i% ( | |
java %ClassName% < %i% > %o% | |
set /A Counter=Counter+1 | |
goto loop | |
) else ( | |
echo Done | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
COUNTER=1 | |
javac "$1" | |
JAVA_FILE="$1" | |
CLASS_NAME=${JAVA_FILE:0:-5} | |
while : | |
do | |
[ ! -f "in$COUNTER.txt" ] && break | |
echo "Generating in$COUNTER.txt..." | |
java "$CLASS_NAME" < "in$COUNTER.txt" > "out$COUNTER.txt" | |
COUNTER=$((COUNTER+1)) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment