From 689327154703e644db8a17da51a455dbb31faabe Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Mon, 15 Sep 2025 18:06:41 -0400 Subject: [PATCH] feat(doc): documentation for :CP test --- doc/cp.txt | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 87 insertions(+), 2 deletions(-) diff --git a/doc/cp.txt b/doc/cp.txt index ad69836..8d8fbb8 100644 --- a/doc/cp.txt +++ b/doc/cp.txt @@ -55,6 +55,10 @@ Action Commands ~ :CP debug Compile with debug flags and run current problem. Includes sanitizers and debug symbols. +:CP test Toggle test panel for individual test case + debugging. Shows per-test results with + vim-native navigation and execution controls. + Navigation Commands ~ :CP next Navigate to next problem in current contest. @@ -235,10 +239,15 @@ Example: Setting up and solving AtCoder contest ABC324 4. Code your solution, then test: > :CP run < -5. If needed, debug: > +5. If test fails, debug individual test cases: > + :CP test +< Navigate with j/k, run specific tests with + Exit test panel with q or :CP test when done + +6. If needed, compile with debug flags: > :CP debug < -6. Move to next problem: > +7. Move to next problem: > :CP next < This automatically sets up problem B @@ -250,6 +259,82 @@ Example: Quick setup for single Codeforces problem > :CP run " Test immediately < +TEST PANEL *cp-test* + +The test panel provides individual test case debugging for competitive +programming problems, particularly useful for Codeforces where multiple +test cases are combined into single input/output files. + +Activation ~ + *:CP-test* +:CP test Toggle test panel on/off. When activated, + replaces current layout with test interface. + Toggle again to restore original layout. + +Interface ~ + +The test panel displays a list of test cases with their status and details +for the currently selected test case: > + + ┌─ Test Cases ───────────────────────────────────────────────┐ + │ 1 ✓ PASS 12ms │ + │ 2 ✗ FAIL 45ms │ + │> 3 ✓ PASS 8ms <-- current selection │ + │ 4 ? PENDING │ + │ │ + │ ── Test 3 ── │ + │ Input: │ Expected: │ Actual: │ + │ 5 3 │ 8 │ 8 │ + │ │ │ │ + │ │ + │ j/k: navigate : toggle : run a: run all │ + └────────────────────────────────────────────────────────────┘ +< + +Test Status Indicators ~ + +✓ PASS Test case passed (green) +✗ FAIL Test case failed (red) +? PENDING Test case not yet executed (yellow) +⟳ RUNNING Test case currently executing (blue) + +Keymaps ~ + *cp-test-keys* +j / Navigate to next test case +k / Navigate to previous test case + Toggle selection of current test case + Run selected test cases +a Run all test cases +r Re-run failed test cases only +c Clear all test results +q / Exit test panel (restore layout) + +Test Case Sources ~ + +Test cases are loaded in priority order: +1. Individual scraped test cases (preferred for Codeforces) +2. Combined input/output files from io/ directory (fallback) + +For Codeforces problems, the plugin attempts to parse individual test +cases from the scraped contest data, enabling precise debugging of +specific test case failures. + +For AtCoder and CSES problems, which typically provide single test +cases, the combined input/output approach is used. + +Execution Details ~ + +Each test case shows: +• Input data provided to your solution +• Expected output from the problem statement +• Actual output produced by your solution +• Execution time in milliseconds +• Error messages (if execution failed) + +Test cases are executed individually using the same compilation and +execution pipeline as |:CP-run|, but with isolated input/output for +precise failure analysis. + FILE STRUCTURE *cp-files* cp.nvim creates the following file structure upon problem setup: