Skip to main content

Python library of IT Club PTIT HN

Project description

Mục lục

1. Tổ chức & Mô tả

2. Ví dụ sử dụng



Nội dung

1. Tổ chức & Mô tả

itptit
|
|___common
|   |___math
|   |   |___...
|   |
|   |___random
|   |   |___Random
|   |   |___...
|   |
|   |___exceptions
|       |___...
|
|___generator
|   |___TestCaseFamily
|   |___Inerator
|   |___Outerator
|
|___judge
    |___SingleJudge
    |___MultiJudge
    |___...

Mô tả

Nội dung các class và function sẽ được mô tả bởi python docstring.

2. Ví dụ sử dụng

2.1. Problem

Tính tổng các số có trong dãy n phần tử với 2 ≤ n ≤ 3.

Input Output
1 2 3
1 2 3 6

2.1. Files

  • real_solution.py

ans = 0
for i in input().split():
    ans += int(i)
print(ans)
  • submitted_solution.cpp

#include <iostream>
using namespace std;

int main(){
    int x, y;
    cin >> x >> y;
    cout << x + y;
    return 0;
}
  • gen_test_case.py

from itptit.common.math import *
from itptit.common.random import *
from itptit.generator import TestCaseFamily, Inerator, Outerator
from itptit.judge import SingleJudge

def _2_numbers(x, y):
    print(x, y)

def _3_numbers(x, y, z):
    print(x, y, z)


# Create TestCaseFamily

tcf1 = TestCaseFamily(
    gen_func=_2_numbers,
    number_of_test_cases=2,
    args_list=[
        [1, 2],
        [2, 3]
    ]
)

tcf2 = TestCaseFamily(
    gen_func=_3_numbers,
    number_of_test_cases=3,
    args_list=[
        [1, 2, 3],
        [2, 3, 4],
        [3, 4, 5]
    ],
    name='3 numbers'                # Optional argument
)

# Generate input

ig = Inerator(
    'test/input',
    tcf1,
    tcf2,
    file_extension='itqh'           # Optional argument
)

ig.start()

# Generate output

og = Outerator(
    'test/input',
    'real_solution.py',
    'test/output',
    input_file_extension='itqh',    # Optional argument
    file_extension='otqh'           # Optional argument
)

og.start()

# Judgement

judge = SingleJudge(
    'test/input',
    'test/output',
    'submitted_solution.cpp', 
    time_limit=1,                   # Optional argument
    input_extension='itqh',         # Optional argument
    output_extension='otqh'         # Optional argument
)

judge.start()
  • Run "gen_test_case.py"

Start generating input for test cases:
- New: Created file "0.itqh" successfully in 0.00000s!
- New: Created file "1.itqh" successfully in 0.00000s!
- New: Created file "2.itqh" successfully in 0.00000s!
- New: Created file "3.itqh" successfully in 0.00000s!
- New: Created file "4.itqh" successfully in 0.00050s!
All test case's inputs have been generated.

Start generating output for test cases:
- New: Created file "0.otqh" successfully in 0.07481s!
- New: Created file "1.otqh" successfully in 0.10607s!
- New: Created file "2.otqh" successfully in 0.07828s!
- New: Created file "3.otqh" successfully in 0.06917s!
- New: Created file "4.otqh" successfully in 0.07155s!
All test case's outputs have been generated.

Start judgment:
- Testcase 0."0": Accepted (AC) in 0.063s.
- Testcase 1."1": Accepted (AC) in 0.082s.
- Testcase 2."2": Wrong answer (WA).
- Testcase 3."3": Wrong answer (WA).
- Testcase 4."4": Wrong answer (WA).
  > Result: Partial (2/5).

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

itptit-1.0.1.tar.gz (21.2 kB view details)

Uploaded Source

File details

Details for the file itptit-1.0.1.tar.gz.

File metadata

  • Download URL: itptit-1.0.1.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.0

File hashes

Hashes for itptit-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d3fc79ab982773e93132a8bab589f273e4b2270b1779988081ca099d7467cf47
MD5 84917fcb38037d43124ef285febebe92
BLAKE2b-256 5fae0af6633b9aaf1ab8ae16a95f0e7cae2d8012d256d706abcc604482924bb5

See more details on using hashes here.

Supported by

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