Skip to main content

A command line tool for media editing

Project description

CODE_TESTER

contributions welcome Open Source Love Build Status HitCount

Code_tester is a command-line code testing tool used to test your codes against codes of your friends/brute-force code.

Installation

Build from Source

  • git clone https://github.com/srbcheema1/code_tester
  • cd code_tester
  • python3 setup.py install --user

Install using pip

linux and mac users
python3 -m pip install --user code_tester

Don't forget ~/.local/bin should be in your PATH. Add line export PATH=$PATH="~/.local/bin" in your .bashrc

windows users

for windows users you should have python3 installed in your system

python3 -m pip install --user code_tester

Usage

srb@srb-pc:$ code_tester --help
usage: code_tester [-h] [-f FILE] [-o OTHER] [-t TEST] [-i ID] [-n NUM]
                   [-s SEC] [-c]
                   [legacy [legacy ...]]

positional arguments:
  legacy                legacy way of args

optional arguments:
  -h, --help            show this help message and exit
  -f FILE, --file FILE  Input file name, ex: one.cpp
  -o OTHER, --other OTHER
                        Other input file name, ex: brute.cpp
  -t TEST, --test TEST  Test generator, ex: testgen.py
  -i ID, --id ID        Unique_id, ex: 111
  -n NUM, --num NUM     Maximum number of test cases, ex: 1000
  -s SEC, --sec SEC     Maximum time in seconds for a test file, ex: 4
  -c, --clean           Clean the files generated by tester

Argument --test may contain a testcase-generator which outputs a testcase OR a custom testcase txt file.

srb@srb-pc:$ code_tester -f one.cpp -o brute_one.cpp -t testgen.py -n 500
tested 100
tested 200
tested 300
tested 400
tested 500
passed 500 testcases

srb@srb-pc:$ code_tester wrong.cpp brute.cpp testgen.py
Difference detected in outputs
---------Failed Test Case----------
10 11 4
1 0 0 0 0 0 0 1 1 1
!?!!?!?!!!!

---------End of Test Case----------
first difference in line 3
+---+-----------+-----------+
| # | wrong.cpp | brute.cpp |
+---+-----------+-----------+
| 1 | 2         | 2         |
| 2 | 4         | 4         |
| 3 | 3         | 4         |
+---+-----------+-----------+

Smart enough

  • smart enough to detect that 1 is same as 1.0
  • able to detect and ignore difference of less than 1e-6 in float values
  • able to ignore trailing white spaces
srb@srb-pc:$ code_tester wrong.cpp brute.cpp testgen.py
Difference detected in outputs
---------Failed Test Case----------
10
5 1
13 9
15 2
11 10
16 2
18 9
17 16
13 2
16 16
19 16

---------End of Test Case----------
first difference in line 8
+----+-------------+-----------+
| #  | wrong.cpp   | brute.cpp |
+----+-------------+-----------+
| 1  | 0.33333333  | 0.3333333 |    ignore percision differences smaller than 1e-6
| 2  | 1.00000000  | 1         |    it will detect values are same in 1.0, 1.000 and 1
| 3  | 0.25000000  | 0.2500000 |
| 4  | 1.00000000  | 1         |
| 5  | 0.25000000  | 0.2500000 |
| 6  | 1.00000000  | 1         |
| 7  | 0.14285714  | 0.1428571 |    this line is not marked as diff(smart to detect negligible change)
| 8  | 0.33333333  | 0.2500000 |    this one is 7th line which actually differs
| 9  | 1.00000000  | 1         |
| 10 | 1.00000000  | 1         |
+----+-------------+-----------+

Supported Languages

  • c++
  • c
  • python3
  • java
  • ruby

Contact / Social Media

Github LinkedIn Facebook

Developed by

Developer / Author: Srb Cheema

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

code_tester-0.0.7.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

code_tester-0.0.7-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file code_tester-0.0.7.tar.gz.

File metadata

  • Download URL: code_tester-0.0.7.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.2

File hashes

Hashes for code_tester-0.0.7.tar.gz
Algorithm Hash digest
SHA256 b9da0e120825d741f253552b7d66305edfd4601c0dd95edeedf41864c8971e92
MD5 5c5302a0ea808c90e50e07ea748e355f
BLAKE2b-256 76af5322839b3b68603974fc8c3f657c262f21bfca08ab236a5113e72f6844e9

See more details on using hashes here.

File details

Details for the file code_tester-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: code_tester-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.2

File hashes

Hashes for code_tester-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 783509cfd3f5fd2c2051f49c83cf9f3e882df0d300f9115d93789666859db3bc
MD5 ee1567475de99d63933733430d3e6be5
BLAKE2b-256 a1fd84530d1ffb11590734b397afca8e68234799708c2aa4adeb90a0cccce8fe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page