From 27ea59295a8f4c77bddd58557584a863ba6fafc5 Mon Sep 17 00:00:00 2001 From: Tamio Vesa Nakajima Date: Mon, 21 May 2018 02:03:31 +0100 Subject: [PATCH] Committer: Tamio Vesa Nakajima 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 --- examples/aplusb/buildtests | 13 +--- examples/aplusb/compare | 90 +++++++++++++++++++++++++ examples/aplusb/incf/fixed | 2 +- examples/aplusb/incf/fixed2 | 1 + examples/aplusb/ingen/ingen.bin | Bin 42252 -> 42128 bytes examples/aplusb/ingen/ingen.cpp | 5 +- examples/aplusb/lib | 24 ++++++- examples/aplusb/oldtests/newtests.zip | Bin 0 -> 7194 bytes examples/aplusb/oldtests/newtests2.zip | Bin 0 -> 7194 bytes examples/aplusb/src/almost_ok.cpp | 11 +++ examples/aplusb/stage/aplusb.bin | Bin 0 -> 25948 bytes examples/aplusb/stage/aplusb.in | 1 + examples/aplusb/stage/aplusb.out | 1 + examples/aplusb/testmanifest | 1 + examples/aplusb/tests/aplusb-1.in | 2 +- examples/aplusb/tests/aplusb-1.ok | 4 +- examples/aplusb/tests/aplusb-10.in | 2 +- examples/aplusb/tests/aplusb-10.ok | 2 +- examples/aplusb/tests/aplusb-11.in | 2 +- examples/aplusb/tests/aplusb-11.ok | 2 +- examples/aplusb/tests/aplusb-12.in | 2 +- examples/aplusb/tests/aplusb-12.ok | 2 +- examples/aplusb/tests/aplusb-13.in | 2 +- examples/aplusb/tests/aplusb-13.ok | 2 +- examples/aplusb/tests/aplusb-14.in | 2 +- examples/aplusb/tests/aplusb-14.ok | 2 +- examples/aplusb/tests/aplusb-15.in | 2 +- examples/aplusb/tests/aplusb-15.ok | 2 +- examples/aplusb/tests/aplusb-16.in | 2 +- examples/aplusb/tests/aplusb-16.ok | 2 +- examples/aplusb/tests/aplusb-17.in | 2 +- examples/aplusb/tests/aplusb-17.ok | 2 +- examples/aplusb/tests/aplusb-18.in | 2 +- examples/aplusb/tests/aplusb-18.ok | 2 +- examples/aplusb/tests/aplusb-19.in | 1 + examples/aplusb/tests/aplusb-19.ok | 2 + examples/aplusb/tests/aplusb-2.in | 2 +- examples/aplusb/tests/aplusb-2.ok | 2 +- examples/aplusb/tests/aplusb-3.in | 2 +- examples/aplusb/tests/aplusb-3.ok | 2 +- examples/aplusb/tests/aplusb-4.in | 2 +- examples/aplusb/tests/aplusb-4.ok | 2 +- examples/aplusb/tests/aplusb-5.in | 2 +- examples/aplusb/tests/aplusb-5.ok | 2 +- examples/aplusb/tests/aplusb-6.in | 2 +- examples/aplusb/tests/aplusb-6.ok | 2 +- examples/aplusb/tests/aplusb-7.in | 2 +- examples/aplusb/tests/aplusb-7.ok | 2 +- examples/aplusb/tests/aplusb-8.in | 2 +- examples/aplusb/tests/aplusb-8.ok | 2 +- examples/aplusb/tests/aplusb-9.in | 2 +- examples/aplusb/tests/aplusb-9.ok | 2 +- src/buildtests | 13 +--- src/compare | 90 +++++++++++++++++++++++++ src/lib | 24 ++++++- 55 files changed, 287 insertions(+), 66 deletions(-) create mode 100755 examples/aplusb/compare create mode 100644 examples/aplusb/incf/fixed2 create mode 100644 examples/aplusb/oldtests/newtests.zip create mode 100644 examples/aplusb/oldtests/newtests2.zip create mode 100644 examples/aplusb/src/almost_ok.cpp create mode 100755 examples/aplusb/stage/aplusb.bin create mode 100644 examples/aplusb/stage/aplusb.in create mode 100644 examples/aplusb/stage/aplusb.out create mode 100644 examples/aplusb/tests/aplusb-19.in create mode 100644 examples/aplusb/tests/aplusb-19.ok create mode 100755 src/compare diff --git a/examples/aplusb/buildtests b/examples/aplusb/buildtests index aeaccf5..c54ff74 100755 --- a/examples/aplusb/buildtests +++ b/examples/aplusb/buildtests @@ -53,18 +53,7 @@ cat testmanifest | while read instr; do ################# if [ $rebuild_inputs = true ] ; then - # Build input generator - cd ingen && make -s && cd .. - - # Copy ingen/ingen.bin and incf/$1 into stage - cp ingen/ingen.bin stage/$problemname.bin - cp incf/$incf stage/$problemname.cf - - # Build input - cd stage && ./$problemname.bin && cp $problemname.in ../tests/$problemname-$nr.in && cd .. - - # Clean stage - rm stage/* + build_test_number $nr $incf fi ################### diff --git a/examples/aplusb/compare b/examples/aplusb/compare new file mode 100755 index 0000000..6a81689 --- /dev/null +++ b/examples/aplusb/compare @@ -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 diff --git a/examples/aplusb/incf/fixed b/examples/aplusb/incf/fixed index 1a63220..4271727 100644 --- a/examples/aplusb/incf/fixed +++ b/examples/aplusb/incf/fixed @@ -1 +1 @@ -1 0 2 +1 0 0 diff --git a/examples/aplusb/incf/fixed2 b/examples/aplusb/incf/fixed2 new file mode 100644 index 0000000..8cd5e6d --- /dev/null +++ b/examples/aplusb/incf/fixed2 @@ -0,0 +1 @@ +1 100 200 diff --git a/examples/aplusb/ingen/ingen.bin b/examples/aplusb/ingen/ingen.bin index 83566ce5989f0a0a0db32c4488794885e7b3fe88..40aa67d894bcdeb413864fe52e6583c80c5d8266 100755 GIT binary patch delta 7002 zcmb_geRNdS5x;M96{p3}d& zC-2VuX6DYFJ9qZJ+4Q_+3!b$FM`!3RLKH$s@2xPvM|U0jaJ?(@UM{Ud6?`&jzEbRJ z-^HaPLfRhbR6bUe8);KQf#Rj#Nyt)eqJs&`7U>n-@PaTzoPd7BCkg0gI?cW;qoRsi zmf5%pv7K&6%%Wp9J8iV*+JdX-llJTL2ONZqwGvWhC#2{g#FJaX*LYpCj2lJ?Z6uCm9fSD$oT@3Fa;(BmV`-_{2ipiyO`;klmxcrC=MxiPMN}&=@SlkZ z)d<8DgX@!cEjjIE0e2@Q)=g_Do_A_L>3o)m02TmZ-45*25wm~z10(DsLMhKs1!zSF3g<_*K2oj7D<1o%c(3z?^ z$UUurz&xt)jpMX^Mv6wz?Y=cv+%luCp)}R(uK=BCVYa%?!d8Zjx1tMh5hHNvvxx~A z2l8syB{DtmN46*r*mSDqZBbPj0qZ{SFdTRZMkp1`Itt7X3N%m;0X0Ie!3Zh@W~tlk zN1XgOT=jg^4Xd){#&NgCIha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qTL zX~JF;uA$=(P6{-br1zNcArpSkgdZ{Cr%d>`37@zaTgdZt%fY(*H4yU6aIb~C0Pb~g z<4?rf;D%F?z(Ggga3fd2T>*C`b?O #include +#include using namespace std; int main(){ @@ -8,12 +9,12 @@ int main(){ bool fixed; int x, y; f >> fixed >> x >> y; - cout << fixed << ' ' << x << ' ' << y << endl; if(fixed){ g << x << ' ' << y << endl; } else{ - srand(time(nullptr)); + unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count(); + srand(seed1); g << rand() << ' ' << rand() << endl; } return 0; } diff --git a/examples/aplusb/lib b/examples/aplusb/lib index d9526ac..e8bf9c7 100644 --- a/examples/aplusb/lib +++ b/examples/aplusb/lib @@ -23,6 +23,28 @@ maybecp () { fi } +# Builds test number $1 with incf $2 +build_test_number () { + source problemconfig + + nr=$1 + incf=$2 + + # Build input generator + cd ingen && make -s && cd .. + + # Copy ingen/ingen.bin and incf/$1 into stage + cp ingen/ingen.bin stage/$problemname.bin + cp incf/$incf stage/$problemname.cf + + # Build input + cd stage && ./$problemname.bin && cp $problemname.in ../tests/$problemname-$nr.in && cd .. + + # Clean stage + rm stage/* 2> /dev/null + +} + # Run the binary $1 with test $2, returning the time used in timeUsed, and leaving the output file in stage/$problemname.out run_src_test () { binary=$1 @@ -45,7 +67,7 @@ run_src_test () { echo -en "Doing $testname\r" # Clean the stage - rm stage/* + rm stage/* 2> /dev/null # Copy the binary into the stage cp $binary stage/$problemname.bin diff --git a/examples/aplusb/oldtests/newtests.zip b/examples/aplusb/oldtests/newtests.zip new file mode 100644 index 0000000000000000000000000000000000000000..c8cb9aef8c10c7b07d4114b6834b369f4dc47bb6 GIT binary patch literal 7194 zcmcJTJ!lj`6vy{+NlY#(C`qt5B!!BFi97poJF9IlNFt_C5iBH%MNm{oA|faVg4n1i z*rw4df~A#~_S&c^jGb5*8wC+;^bK?On9tiGyOS_*klb&7_jc|-@9q3-y}uE#pV1eu z=Aw=JU;E)TTf2g0uzYE0dFk-N^(!k&7be50#jB@J4F`4lzIKkSm760$t^aoo{(ltS z5Kcsmc?lP{Z>u3bjl_jekOgbkHJi9SB28qj-p1QQF&cJLL zay<`8nA3@fWQ4Xzk_zd|F7S8t&@p?g(?WC7isF!Fk#t@Zo9DjGbJ5&TnzUgwXQ%U- zJ5PtZXQ_5NW2m#!*>vEuqqLPJG?^e-o@XSFa`nXf(;CE@8!piM_=l4;3R8BCj0*R% zP#h!OmpCT6rEl4)I0m{eam;geflcGrb4wM+IQJ!vX^Bpir7^Z%cr7ZtUhdt*k3xfW6SPlk0LOvJhqA0X(+K& z+s^z6y6h$vaOGA?c6}ElQyh-;AqqmgpMIBp(?Hd(~!CT6eLe}Ije#!_swQ4qmK-(+&n*_pZB<7Ove;UKxseR%usJMZn{e08u+_|MqO z*9-pV2VVx^HNUoz23fwew7j&xdE;tp>B6)(bNSlI6CtPXLWy+tnIUEaCxk5ozc}jD>zmL6-S64WlqnoWJj$ zy}t$M{4#w)zI0R%LdLv=u^^Pd#p+mKXXJF1uEa6ROBTl{cO{NV&czLZ z3rBxnJ&r-{N*sf{*E5n{y6MLqzV=m7B z$LbrVj6JSnd71;3>*rwgMN`JEs93QT^=6x0Hf8Kj9ow6&zP8EOStxO)wj28==<-b{ zrwY8d+1Xp>whi1eeE(`(EU%Ssb3mJI_r23uCK7`s-s zA9ZXQwVmFq6ahom%Jz|tEyMP!ip9vavYmrRbD6J$*yA9`4<4`> literal 0 HcmV?d00001 diff --git a/examples/aplusb/src/almost_ok.cpp b/examples/aplusb/src/almost_ok.cpp new file mode 100644 index 0000000..9464e09 --- /dev/null +++ b/examples/aplusb/src/almost_ok.cpp @@ -0,0 +1,11 @@ +#include +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; } diff --git a/examples/aplusb/stage/aplusb.bin b/examples/aplusb/stage/aplusb.bin new file mode 100755 index 0000000000000000000000000000000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&f zVWNL&q9uG&5?kI%6J2VeZ#U6DG0`I?ItO1J#p?GmI*26xw3z6CiN1r&qnGffo6}MG z$4vAyCiK5U{t)+5}2Kwnqhgm5#$EeJITc>hWYLM=iaLOp^90gwGUL|;KDAxe^h6kLP}JQm&v zf<80*d#zKJG@H$PoJ^wo-^qlgT{)3Zbgh=)GAK@FCe}p@5<&@BH*uw@utlhOUk#g9 zC$OQOgl)2&bPQW`=Q6&9rra6ro$0iD#zM4TnXwRU{AMb|x91b3655x~R4lq7pQ#`_ z1e~$Z_C9)b5K~@)qOrFIvyvXaD44l;+$F)x#o4LG z%*9O28Gj2guFibEF(HQ?Y>cN)eNi#a7o9(%Cm)mKMUOnj^AbDj;QaB29HunG?)VcA zFikj8p85pPNj-If%+y24B$Hq#6;iR6B2;u@_aMYM`6a{D)idUo*$Inz<`lwHJ87Dd zrx6wCxd;a45T zX_nH!kFk^nc7CNau!Ae(#7b%4M^#D#Kcg}ZrwFoBsR{QbsO{<*efe*U2$R$_$2NwP zxs4NB%NWw8GN)MqovLdjSmxyGj;U{8%!VekCKPil-AcA@#DQmXGk%I+oUX>c;1W|d z8?y_VTIvH{oK53zJ;YSbrV+#636;Fk=k?>pp53X(^s0npuVx3X4GqptSP-4`S?Y!+ zI?bMy!uB?w6Z%#(0CB}%h|fah3g4Dix&xZ2DMbOgm=xbD%viX+9#@`ptc~lCnF<%; z9GVx*WKS{n5*)ckUr21rGR@eVuFTnVVz$C5EiR7ve>yaK^CWZ1)e}QvG$R)>*LFIgxY|aS M9lW+UtDxt90hL~H-2eap literal 0 HcmV?d00001 diff --git a/examples/aplusb/stage/aplusb.in b/examples/aplusb/stage/aplusb.in new file mode 100644 index 0000000..ac00f99 --- /dev/null +++ b/examples/aplusb/stage/aplusb.in @@ -0,0 +1 @@ +468168176 122451424 diff --git a/examples/aplusb/stage/aplusb.out b/examples/aplusb/stage/aplusb.out new file mode 100644 index 0000000..3a2e3f4 --- /dev/null +++ b/examples/aplusb/stage/aplusb.out @@ -0,0 +1 @@ +-1 diff --git a/examples/aplusb/testmanifest b/examples/aplusb/testmanifest index 83d2d86..9e68729 100644 --- a/examples/aplusb/testmanifest +++ b/examples/aplusb/testmanifest @@ -1,2 +1,3 @@ 1 fixed 10 +1 fixed2 10 18 random 90 diff --git a/examples/aplusb/tests/aplusb-1.in b/examples/aplusb/tests/aplusb-1.in index a0718a1..10ec153 100644 --- a/examples/aplusb/tests/aplusb-1.in +++ b/examples/aplusb/tests/aplusb-1.in @@ -1 +1 @@ -1394068970 1070590020 +100 200 diff --git a/examples/aplusb/tests/aplusb-1.ok b/examples/aplusb/tests/aplusb-1.ok index 98ce6b8..222b847 100644 --- a/examples/aplusb/tests/aplusb-1.ok +++ b/examples/aplusb/tests/aplusb-1.ok @@ -1,2 +1,2 @@ -5 -2464658990 +10 +300 diff --git a/examples/aplusb/tests/aplusb-10.in b/examples/aplusb/tests/aplusb-10.in index 7a8f027..32ce837 100644 --- a/examples/aplusb/tests/aplusb-10.in +++ b/examples/aplusb/tests/aplusb-10.in @@ -1 +1 @@ -1394085777 1353065269 +1405884291 2082194543 diff --git a/examples/aplusb/tests/aplusb-10.ok b/examples/aplusb/tests/aplusb-10.ok index cece230..275004c 100644 --- a/examples/aplusb/tests/aplusb-10.ok +++ b/examples/aplusb/tests/aplusb-10.ok @@ -1,2 +1,2 @@ 5 -2747151046 +3488078834 diff --git a/examples/aplusb/tests/aplusb-11.in b/examples/aplusb/tests/aplusb-11.in index 7a8f027..32ce837 100644 --- a/examples/aplusb/tests/aplusb-11.in +++ b/examples/aplusb/tests/aplusb-11.in @@ -1 +1 @@ -1394085777 1353065269 +1405884291 2082194543 diff --git a/examples/aplusb/tests/aplusb-11.ok b/examples/aplusb/tests/aplusb-11.ok index cece230..275004c 100644 --- a/examples/aplusb/tests/aplusb-11.ok +++ b/examples/aplusb/tests/aplusb-11.ok @@ -1,2 +1,2 @@ 5 -2747151046 +3488078834 diff --git a/examples/aplusb/tests/aplusb-12.in b/examples/aplusb/tests/aplusb-12.in index 7a8f027..32ce837 100644 --- a/examples/aplusb/tests/aplusb-12.in +++ b/examples/aplusb/tests/aplusb-12.in @@ -1 +1 @@ -1394085777 1353065269 +1405884291 2082194543 diff --git a/examples/aplusb/tests/aplusb-12.ok b/examples/aplusb/tests/aplusb-12.ok index cece230..275004c 100644 --- a/examples/aplusb/tests/aplusb-12.ok +++ b/examples/aplusb/tests/aplusb-12.ok @@ -1,2 +1,2 @@ 5 -2747151046 +3488078834 diff --git a/examples/aplusb/tests/aplusb-13.in b/examples/aplusb/tests/aplusb-13.in index 7a8f027..32ce837 100644 --- a/examples/aplusb/tests/aplusb-13.in +++ b/examples/aplusb/tests/aplusb-13.in @@ -1 +1 @@ -1394085777 1353065269 +1405884291 2082194543 diff --git a/examples/aplusb/tests/aplusb-13.ok b/examples/aplusb/tests/aplusb-13.ok index cece230..275004c 100644 --- a/examples/aplusb/tests/aplusb-13.ok +++ b/examples/aplusb/tests/aplusb-13.ok @@ -1,2 +1,2 @@ 5 -2747151046 +3488078834 diff --git a/examples/aplusb/tests/aplusb-14.in b/examples/aplusb/tests/aplusb-14.in index 7a8f027..32ce837 100644 --- a/examples/aplusb/tests/aplusb-14.in +++ b/examples/aplusb/tests/aplusb-14.in @@ -1 +1 @@ -1394085777 1353065269 +1405884291 2082194543 diff --git a/examples/aplusb/tests/aplusb-14.ok b/examples/aplusb/tests/aplusb-14.ok index cece230..275004c 100644 --- a/examples/aplusb/tests/aplusb-14.ok +++ b/examples/aplusb/tests/aplusb-14.ok @@ -1,2 +1,2 @@ 5 -2747151046 +3488078834 diff --git a/examples/aplusb/tests/aplusb-15.in b/examples/aplusb/tests/aplusb-15.in index 7a8f027..32ce837 100644 --- a/examples/aplusb/tests/aplusb-15.in +++ b/examples/aplusb/tests/aplusb-15.in @@ -1 +1 @@ -1394085777 1353065269 +1405884291 2082194543 diff --git a/examples/aplusb/tests/aplusb-15.ok b/examples/aplusb/tests/aplusb-15.ok index cece230..275004c 100644 --- a/examples/aplusb/tests/aplusb-15.ok +++ b/examples/aplusb/tests/aplusb-15.ok @@ -1,2 +1,2 @@ 5 -2747151046 +3488078834 diff --git a/examples/aplusb/tests/aplusb-16.in b/examples/aplusb/tests/aplusb-16.in index 7a8f027..32ce837 100644 --- a/examples/aplusb/tests/aplusb-16.in +++ b/examples/aplusb/tests/aplusb-16.in @@ -1 +1 @@ -1394085777 1353065269 +1405884291 2082194543 diff --git a/examples/aplusb/tests/aplusb-16.ok b/examples/aplusb/tests/aplusb-16.ok index cece230..275004c 100644 --- a/examples/aplusb/tests/aplusb-16.ok +++ b/examples/aplusb/tests/aplusb-16.ok @@ -1,2 +1,2 @@ 5 -2747151046 +3488078834 diff --git a/examples/aplusb/tests/aplusb-17.in b/examples/aplusb/tests/aplusb-17.in index 7a8f027..32ce837 100644 --- a/examples/aplusb/tests/aplusb-17.in +++ b/examples/aplusb/tests/aplusb-17.in @@ -1 +1 @@ -1394085777 1353065269 +1405884291 2082194543 diff --git a/examples/aplusb/tests/aplusb-17.ok b/examples/aplusb/tests/aplusb-17.ok index cece230..275004c 100644 --- a/examples/aplusb/tests/aplusb-17.ok +++ b/examples/aplusb/tests/aplusb-17.ok @@ -1,2 +1,2 @@ 5 -2747151046 +3488078834 diff --git a/examples/aplusb/tests/aplusb-18.in b/examples/aplusb/tests/aplusb-18.in index 7a8f027..ca06237 100644 --- a/examples/aplusb/tests/aplusb-18.in +++ b/examples/aplusb/tests/aplusb-18.in @@ -1 +1 @@ -1394085777 1353065269 +1405901098 217186145 diff --git a/examples/aplusb/tests/aplusb-18.ok b/examples/aplusb/tests/aplusb-18.ok index cece230..9391515 100644 --- a/examples/aplusb/tests/aplusb-18.ok +++ b/examples/aplusb/tests/aplusb-18.ok @@ -1,2 +1,2 @@ 5 -2747151046 +1623087243 diff --git a/examples/aplusb/tests/aplusb-19.in b/examples/aplusb/tests/aplusb-19.in new file mode 100644 index 0000000..ca06237 --- /dev/null +++ b/examples/aplusb/tests/aplusb-19.in @@ -0,0 +1 @@ +1405901098 217186145 diff --git a/examples/aplusb/tests/aplusb-19.ok b/examples/aplusb/tests/aplusb-19.ok new file mode 100644 index 0000000..9391515 --- /dev/null +++ b/examples/aplusb/tests/aplusb-19.ok @@ -0,0 +1,2 @@ +5 +1623087243 diff --git a/examples/aplusb/tests/aplusb-2.in b/examples/aplusb/tests/aplusb-2.in index a0718a1..3cb1cbe 100644 --- a/examples/aplusb/tests/aplusb-2.in +++ b/examples/aplusb/tests/aplusb-2.in @@ -1 +1 @@ -1394068970 1070590020 +1405867484 1799719294 diff --git a/examples/aplusb/tests/aplusb-2.ok b/examples/aplusb/tests/aplusb-2.ok index 98ce6b8..4919a58 100644 --- a/examples/aplusb/tests/aplusb-2.ok +++ b/examples/aplusb/tests/aplusb-2.ok @@ -1,2 +1,2 @@ 5 -2464658990 +3205586778 diff --git a/examples/aplusb/tests/aplusb-3.in b/examples/aplusb/tests/aplusb-3.in index a0718a1..3cb1cbe 100644 --- a/examples/aplusb/tests/aplusb-3.in +++ b/examples/aplusb/tests/aplusb-3.in @@ -1 +1 @@ -1394068970 1070590020 +1405867484 1799719294 diff --git a/examples/aplusb/tests/aplusb-3.ok b/examples/aplusb/tests/aplusb-3.ok index 98ce6b8..4919a58 100644 --- a/examples/aplusb/tests/aplusb-3.ok +++ b/examples/aplusb/tests/aplusb-3.ok @@ -1,2 +1,2 @@ 5 -2464658990 +3205586778 diff --git a/examples/aplusb/tests/aplusb-4.in b/examples/aplusb/tests/aplusb-4.in index a0718a1..3cb1cbe 100644 --- a/examples/aplusb/tests/aplusb-4.in +++ b/examples/aplusb/tests/aplusb-4.in @@ -1 +1 @@ -1394068970 1070590020 +1405867484 1799719294 diff --git a/examples/aplusb/tests/aplusb-4.ok b/examples/aplusb/tests/aplusb-4.ok index 98ce6b8..4919a58 100644 --- a/examples/aplusb/tests/aplusb-4.ok +++ b/examples/aplusb/tests/aplusb-4.ok @@ -1,2 +1,2 @@ 5 -2464658990 +3205586778 diff --git a/examples/aplusb/tests/aplusb-5.in b/examples/aplusb/tests/aplusb-5.in index a0718a1..3cb1cbe 100644 --- a/examples/aplusb/tests/aplusb-5.in +++ b/examples/aplusb/tests/aplusb-5.in @@ -1 +1 @@ -1394068970 1070590020 +1405867484 1799719294 diff --git a/examples/aplusb/tests/aplusb-5.ok b/examples/aplusb/tests/aplusb-5.ok index 98ce6b8..4919a58 100644 --- a/examples/aplusb/tests/aplusb-5.ok +++ b/examples/aplusb/tests/aplusb-5.ok @@ -1,2 +1,2 @@ 5 -2464658990 +3205586778 diff --git a/examples/aplusb/tests/aplusb-6.in b/examples/aplusb/tests/aplusb-6.in index a0718a1..3cb1cbe 100644 --- a/examples/aplusb/tests/aplusb-6.in +++ b/examples/aplusb/tests/aplusb-6.in @@ -1 +1 @@ -1394068970 1070590020 +1405867484 1799719294 diff --git a/examples/aplusb/tests/aplusb-6.ok b/examples/aplusb/tests/aplusb-6.ok index 98ce6b8..4919a58 100644 --- a/examples/aplusb/tests/aplusb-6.ok +++ b/examples/aplusb/tests/aplusb-6.ok @@ -1,2 +1,2 @@ 5 -2464658990 +3205586778 diff --git a/examples/aplusb/tests/aplusb-7.in b/examples/aplusb/tests/aplusb-7.in index a0718a1..3cb1cbe 100644 --- a/examples/aplusb/tests/aplusb-7.in +++ b/examples/aplusb/tests/aplusb-7.in @@ -1 +1 @@ -1394068970 1070590020 +1405867484 1799719294 diff --git a/examples/aplusb/tests/aplusb-7.ok b/examples/aplusb/tests/aplusb-7.ok index 98ce6b8..4919a58 100644 --- a/examples/aplusb/tests/aplusb-7.ok +++ b/examples/aplusb/tests/aplusb-7.ok @@ -1,2 +1,2 @@ 5 -2464658990 +3205586778 diff --git a/examples/aplusb/tests/aplusb-8.in b/examples/aplusb/tests/aplusb-8.in index a0718a1..3cb1cbe 100644 --- a/examples/aplusb/tests/aplusb-8.in +++ b/examples/aplusb/tests/aplusb-8.in @@ -1 +1 @@ -1394068970 1070590020 +1405867484 1799719294 diff --git a/examples/aplusb/tests/aplusb-8.ok b/examples/aplusb/tests/aplusb-8.ok index 98ce6b8..4919a58 100644 --- a/examples/aplusb/tests/aplusb-8.ok +++ b/examples/aplusb/tests/aplusb-8.ok @@ -1,2 +1,2 @@ 5 -2464658990 +3205586778 diff --git a/examples/aplusb/tests/aplusb-9.in b/examples/aplusb/tests/aplusb-9.in index 7a8f027..3cb1cbe 100644 --- a/examples/aplusb/tests/aplusb-9.in +++ b/examples/aplusb/tests/aplusb-9.in @@ -1 +1 @@ -1394085777 1353065269 +1405867484 1799719294 diff --git a/examples/aplusb/tests/aplusb-9.ok b/examples/aplusb/tests/aplusb-9.ok index cece230..4919a58 100644 --- a/examples/aplusb/tests/aplusb-9.ok +++ b/examples/aplusb/tests/aplusb-9.ok @@ -1,2 +1,2 @@ 5 -2747151046 +3205586778 diff --git a/src/buildtests b/src/buildtests index aeaccf5..c54ff74 100755 --- a/src/buildtests +++ b/src/buildtests @@ -53,18 +53,7 @@ cat testmanifest | while read instr; do ################# if [ $rebuild_inputs = true ] ; then - # Build input generator - cd ingen && make -s && cd .. - - # Copy ingen/ingen.bin and incf/$1 into stage - cp ingen/ingen.bin stage/$problemname.bin - cp incf/$incf stage/$problemname.cf - - # Build input - cd stage && ./$problemname.bin && cp $problemname.in ../tests/$problemname-$nr.in && cd .. - - # Clean stage - rm stage/* + build_test_number $nr $incf fi ################### diff --git a/src/compare b/src/compare new file mode 100755 index 0000000..6a81689 --- /dev/null +++ b/src/compare @@ -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 diff --git a/src/lib b/src/lib index d9526ac..e8bf9c7 100644 --- a/src/lib +++ b/src/lib @@ -23,6 +23,28 @@ maybecp () { fi } +# Builds test number $1 with incf $2 +build_test_number () { + source problemconfig + + nr=$1 + incf=$2 + + # Build input generator + cd ingen && make -s && cd .. + + # Copy ingen/ingen.bin and incf/$1 into stage + cp ingen/ingen.bin stage/$problemname.bin + cp incf/$incf stage/$problemname.cf + + # Build input + cd stage && ./$problemname.bin && cp $problemname.in ../tests/$problemname-$nr.in && cd .. + + # Clean stage + rm stage/* 2> /dev/null + +} + # Run the binary $1 with test $2, returning the time used in timeUsed, and leaving the output file in stage/$problemname.out run_src_test () { binary=$1 @@ -45,7 +67,7 @@ run_src_test () { echo -en "Doing $testname\r" # Clean the stage - rm stage/* + rm stage/* 2> /dev/null # Copy the binary into the stage cp $binary stage/$problemname.bin