ngnkcart icon indicating copy to clipboard operation
ngnkcart copied to clipboard

table.tsv as test cases

Open ktye opened this issue 3 years ago • 3 comments

i suggest we use a format that allows the table to be tested automatically.

  • add a column OUTPUT instead of arrow ->.
  • allow multiple test cases/examples per entry, e.g. in subsequent lines with emtpy SYNATX + NAME.
  • a description for the test may follow the example with a normal comment, e.g. +/1 2 3 /sum integers

then ngn can include the table in his unit tests.

some values may be predefined in global variables, e.g. a nested list, a dict, a table to have shorter examples.

ktye avatar May 20 '22 10:05 ktye

I'm seriously considering your way.

There are several restrictions. First of all, tsv must be in one line for each column, and for code with some side effects, we may write some pseudocode in tsv. This will interfere with the generation of test files.

So I think this should be a separate script, that is, we do not interfere with the design of table.csv, but we need another script to generate test files from tsv, which may be a long-term goal.

secwang avatar May 20 '22 13:05 secwang

It looks like updating my last few contributions broke the formatting of the table. In addition to making the code look right it might be worth checking that as well. I’m not sure what GitHub uses to do the linting, but if we could find that it might be worth adding some GitHub actions.

gitonthescene avatar May 22 '22 12:05 gitonthescene

Github uses a strange csv to format tsv. Some quotes will break format, but it's okay now. I have found a way to solve this format problem. As for testcase and github action, it will be our long-term goal.

secwang avatar May 23 '22 13:05 secwang