Giter VIP home page Giter VIP logo

testcase-generator's Introduction

Testcase Generator

Handy script to generate Test Cases for HackerRank, HackerEarth and CodeChef Problems

Are you a Problem Author? The toughest part of creating a problem is creating tricky, correct and constrained Test Cases. Well, here is a handy Python Script, for your respective logic (solution).

Table of Contents

Mentions

  • Blog post on experince in NWoC 2018 by Rounak Agarwal.
  • Selected as project in GSSoC 2019
  • Selected as project in NJACKWinterOfCode 2018

Supported Languages

The following languages are supported for testcase generation:

Install

How to Use ? 😃

  • Clone the repository $ git clone https://github.com/aashutoshrathi/Testcase-Generator.git

  • Create a virtual environment $ virtualenv venv (click here to read about activating virtualenv)

    • Activate virtualenv (Linux)

      $ source ./venv/bin/activate
    • Activate virtualenv (Windows)

       $ cd venv/Scripts/
       $ activate
  • Install requirements and modules

   $ pip install -r requirements.txt
   $ pip install -e .
  • Change directory to tc_generator
   $ cd tc_generator/
  • Edit the logic file of the language of your choice with the code for which you want to generate TCs NOTE: Make sure to keep the classname as 'logic' in java so that it can compile to 'logic.class'
  • Edit the Input area in tc_gen.py according to the input format you wish to generate
  • Run the project
   $ python tc_gen.py
  • Enter your choice of language when prompted
  • Enter the choice of platform when prompted
  • The input and output files would be generated and stored in test-cases.zip for HackerRank & HackerEarth and test-cases directory for CodeChef.

Tip: If you're creating testcases for CodeChef then you can validate that the input sequence is generated according to the constraints using this validator file. 😉

How it Works ? 🤔

Demo

Setup using Docker 🐳

  docker build . --tag=tcgen
  docker run -p 4000:80 tcgen

Running Tests ✅

  • Change Directory to Testcase-Generator
  $ cd Testcase-Generator/
  • Install requirements and modules
   $ pip install -r requirements.txt
   $ pip install -e .
  • Run pytest
  $ pytest
  • If no tests fail, the generator is working correctly.

FAQ 📃

  1. How do I compile with a different version of C++? Changing Line 22 in lang_compiler.py to the line below will compile the file with C++ 17. You can replace the '17' with '11', '14' or '20' in the line below to compile with the respective versions.
'compile': ['g++', f'{CMD}.cpp', '-o', CMD, '-std=c++17']},
  1. What line ending does it saves the testcases in? It saves the files with Linux style file endings (LF) in both Linux and Windows (unless the file is opened and saved again in WIndows that may change it to CRLF).

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Aashutosh Rathi

🔧 📆 👀 🐛 💻

Pushkar Patel

🚧 ⚠️ 🐛 💻

Pritha Upadhyay

🚧 ⚠️ 🐛 💻

Vishnu Ramana

📖

Tim Rossback

📖

Sasivarnan R

📖

Gerardo Gálvez

💻

Dastgir

📖

Sai Adarsh S

📖

Rounak Agarwal

💻 📝

This project follows the all-contributors specification. Contributions of any kind welcome!

Stargazers over time 📈

Stargazers over time

Made with ❤ by Aashutosh Rathi

testcase-generator's People

Contributors

aashutoshrathi avatar dependabot-preview[bot] avatar dependabot[bot] avatar thepushkarp avatar prithaupadhyay avatar dastgirp avatar gerardogalvez avatar sai-adarsh avatar sasivarnan avatar vishnuramana avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.