Open In App

Stress Testing in CppFastOlypmicCoding plugin in Sublime Text

Improve
Improve
Like Article
Like
Save
Share
Report

Stress Testing is a software testing technique that determines the robustness of software by testing beyond the limits of normal operation. Stress Testing is useful when anyone needs to find out corner test cases for problems, which work on the sample test case but get WA (wrong answer) on submission. 

Sublime Text along with Cpp​Fast​Olympic​Coding plugin provides a lot of features to ease up and expedite the process of writing and testing code for competitive programmers. Stress Testing is also one of the useful features of this plugin.

Before proceeding further with the article make sure to install the MinGW compiler and change environment variables

Install the latest version of Sublime Text from https://www.sublimetext.com/. 

Must Read – Setting up Sublime Text For Competitive Programming (C++) Using Fast Olympic Coding Plugin

Setting up Sublime Text and CppFastOlymicCoding plugin

Step 1: In Sublime Text open the command pallet by navigating to Tools -> Command Palette or using key binding Ctrl+Shift+B.

command palette in Sublime Text

 

Step 2: Type Install package control to install package controller for sublime text. The package controller helps in downloading different packages for sublime text. 

install package control

 

Package control in Sublime Text

 

Step 3: Type Package Control: Install Package in command pallet and search for C++ & C Single File Builder – Minghang Yang package.

package control

 

package control

 

Step 4: After installing select the Build System as C++ Builder Minghang Yang.

 Build System

 

Step 5: Now you can run a C++ program using the command Ctrl+B.

How to run a C++ program

 

Step 6: Type Package Control: Install Package in the command pallet and search and install Cpp​Fast​Olympic​Coding by Jatana.

Cpp​Fast​Olympic​Coding

 

How to use the Stress Testing Feature?

Step 1: For using the Stress Testing feature you need to create three files in the same director namely 

  • <name>.cpp – program that works incorrectly.
  • <name>__Good.cpp – program that works correct.
  • <name>__Generator.cpp – program that generates tests, you can read a seed for a random generator in the input

How to use the stress testing feature

 


C++




// file name format <name>.cpp  Ex: test.cpp
// This program takes input of a number and if number is
// less than 50 then prints it
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    if (n < 50)
        cout << n;
    return 0;
}


C++




// file name format <name>__Good.cpp Ex: test__Good.cpp
// this program takes input of number and then prints the
// same number
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    cout << n;
    return 0;
}


C++




// file name format <name>__Generator.cpp Ex:
// test__Generator.cpp this program generates a number
// between range 1 to 100
#include <bits/stdc++.h>
using namespace std;
int main()
{
    srand(time(0)); // seeding the rand with system time
    cout << rand() % 100 + 1; // printing number between
                              // range 1 to 100
    return 0;
}


Step 2: Navigate to the <name>.cpp file (Ex: test.cpp); Open the Command palette and type Make Stress or FastOlympicCoding: Make Stress then press enter. 

Stress Testing in CppFastOlypmicCoding plugin in Sublime Text

 

Step 3: To stop Stress Testing open Command Palette and type Stop Stress or FastOlympicCoding: Stop Stress then press enter. 



Last Updated : 01 Nov, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads