-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Committer: Tamio Vesa Nakajima <[email protected]>
Added a compare script Changes to be committed: modified: examples/aplusb/buildtests new file: examples/aplusb/compare modified: examples/aplusb/incf/fixed new file: examples/aplusb/incf/fixed2 modified: examples/aplusb/ingen/ingen.bin modified: examples/aplusb/ingen/ingen.cpp modified: examples/aplusb/lib new file: examples/aplusb/oldtests/newtests.zip new file: examples/aplusb/oldtests/newtests2.zip new file: examples/aplusb/src/almost_ok.cpp new file: examples/aplusb/stage/aplusb.bin new file: examples/aplusb/stage/aplusb.in new file: examples/aplusb/stage/aplusb.out modified: examples/aplusb/testmanifest modified: examples/aplusb/tests/aplusb-1.in modified: examples/aplusb/tests/aplusb-1.ok modified: examples/aplusb/tests/aplusb-10.in modified: examples/aplusb/tests/aplusb-10.ok modified: examples/aplusb/tests/aplusb-11.in modified: examples/aplusb/tests/aplusb-11.ok modified: examples/aplusb/tests/aplusb-12.in modified: examples/aplusb/tests/aplusb-12.ok modified: examples/aplusb/tests/aplusb-13.in modified: examples/aplusb/tests/aplusb-13.ok modified: examples/aplusb/tests/aplusb-14.in modified: examples/aplusb/tests/aplusb-14.ok modified: examples/aplusb/tests/aplusb-15.in modified: examples/aplusb/tests/aplusb-15.ok modified: examples/aplusb/tests/aplusb-16.in modified: examples/aplusb/tests/aplusb-16.ok modified: examples/aplusb/tests/aplusb-17.in modified: examples/aplusb/tests/aplusb-17.ok modified: examples/aplusb/tests/aplusb-18.in modified: examples/aplusb/tests/aplusb-18.ok new file: examples/aplusb/tests/aplusb-19.in new file: examples/aplusb/tests/aplusb-19.ok modified: examples/aplusb/tests/aplusb-2.in modified: examples/aplusb/tests/aplusb-2.ok modified: examples/aplusb/tests/aplusb-3.in modified: examples/aplusb/tests/aplusb-3.ok modified: examples/aplusb/tests/aplusb-4.in modified: examples/aplusb/tests/aplusb-4.ok modified: examples/aplusb/tests/aplusb-5.in modified: examples/aplusb/tests/aplusb-5.ok modified: examples/aplusb/tests/aplusb-6.in modified: examples/aplusb/tests/aplusb-6.ok modified: examples/aplusb/tests/aplusb-7.in modified: examples/aplusb/tests/aplusb-7.ok modified: examples/aplusb/tests/aplusb-8.in modified: examples/aplusb/tests/aplusb-8.ok modified: examples/aplusb/tests/aplusb-9.in modified: examples/aplusb/tests/aplusb-9.ok modified: src/buildtests new file: src/compare modified: src/lib
- Loading branch information
Tamio Vesa Nakajima
authored and
Tamio Vesa Nakajima
committed
May 21, 2018
1 parent
512150d
commit 27ea592
Showing
55 changed files
with
287 additions
and
66 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/bin/bash | ||
# | ||
# compare -s "s1 s2" -s s3 -c "c1 c2" -c c3 compares sources s1, s2, s3 with configurations c1 c2 c3 until they diverge | ||
# Tamio-Vesa Nakajima | ||
|
||
source lib | ||
source problemconfig | ||
|
||
srcs="" | ||
configs="" | ||
|
||
while getopts "hs:c:" opt ; do | ||
case $opt in | ||
h) | ||
echo "Usage: ./compare -s \"source1\" -s \"source2\" -c \"config1\" \"config2\"" | ||
exit 0 | ||
;; | ||
s) | ||
srcs="$srcs $OPTARG" | ||
;; | ||
c) | ||
configs="$configs $OPTARG" | ||
;; | ||
esac | ||
done | ||
|
||
if [ -z "$srcs" ] ; then | ||
echo No sources provided | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$configs" ] ; then | ||
echo No configs provided | ||
exit 1 | ||
fi | ||
|
||
srcs_arr=($srcs) | ||
nr_srcs=${#srcs_arr[@]} | ||
outputs_arr=() | ||
binary_arr=() | ||
input_file=`mktemp` | ||
|
||
for i in `seq 0 $(($nr_srcs-1))` ; do | ||
outputs_arr[$i]=`mktemp` | ||
binary_arr[$i]=`mktemp` | ||
done | ||
|
||
for i in `seq 0 $(($nr_srcs-1))` ; do | ||
g++ src/${srcs_arr[$i]} -std=c++11 -O2 -o ${binary_arr[$i]} | ||
done | ||
|
||
curr_test=0 | ||
|
||
path_to_tests=`realpath tests` | ||
trap "rm $path_to_tests/$problemname-999.in" EXIT | ||
|
||
while : ; do | ||
for conf in $configs ; do | ||
rm stage/* 2> /dev/null | ||
echo -en " \r" | ||
echo Doing test $curr_test | ||
curr_test=$(($curr_test + 1)) | ||
|
||
build_test_number 999 $conf | ||
|
||
hasTle=false | ||
|
||
for i in `seq 0 $(($nr_srcs-1))` ; do | ||
run_src_test ${binary_arr[$i]} $problemname-999 | ||
|
||
if (( $(echo "$timeUsed > $timelimit" | bc -l ) )) ; then | ||
hasTle=true | ||
fi | ||
|
||
cp stage/$problemname.out ${outputs_arr[$i]} | ||
done | ||
if [ $hasTle = true ] || ! diff --from-file ${outputs_arr[*]} > /dev/null ; then | ||
echo -en " \r" | ||
echo Has failed on: | ||
cat tests/$problemname-999.in | ||
echo With outputs: | ||
for i in `seq 0 $(($nr_srcs-1))` ; do | ||
echo ${srcs_arr[$i]}: | ||
cat ${outputs_arr[$i]} | ||
echo | ||
done | ||
exit 0 | ||
fi | ||
done | ||
done |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1 0 2 | ||
1 0 0 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 100 200 |
Binary file not shown.
This file contains 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
This file contains 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
Binary file not shown.
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <fstream> | ||
using namespace std; | ||
|
||
int main(){ | ||
ifstream f("aplusb.in"); | ||
ofstream g("aplusb.out"); | ||
long long x, y; | ||
f >> x >> y; | ||
if((x+y)%100 == 0) g << -1 << endl; | ||
else g << x+y << endl; | ||
return 0; } |
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
468168176 122451424 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-1 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
1 fixed 10 | ||
1 fixed2 10 | ||
18 random 90 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1394068970 1070590020 | ||
100 200 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
5 | ||
2464658990 | ||
10 | ||
300 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1394085777 1353065269 | ||
1405884291 2082194543 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
5 | ||
2747151046 | ||
3488078834 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1394085777 1353065269 | ||
1405884291 2082194543 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
5 | ||
2747151046 | ||
3488078834 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1394085777 1353065269 | ||
1405884291 2082194543 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
5 | ||
2747151046 | ||
3488078834 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1394085777 1353065269 | ||
1405884291 2082194543 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
5 | ||
2747151046 | ||
3488078834 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1394085777 1353065269 | ||
1405884291 2082194543 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
5 | ||
2747151046 | ||
3488078834 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1394085777 1353065269 | ||
1405884291 2082194543 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
5 | ||
2747151046 | ||
3488078834 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1394085777 1353065269 | ||
1405884291 2082194543 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
5 | ||
2747151046 | ||
3488078834 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1394085777 1353065269 | ||
1405884291 2082194543 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
5 | ||
2747151046 | ||
3488078834 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1394085777 1353065269 | ||
1405901098 217186145 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
5 | ||
2747151046 | ||
1623087243 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1405901098 217186145 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
5 | ||
1623087243 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1394068970 1070590020 | ||
1405867484 1799719294 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
5 | ||
2464658990 | ||
3205586778 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1394068970 1070590020 | ||
1405867484 1799719294 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
5 | ||
2464658990 | ||
3205586778 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1394068970 1070590020 | ||
1405867484 1799719294 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
5 | ||
2464658990 | ||
3205586778 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1394068970 1070590020 | ||
1405867484 1799719294 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
5 | ||
2464658990 | ||
3205586778 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1394068970 1070590020 | ||
1405867484 1799719294 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
5 | ||
2464658990 | ||
3205586778 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1394068970 1070590020 | ||
1405867484 1799719294 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
5 | ||
2464658990 | ||
3205586778 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1394068970 1070590020 | ||
1405867484 1799719294 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
5 | ||
2464658990 | ||
3205586778 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1394085777 1353065269 | ||
1405867484 1799719294 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
5 | ||
2747151046 | ||
3205586778 |
This file contains 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
Oops, something went wrong.