ランダムな入力でのテストで、失敗した入力をファイルに保存し、tests/cases/ に移せるようにする

Open
#263 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
github-actions, python
Domain
ci-cd, testing

Research direction

Start with converters/tests/run_random_tests.py, especially the failure reporting and MAXIMUM_LENGTH, then inspect the repository’s CI workflow for its artifact upload steps. Save each failing input and both expected outputs as raw bytes, and report the case number and saved paths. Done when failures can be copied into tests/cases/ and CI retains the saved files as artifacts.

Written by the indexing model from the issue text.

Description

enhancement

解決したい課題

converters/tests/run_random_tests.py の docstring(11〜12行目)は「失敗したときは、再現に使う乱数の種と入力を表示する。固定のケースにしたい場合は、その入力を tests/cases/ に追加する」としています。しかし失敗の表示は、入力を {data!r:.200} で先頭 200 文字に切っています(123・129・135・139・151行目)。

入力は最大 70,000 文字(MAXIMUM_LENGTH、59行目)なので、長い入力での失敗(読み込みの区切りをまたぐ場合など、このテストで狙っている失敗)は、表示からは入力を取り出せません。乱数の種を指定すれば同じ入力の列を作り直せますが、何件目の入力かは表示されないため、手で取り出すのは手間です。

望ましい動作

  • 失敗した入力を、そのままのバイト列でファイルに保存する(例: RANDOM_FAILURES_DIR で指定した場所、既定は一時ディレクトリー)。期待した出力(to_comma_period.txt・to_touten_kuten.txt)も同じ形で保存し、tests/cases/<名前>/ にそのまま移せるようにする
  • 表示には、何件目のケースか(RANDOM_SEED と組み合わせて再現できる番号)と、保存したパスを出す
  • CI では、保存したファイルを成果物(actions/upload-artifact)として残す

(2026-11-04 のコードレビューで起票。#122 のブランチ night/additive-improvements-2026-10-22(5e0ecaf)のコードを読んで確認したもので、#122 がマージされた後の main に当たる。既存の Issue と重複しないもの。行番号はこの時点のもの)

Dominant language
C#
Stars
0
Forks
3
Avg merge
11h 52m
Merged PRs (30d)
26

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Sh1n1230/PunctuationToggle

All issues in Sh1n1230/PunctuationToggle

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.