Skip to content

7oSkaaa/Stress_Testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Strees_Testing



Stress.py

Windows and Linux Users

Strees Testing is very important for every competitive programming to know if your code is accurated 100% or not, and if you want to know if it will be passed in the time limit or will exceeded it

You can Use it to test your code if it will passed in the time or will get TLE.

Requirements

Install python3

Installing

Download this repository manually or by using git clone on terminal.

Copy your original solution which you expect might fail in the file Test.cpp.
Copy your brute force solution which is expected to give correct output in the file Correct.cpp.
Change the Generated.cpp file so as to generate test cases according to the question.
Generated.cpp will export the test cases to the input.txt file

You can run Strees.py from the terminal or you can run with vscode or any IDE

Changing number of test cases

The script will ask you to enter the number of testcases

Output:
The output of running file Strees.py on every test case is either Accepted if your solution's output matches the brute solution output or Wrong Answer and will show the input on which the solution failed, the output of your solution and expected output according to the brute force solution on terminal and the script will be terminated. Now you can debug your original solution and check where it goes wrong.
If you wish to terminate the script at any moment you wish use the command ctrl + c in your terminal.

Change the time limit

The script will ask you to enter the time limit in seconds and the script will terminate if your solution will exceed the time limit

Custom Checker

The script will ask you if you want to use a custom checker, if you want to use a custom checker you can write your checker in the file Checker.cpp and the script will use it to check your solution output, if you want to use the default checker just press Enter and the script will use the default checker



Quick Demo: below the solution fails on randomly generated test #3:


Screenshot from 2022-02-13 21-47-31

Stress.sh

Linux Users Only

Strees Testing is very important for every competitive programming to know if your code is accurated 100% or not, and if you want to know if it will be passed in the time limit or will exceeded it

Installing

Download this repository manually or by using git clone on terminal.

Copy your original solution which you expect might fail in the file Test.cpp.
Copy your brute force solution which is expected to give correct output in the file Correct.cpp.
Change the Generated.cpp file so as to generate test cases according to the question.
Generated.cpp will export the test cases to the input.txt file

You can run Strees.sh from the terminal or you can run with vscode or any IDE

Changing number of test cases

You can open Strees.sh an choose the number of test cases by editing the line 21

Output:
The output of running file Strees.sh on every test case is either Accepted if your solution's output matches the brute solution output or Wrong Answer and will show the input on which the solution failed, the output of your solution and expected output according to the brute force solution on terminal and the script will be terminated. Now you can debug your original solution and check where it goes wrong.
If you wish to terminate the script at any moment you wish use the command ctrl + c in your terminal.

Install Notify-Send

We will install notify-send to send to us notification with accepted or wrong answer

sudo apt-get install notify-osd



Quick Demo: below the solution fails on randomly generated test #10:






Time.sh

Linux Users Only

Copy your solution which you want to check about his time to Test.cpp.
Change the Generated.cpp file so as to generate test cases according to the question.

Changing number of test cases

You can run Time.sh from the terminal or you can run with vscode or any IDE You can open Time.sh an choose the number of test cases by editing the line 10

The Time.sh will excecute Test.cpp the number of times you want and print you the time that your code take and each time with distinct test

Quick Demo: below the solution times on randomly generated test:

image


If you will use Generator.cpp file, these information will help you to use it.

  • Choose number of file you want to print in line 134
  • Choose number of test cases in each file from line 131
  • If your problem has a single test case uncomment line 130

there are many functions to help you to generate test like:

  • gen_string

    • generate a string Upper Case or Lower Case and in any range you want with your length
  • gen_string_u_and_l

    • generate a string Upper Case and Lower Case and in any range you want with your length
  • gen_int

    • generate a integer number in the range you want from L to R
  • gen_palindrome

    • generate a palindrome string with your length in the range that you want
  • gen_array

    • generate an array with your size and in range you want, you can make the array normal or increasing or decreasing
  • gen_array_2D

    • generate an array_2D with your size and in range you want.
  • gen_permutation

    • generate an array with a permutation of N
  • gen_bit_int

    • generate a string with your length consit of digit in the range that you want
  • gen_array_of_pairs

    • generate an array of pairs with your length in the range that you want, you can choose if the pair is interval or not.
  • gen_char

    • gen character in range that you want
  • gen_tree

    • generate a tree or bamboo like tree or star like tree
  • gen_graph

    • generate a simple graph

The test cases files will exported in Tests folder in the same directory of the Generator.cpp file