Stress-Testing is a project that ensures the ability of a program to work correctly under predefined conditions.
it is used mostly in competitive programming and developing algorithms.
The General Problem most of programmers face
when they create an algorithm to solve specific issue they are not sure that this algorithm works correctly for all cases that may happen.
Now comes our solution.
We can create brute force code that work very slow and give him big number of test cases and compare its output with our algorithm output and see if it passes all these test cases.
- You don't have to create Code to Generate random test cases at all.
- Test Cases are Generated by given generator as you like. ( Saves more time in working )
- Random Test Cases are generated using uniformly distribution generators.
- Available Languages : C++, Java, Python.
- You can Strees test 2 Codes with different languages.
- Overflows and sigmantation fault and compilation error are detected and the program returns useful message to help you fix the issue.
- Time Limit Exceeded for the WA code ( the algorithm ) are detected and the program returns Time Limit Exceeded.
- Time Limit Exceeded for the AC code ( the bruteforce ) are detected and the program returns AC Time Limit Exceeded to tell you that the brute force are too slow to run.
- Files that are only used and only have changes are the ones who are only compiled again otherwise the program runs. ( Saves more time in working )
- Running Time of the WA code ( the algorithm ) are being measured to tell you the average running time of the algorithm.
- The program are highlited to be comfortable for the user.
- Only C++, Python and Java are available to use till now!.
- Predefined test cases that have special properties must get their own generator written from scratch.
- Memory of the running algorithm are not being measured.
- Can't use Custom Generators
git clone https://github.com/SHABRAWii/Strees-Testing.git
If you are using Windows make sure you have bash installed. For me when I have Windows Subsystem Linux (WSL) so I can use bash.
chmod +x init.sh # make init.sh file excutable
./init.sh # run init.sh and type your (WSL) password and it will install all requirements
In Stress_Test.sh file Edit these three parameters
- "TimeLimit=?" Enter the time limit for your algorithm.
- "AC_CODE=?" Enter the Accepted Code Language you will use. ( Brute Force )
- "WA_CODE=?" Enter the Wrong Answer Code Language you will use. ( Algorithm )
Note, that if you want to edit the Time limit of the Accepted Code or the Time limit of the Generator Code.
- For Accepted Code
173: inc=1000 ## This line for detemining the Generator Code Time Limit ... ## Note that both increment values are added to the predefined Time Limit Value ... ## we declared above to get the total Time Limit for each of them
- For Generator Code
184: inc=3000 ## This line for detemining the Accepted Code Time Limit ... ## Note that both increment values are added to the predefined Time Limit Value ... ## we declared above to get the total Time Limit for each of them
For the Accepted Code you have "Coding_AC" Folder Which Contains
- AC_Output.in :
This contains The Output of the Accepted Code that are being compared with the wrong one. If you got
Wrong Answer
, you can see this output and the other code output or use Sampling Comparetor which we will mention later.
- AC_Solution.class :
This is last excutable file generated from
AC_Solution.java
Don't worry about it nothing need to do here
- AC_Solution.cpp :
This is your
Accpted (Brute force)
Solution If you will use C++ Programming language.
- AC_Solution.java :
This is your
Accpted (Brute force)
Solution If you will use Java Programming language.
- AC_Solution.py :
This is your
Accpted (Brute force)
Solution If you will use Python Programming language.
- AC_Solution.spec :
This file tells PyInstaller how to process your script. Don't worry about it nothing need to do here
- dist/AC_Solution :
This is last excutable file generated from
AC_Solution.py
Don't worry about it nothing need to do here
For the Test cases Generation Proccess you have "Generator" Folder Which Contains
- Generator.in :
This where you type how you want your test case to look like. see Generator_Commands.md file for further information
- Stress_Generator.cpp :
This is Code translate your commands in
Generator.in
and Generate random test cases and put it inStress_input.in
. Don't worry about it nothing need to do here
- Stress_input.in :
This is the generated test case. If the program stops and you got Over flows or Segmentation Fault or Wrong Answer then this is the test case which your Algorithm fails in. Trace your Solution ( Algorithm ), find the mistake, try this test case again and compare your output with the Accepted Output. You will get a successfull Solution ✔️.
bash Stress_Test.sh
Please take a look at our contributing guidelines if you're interested in helping!
- adding more languages.
- Create Custom_Testing files using various languages.
- Measure used memory while the algorithm are working.