Competitive Programming Stress Test Tools

Overview

MIT License Rust xryuseix xryuseix

Competitive Programming Stress Test Tools

競技プログラミング用 ストレステストツール

このプログラムの役割

  1. Wrong Answer のプログラムに対して,それより実行時間がかかるが確実に Accepted できる愚直プログラムと比較することで, Wrong Answer となるテストケースを探し出す
  2. 最大コーナーケースに対して,実行時間以内に Accepted ができるかテストをする

デモンストレーション

インストール

git clone https://github.com/xryuseix/CPSTT
cd CPSTT
cargo install --path .
cd test # または以下に記す設定を行う(推奨)
cpstt # 実行

必要なディレクトリ構成

test ディレクトリを参考に,以下のファイル/ディレクトリを作成してください.なお,cpstt_out/内のディレクトリとtestcase/は自動で生成されます.

/path/to/YourCodingDirectory
|--cpstt_out/
| |--bin/
| |--smart/
| |--stupid/
|--generator.cpp
|--settings.toml
|--smart.cpp
|--stupid.cpp
|--testcase/

各入力ファイルの説明

generator.cpp

  • テストケースを作成するプログラム
  • ofsに出力した内容がそのままテストケースとなる.init関数を除いて,icpc-jag/rimeと同じように記述可能
  • 以下のように記述すれば良い
#include <fstream>
#include <iostream>
using namespace std;

string root_path = "";

void init(int argc, char *argv[]) {
    srand((unsigned)(time(NULL)));
    for (int i = 1; i < argc; i++) {
        root_path += std::string(argv[i]);
    }
}

// aとbをファイルストリームに出力する
// ファイル名は prefix_num.in (ex: 00_sample_00.in)
void output(int a, int b, const string &prefix, const int num) {
    char name[100];
    sprintf(name, "%s/testcase/%s_%02d.in", root_path.c_str(), prefix.c_str(),
            num);
    ofstream ofs(name);
    /* ここから書き換える */
    ofs << a << " " << b << endl;
    /* ここまで */
    ofs.close();
}

int main(int argc, char *argv[]) {
    init(argc, argv);
    /* ここから書き換える */
    output(0, 0, "0_sample", 0);
    output(0, 1, "0_sample", 1);
    output(1, 0, "0_sample", 2);
    output(1, 1, "0_sample", 3);
    /* ここまで */
}

参考プログラム

smart.cpp

  • 競技プログラミングの問題を解くプログラムのここに記述する
  • stupid.cpp と入れ替えても良いが,名前の通り効率の良いプログラムを記載することを推奨する

参考プログラム

stupid.cpp

  • 競技プログラミングの問題を解くプログラムのここに記述する
  • smart.cpp と入れ替えても良いが,名前の通り効率の悪いプログラムを記載することを推奨する

参考プログラム

settings.toml

  • 本プログラムの設定ファイル
  • 使い方はコメントの通り
[execution]
# ユーザプログラム実行結果の最大表示文字数
max_output_len = 200
# ユーザプログラム実行結果の最大表示行数
max_output_line = 4
# ユーザプログラムのTime Limit(ms)
time_limit = 2200
# 実行形式ファイルの拡張子
bin_extension = "out"

[logging]
# ユーザプログラム実行結果の表示有無
dump_exe_result = false

参考ファイル

各入力ディレクトリの説明

cpstt_out/

smart.cppstupid.cpp が出力した実行結果と,生成したバイナリファイルを保存する

cpstt_out/smart/

smart.cpp が出力した実行結果を保存する

cpstt_out/stupid/

stupid.cpp が出力した実行結果を保存する

cpstt_out/bin/

stupid.cpp, smart.cpp, generator.cpp をコンパイルしたバイナリファイル保存する

testcase/

generator.cpp の出力先 (テストケースの保存先)

You might also like...
Fixture-based test framework for Rust

Fixture-based test framework for Rust Introduction rstest uses procedural macros to help you on writing fixtures and table-based tests. To use it, add

a test harness for embedded devices

defmt-test a test harness for embedded devices This crate has been moved to the defmt repository Support defmt-test is part of the Knurling project, F

Nextest is a next-generation test runner for Rust.

nextest Nextest is a next-generation test runner for Rust. For more, check out the website. This repository contains the source code for: cargo-nextes

Test cargo crates in different envs & via different methods
Test cargo crates in different envs & via different methods

Test cargo crates in different envs & via different methods

Hopper is a tool for generating fuzzing test cases for libraries automatically using interpretative fuzzing.

Hopper Hopper is an tool for generating fuzzing test cases for libraries automatically using interpretative fuzzing. It transforms the problem of libr

Hopper is a tool for generating fuzzing test cases for libraries automatically using interpretative fuzzing.

Hopper Hopper is an tool for generating fuzzing test cases for libraries automatically using interpretative fuzzing. It transforms the problem of libr

`mutatis` is a library for writing custom, structure-aware test-case mutators for fuzzers in Rust.

mutatis Easily create custom, structure-aware mutators for fuzzing. Repository | Docs | Guide | Contributing About The most popular fuzzers — includin

Verdun is a HTTP stress-test/benchmark tool written in Rust.
Verdun is a HTTP stress-test/benchmark tool written in Rust.

Verdun is a HTTP stress-test/benchmark tool written in Rust. 🦀 It supports testing a single URL, loading multiples URLs from a file or automatically navigating a website (auto discovery)

Tiny CLI for submitting large calldata transactions to EVM networks to stress test the networking layer. Main motivation: EIP4844blobs.

stress4844 Tiny CLI for submitting large calldata transactions to EVM networks to stress test the networking layer. Main motivation: EIP4844 blobs. ca

Tiny CLI for submitting large calldata transactions to EVM networks to stress test the networking layer

Tiny CLI for submitting large calldata transactions to EVM networks to stress test the networking layer. Main motivation: EIP4844blobs.

Generic parser for competitive programming

This is a generic parser for competitive programming, it can be used to read structured data line-by-line or though derive macro in a higher level fashion.

Common data structures and algorithms for competitive programming in Rust
Common data structures and algorithms for competitive programming in Rust

algorithm-rs algorithm-rs is common data structures and algorithms for competitive programming in Rust. Contents TBA How To Contribute Contributions a

ABQ is a universal test runner that runs test suites in parallel. It’s the best tool for splitting test suites into parallel jobs locally or on CI

🌐 abq.build   🐦 @rwx_research   💬 discord   📚 documentation ABQ is a universal test runner that runs test suites in parallel. It’s the best tool f

⚙️ A curated list of static analysis (SAST) tools for all programming languages, config files, build tools, and more.
⚙️ A curated list of static analysis (SAST) tools for all programming languages, config files, build tools, and more.

This repository lists static analysis tools for all programming languages, build tools, config files and more. The official website, analysis-tools.de

A competitive and fun crossword game written in Rust.

Worders Crossword Game Worders is a competitive and fun crossword game where you create words using your given letters in order to score points, when

Rustress - stress testing library in Rust. For fun

rustress Simple network stress testing library. To get familiar with Rust Planned features (Subject to change) Multithreaded client/server Throughput

Coppers is a custom test harnass for Rust that measures the energy usage of your test suite.
Coppers is a custom test harnass for Rust that measures the energy usage of your test suite.

Coppers Coppers is a test harness for Rust that can measure the evolution of power consumptions of a Rust program between different versions with the

A simple tool to test sqlx with postgres. It will automatically create a database and drop it after the test.

sqlx-db-tester This a tool to test sqlx with postgres. It only supports tokio runtime at this moment. How to use it You should first create a TestDb d

Releases(v1.1.0)
Owner
Ryusei Ishikawa
Security / Algorithm
Ryusei Ishikawa
Rustress - stress testing library in Rust. For fun

rustress Simple network stress testing library. To get familiar with Rust Planned features (Subject to change) Multithreaded client/server Throughput

Hakan Sönmez 7 Sep 22, 2022
Travis CI and AppVeyor template to test your Rust crate on 5 architectures and publish binary releases of it for Linux, macOS and Windows

trust Travis CI and AppVeyor template to test your Rust crate on 5 architectures and publish binary releases of it for Linux, macOS and Windows Featur

Jorge Aparicio 1.2k Dec 30, 2022
Test social media cards locally

Share Preview Test social media cards locally Description Preview and debug websites metadata tags for social media share. Third Party Packages Distri

Rafael Mardojai CM 65 Dec 25, 2022
A heckin small test generator

heckcheck A heckin small test generator API Docs | Releases | Contributing Installation $ cargo add heckcheck Safety This crate uses #![deny(unsafe_co

Yoshua Wuyts 18 Mar 20, 2022
Cucumber testing framework for Rust. Fully native, no external test runners or dependencies.

An implementation of the Cucumber testing framework for Rust. Fully native, no external test runners or dependencies.

Brendan Molloy 394 Jan 1, 2023
atttribute macro for running a flaky test multiple times

flaky_test This attribute macro will register and run a test 3 times, erroring only if all three times fail. Useful for situations when a test is flak

Deno Land 23 Mar 23, 2022
Fluent test assertions for Rust.

This is a fork the unmaintained crate spectral. Spectral as not changed for five years and yet is still very usable, the goal of this fork is to add n

Paul Delafosse 24 Dec 20, 2022
A series of test cases to evaluate async Rust on the nrf52840 in terms of power usage and ergonomics.

A series of test cases to evaluate async Rust on the nrf52840 in terms of power usage and ergonomics. This is an experiment that uses unstable features only available on nightly rust.

Tweede golf 1 Oct 15, 2021
Test for rust-based plugin system for swc

rust-dylib-test Steps Run cargo build in plugin_a Ensure that plugin_a dynamically links to runtime/common by otool -L plugin_a/target/debug/libplugin

Donny/강동윤 1 Apr 6, 2022
Test for crate delay_timer

delay_timer-test some test for crate delay_timer crate link: https://github.com/BinChengZhao/delay-timer here some test for delay_timer,also used for

null 1 Nov 22, 2021