Created AtCoder test tool for Python

Introduction

image.png

When solving the AtCoder problem and checking the operation with the input / output sample test Copying by hand and checking the output ... It takes a lot of time to repeat. In particular, it affects the correct answer time for 100-200 points questions.

To reduce this, I created a tool that automatically tests by giving a set of input / output data.

Source

https://github.com/mui-nyan/atcoder_testtool

Introduction

actest_python() {
    bash ~/Documents/dev/atcoder_testtool/actest_python.sh $1 $2
}

How to use

image.png

Create a data file in the same directory as the source file you want to test. Here, the file name is ʻinput. The format of the data file is as follows: input --- output ===` is repeated.

Input 1
---
Output 1
===
Input 2
---
Output 2
===

(=== is required after the last output)

If you execute ʻactest_python` and give the source file name and data file as arguments, it will be tested in order.

$ actest_python B.py input
AC 91ms Expect: 2 Actual: 2
AC 92ms Expect: 0 Actual: 0
AC 91ms Expect: 5 Actual: 5

This is a display sample when the answer is incorrect or the time limit is exceeded. The time limit is fixed at 2 seconds.

$ actest_python B.py input
WA 96ms Expect: 2 Actual: 3
TLE 2192ms Expect: 0 Actual: 0
AC 91ms Expect: 5 Actual: 5

I want to enjoy creating data files

The test is easy, but creating the data file is still a hassle, so I also made a tool to help create the data file.

It's also included on GitHub above, but this is it.

javascript: (function(){ let ans = ""; let i=0; while($(`.lang-ja #pre-sample${i}`).length > 0) { const input = $(`#pre-sample${i}`).html().trim(); const expect = $(`#pre-sample${i+1}`).html().trim(); ans += input + "\n---\n" + expect + "\n===\n"; i += 2; } console.log(ans); navigator.clipboard.writeText(ans); })();

Bookmark this ...

image.png

Run on the question page ...

image.png

When pasted,

image.png

You can create a data file!

result

happy!

Recommended Posts

Created AtCoder test tool for Python
Python template for Codeforces-manual test-
Install Cheminformatics Tool RDKit for Python
I touched the latest automatic test tool "Playwright for Python"
AtCoder: Python: Daddy the sample test.
atCoder 173 Python
Python visualization tool for data analysis work
Python environment tool comparison chart for Rubyist
AtCoder cheat sheet in python (for myself)
A tool for easily entering Python code
I created a password tool in Python.
Atcoder standard input set for beginners (python)
2016-10-30 else for Python3> for:
python [for myself]
AtCoder ABC 174 Python
AtCoder ABC187 Python
AtCoder ABC188 Python
Python Integrity Test
AtCoder ABC 175 Python
Created a Python wrapper for the Qiita API
Created a header-only library management tool for C / C ++
Daily AtCoder # 36 in Python
Daily AtCoder # 32 in Python
About Python for loops
Primality test by Python
Primality test with Python
Daily AtCoder # 6 in Python
Daily AtCoder # 18 in Python
Daily AtCoder # 53 in Python
Tool to make mask image for ETC in Python
Daily AtCoder # 7 in Python
Daily AtCoder # 24 in Python
Daily AtCoder # 37 in Python
Solve AtCoder 167 with python
Daily AtCoder # 8 in Python
Daily AtCoder # 42 in Python
Daily AtCoder # 21 in Python
Daily AtCoder # 17 in Python
Daily AtCoder # 38 in Python
Daily AtCoder # 54 in Python
Daily AtCoder # 11 in Python
Daily AtCoder # 15 in Python
Daily AtCoder # 13 in Python
Python basics 8 numpy test
Daily AtCoder # 45 in Python
Python test package memo
Daily AtCoder # 30 in Python
Daily AtCoder # 40 in Python
About Python, for ~ (range)
Daily AtCoder # 10 in Python
Primality test with python
Daily AtCoder # 5 in Python
Daily AtCoder # 28 in Python
Daily AtCoder # 39 in Python
python textbook for beginners
Automate AtCoder submission (Python)
Daily AtCoder # 20 in Python
Refactoring tools for Python
Daily AtCoder # 19 in Python
Daily AtCoder # 52 in Python
Daily AtCoder # 3 in Python