DiegoBriaares's blog

By DiegoBriaares, history, 4 years ago, In English

Locju — Local Judge

Locju is a console controlled software, minded to test locally solutions to competitive programming problems.

It allows you to judge a C/C++ code, using sample testcases. Your code can throw Accepted, Wrong Answer, Runtime Error, Time Limit Exceed or Compilation Error as a verdict.

Locju also has a test case finder functionality. You must write a generator, correct solution and a validator (if needed) to use this function. What it does, is generate a number of testcases and report the verdict for each of them (by comparing with correct solution output). So you can find those testcases in wich your code fails.

Furthermore, it has a functionality to download test cases of a given Codeforces Round.

Index

  1. Requisites
  2. Installation
  3. Usage
  4. Technology Used
  5. Testing

Requisites

  • A Windows version greater or equal than 8.1

Installation

  1. Download this repository https://github.com/DiegoBriaares/Locju or directly from here: https://drive.google.com/file/d/1z7bUH-hIEbinCTq9J7nut2YLi9H-ckYM/view?usp=sharing
  2. Put Locju folder inside C:. So you will have a C:\Locju Directory.
  3. Add C:\Locju to your path environment variables, you can do this as follows:
    1. Go to Control Panel.
    2. Open advance system settings.
    3. Select Environment Variables.
    4. In the Edit System Variable window, add C:\Locju

Usage

  • A Locju environment consists of four folders and a cpp file: tests, correct_solution, generator, validator and sol.cpp.
    • tests contains inside the problem test cases (with inT.in and outT.out format, T is a positive integer number, wich stands for the test case number), and also contains a folder time-limit
      • inT.in is the test case input (ex: in1.in)
      • outT.out is the test case output (ex: out1.out)
      • time-limit contains inside the file time-limit.out, wich contains a positive number, the time limit for the problem.
    • correct solution contains a cpp file correct_solution.cpp, which must have a correct solution for the problem (brute force maybe)
    • generator contains a cpp file generator.cpp, which must have a test case generator (ideally random, and generating small test cases that brute force can take)
    • validator contains a cpp file validator.cpp, which tests the correctness of your output. You must read the input (with standard cin or scanf) in the following order:
      • Read input from test case
      • Read output from correct solution (for the readed test case)
      • Read output from your code (for the readed test case)
    • sol.cpp this is the cpp file that contains your solution to the problem.
    • NOTE1: You must not rename the files listed previously
    • NOTE2: You can add test cases inside \tests but respecting the format (if you add inT.out and outT.out, there also must be inside in(T-1).in and out(T-1).out (except for in0.in and out0.in))
  • Listed below are the commands that Locju allows you to use in the console. In order to use them, go to your project folder in the console (ex: C:\users\Briaares\Desk\Codeforces)
    • locju start creates a Locju environment in your current directory.



    • locju startcf asks for a Codeforces Round, wich is the one that appears on the round link, and it create directories with the format \RoundName\ProblemIndex (ex: \707-Div-2\A) and inside each directory, a Locju environment.









    • locju judge Judge your solution with the test cases inside \tests.



    • locju validatorjudge Judge your solution with the test cases inside \tests using \validator\validator.cpp (useful when there can be several answers).
    • locju find asks for a number of test cases to generate, and report if it finds a Non-Accepted test case (you need to write a \correct_solution\correct_solution.cpp and a \generator\generator.cpp).



    • locju validatorfind asks for a number of test cases to generate, and report if it finds a Non-Accepted test case (you need to write a \correct_solution\correct_solution.cpp and a \generator\generator.cpp) using \validator\validator.cpp (useful when there can be several answers).
  • .

    Technology Used

    • The application is made using Python-3.9.4 and Shell scripting
    • BeautifulSoup module is used alongwith requests in Python
    • NOTE: This is my very first Shell scripting software, so the code is not the clearest.

    Testing

    The program has been tested on Windows-10, 64-bit

    Feel free to contact me at diegobriaares@gmail.com

Full text and comments »

  • Vote: I like it
  • +23
  • Vote: I do not like it