Reminder: in case of any technical issues, you can use the lightweight website m1.codeforces.com, m2.codeforces.com, m3.codeforces.com. ×

### art-hack's blog

By art-hack, history, 8 days ago, ,

Hello Everyone,

I have created a handy tool for running two codes against an input or stress testing them against random inputs. This can be helpful in hacking some simple problems and get possible faults, and also in finding wrong test cases for your solutions.

Video Showing its working

I know this isn't perfect so if you feel that I can improve something or add some feature then do let me know and feel free to contribute as well.

• +48

 » 8 days ago, # |   -13 Great, thanks! Hope you get high rated! :)
 » 8 days ago, # |   +1 You created tool by writing more than 200 lines of code for thing which you can do with few simple BASH commands? O_o Definitely the biggest bicycle invention which I saw in the last time. Mentioned BASH commandsg++ A.cpp -o a g++ B.cpp -o b python gen.py > input.txt ./a < input.txt > a_output.txt ./b < input.txt > b_output.txt diff a_output.txt b_output.txt 
•  » » 8 days ago, # ^ | ← Rev. 2 →   +24 It doesn't include multithreading and stress testing. Also, I created it as a start point and was looking for possible improvements/features with help from the community.
•  » » » 8 days ago, # ^ |   0 Hmm, it IS stress testing — comparing your solution (A.cpp) with some kind of bruteforce (B.cpp) on many random testcases (input.txt).
•  » » » » 8 days ago, # ^ | ← Rev. 2 →   +13 Here, by stress testing, I meant to keep testing until you find a case where the outputs do not match for both the inputs. To put it simply, generating random cases again and again until outputs mismatch. If you are using a really big file, then you may have to: Change the original programs to add test cases(T). Wait for the whole file input to finish to know the result. If no such case is found, recreate the test file and rerun the same thing.
•  » » » » » 8 days ago, # ^ | ← Rev. 2 →   +27 In bash: while diff a_out b_out do ./gen > inp ./a < inp > a_out ./b < inp > b_out done 
•  » » » 8 days ago, # ^ |   +1 And about multithreading: it is just useless in python because of GIL. So, actually, you don't run tests parallelly in such a way.
•  » » » » 8 days ago, # ^ | ← Rev. 2 →   0 Indeed you're correct about multithreading and thanks for that, but I can include multiprocessing to get the desired boost. I am not saying that I invented something and i am sure you can very well create a script in bash to get the desired function, the sole purpose is to share with anyone who may find it useful. You do know, that one can learn while building that already invented bicycle.
•  » » » » 7 days ago, # ^ |   0 The multithreading in this case does work, because most of the work is done in the spawned subprocesses.
•  » » » » » 7 days ago, # ^ |   0 True, trying to find a way to fix that as well.
 » 6 days ago, # |   +1 i think this can be useful ! suggestion : add tle checker