xeluxee / competitest.nvim

CompetiTest.nvim is a Neovim plugin for Competitive Programming: it can manage and check testcases, download problems and contests from online judges and much more
GNU Lesser General Public License v3.0
381 stars 15 forks source link

Feature request: Split a test into smaller cases #34

Open TroySigX opened 1 year ago

TroySigX commented 1 year ago

For a test with multiple test cases. e.g let there be 4 test cases, and each test takes a and b as inputs:

4
1 2
2 3
4 5
5 5

Conventionally, competitest would just store this test into a single file (input0.txt), but instead, I'd like it to be broken down into smaller cases (e.g storing the tests in files input0, input1, input2, and input3), with each file in the following format:

1
a b

This makes it easier to debug while in the contest

TroySigX commented 1 year ago

Suggested solution: If the feature above cannot be achieved, there's another alternative: When editing a test with multiple test cases (example test), being able to choose a region (using visual mode) and create a new test case (using :CompetiTestAdd or something similar) based on that chosen area would be great.

xeluxee commented 1 year ago

Suggested solution: If the feature above cannot be achieved, there's another alternative: When editing a test with multiple test cases (example test), being able to choose a region (using visual mode) and create a new test case (using :CompetiTestAdd or something similar) based on that chosen area would be great.

This feature cannot be achieved because every problem has a different input structure. But there are some workaround:

  1. As you suggested, visual select a region and create a testcase
  2. Put some dashes between lines to split them into single testcases:
    4
    ----
    1 2
    ----
    2 3
    ----
    4 5
    ----
    5 5
TroySigX commented 1 year ago

Thanks @xeluxee! But what about the output, how about putting some dashes (or tickback, the symbol to the left of number 1) to seperate the testcases' output

TroySigX commented 1 year ago

Here's what I think, how about having a command :Splitcases x y, where x is the test number to be split, and y is the splitting character between the cases (in your example, y is the dashes ----).

To further enhance the experience, we should have the option to set the default splitting character y in the setup.

TroySigX commented 1 year ago

Hi, any updates on this feature?