Skip to content

Commit

Permalink
move tests .csv files into tests/tests_tables/
Browse files Browse the repository at this point in the history
- update READMEs
  • Loading branch information
tomhea committed Dec 12, 2023
1 parent c7e18e4 commit 760febd
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 15 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,11 @@ _You can also use the `flipjump.assemble_run_according_to_cmd_line_args(cmd_line
- inout/ - Contains the .in and .out files for each test.
- conftest.py - The pytest configuration file. The tests are being generated here.
- test_fj.py - The base test functions for compilation and running ([how to run](tests/README.md#run-the-tests)).
- test_compile_*.csv - Arguments for the compile tests ([compile test arguments format](tests/README.md#compile-csvs-format)).
- test_run_*.csv - Arguments for the run tests ([run test arguments format](tests/README.md#run-csvs-format)).
- conf.json - The tests groups+order lists.
- xfail_*.csv - [xfail](https://docs.pytest.org/en/7.1.x/how-to/skipping.html#xfail-mark-test-functions-as-expected-to-fail) these tests.
- [tests_tables/](tests/tests_tables)
- test_compile_*.csv - Arguments for the compile tests ([compile test arguments format](tests/README.md#compile-csvs-format)).
- test_run_*.csv - Arguments for the run tests ([run test arguments format](tests/README.md#run-csvs-format)).
- xfail_*.csv - [xfail](https://docs.pytest.org/en/7.1.x/how-to/skipping.html#xfail-mark-test-functions-as-expected-to-fail) these tests.


# Read More - Extra Documentation
Expand Down
6 changes: 3 additions & 3 deletions flipjump/stl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Offers outputting constant chars/strings.

**@note**: It should be the first file in the compilation order.

### [bit/](bit/)
### [bit/](bit)
Defines the `bit` data-structure (for binary variables).

Offers macros for manipulating binary variables and vectors (i.e. numbers):
Expand All @@ -35,7 +35,7 @@ Offers macros for manipulating binary variables and vectors (i.e. numbers):
- [div.fj](bit/div.fj) - div10, {i}div, {i}div_loop (i stands for signed)
- [pointers.fj](bit/pointers.fj) - bit-vec pointers: flip, jump, xor_to, xor_from, inc/dec; pointers init

### [hex/](hex/)
### [hex/](hex)
Defines the `hex` data-structure (for hexadecimal variables).

**They are smaller and faster than 4 `bit`s.**
Expand All @@ -53,7 +53,7 @@ Offers macros for manipulating hexadecimal variables and vectors (i.e. numbers):
- [mul.fj](hex/mul.fj) - add_mul, mul (works for signed & unsigned)
- [div.fj](hex/div.fj) - div, idiv (signed)
- [tables_init.fj](hex/tables_init.fj) - initializes the "results-tables" for the next hex macros: or,and, add,sub, cmp, mul
- [pointers/](hex/pointers/) - hex-vec pointers subdirectory: [flip](hex/pointers/xor_to_pointer.fj), [jump](hex/pointers/basic_pointers.fj), [xor_to](hex/pointers/xor_to_pointer.fj), [xor_from](hex/pointers/xor_from_pointer.fj); [stack](hex/pointers/stack.fj)/[pointers](hex/pointers/basic_pointers.fj) init. [pointer arithmetics](hex/pointers/pointer_arithmetics.fj), [stack arithmetics + push/pop](hex/pointers/stack.fj).
- [pointers/](hex/pointers) - hex-vec pointers subdirectory: [flip](hex/pointers/xor_to_pointer.fj), [jump](hex/pointers/basic_pointers.fj), [xor_to](hex/pointers/xor_to_pointer.fj), [xor_from](hex/pointers/xor_from_pointer.fj); [stack](hex/pointers/stack.fj)/[pointers](hex/pointers/basic_pointers.fj) init. [pointer arithmetics](hex/pointers/pointer_arithmetics.fj), [stack arithmetics + push/pop](hex/pointers/stack.fj).

### [casting.fj](casting.fj)
Offers casting between bits and hexes.
Expand Down
10 changes: 5 additions & 5 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Then add a new line to the relevant compile-csv and run-csv files, according to

### Compile CSVs format:

(files with the next format: ```test_compile_*.csv```)
(files with the next format: ```tests_tables/test_compile_*.csv```)

| test name | .fj paths | out .fjm path | memory width | version | flags | use stl | treat warnings as errors |
|--------------|-------------------------------------------------------------|------------------------------|--------------|---------|-------|---------|--------------------------|
Expand All @@ -118,7 +118,7 @@ Note that you can specify a single file, or a '|' separated list of files in the

### Run CSVs format:

(files with the next format: ```test_run_*.csv```)
(files with the next format: ```tests_tables/test_run_*.csv```)

| test name | .fjm path | input file path | output file path | is input a binary file | is output a binary file |
|--------------|------------------------------|---------------------------|-----------------------------|------------------------|-------------------------|
Expand All @@ -130,6 +130,6 @@ Note that you can also emit specifying a file in the input/output cell, and leav

### Xfail Lists

If you want to add your test, but you want it to [xfail](https://docs.pytest.org/en/7.1.x/how-to/skipping.html#xfail-mark-test-functions-as-expected-to-fail), you can add your test name to:
- ```xfail_compile.csv``` - to mark its compilation as expected to fail.
- ```xfail_run.csv``` - to mark its run as expected to fail.
If you want to add your test, but you want it to [xfail](https://docs.pytest.org/en/7.1.x/how-to/skipping.html#xfail-mark-test-functions-as-expected-to-fail), you can add your test name (in its own line) to:
- ```tests_tables/xfail_compile.csv``` - to mark its compilation as expected to fail.
- ```tests_tables/xfail_run.csv``` - to mark its run as expected to fail.
11 changes: 7 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@


TESTS_PATH = Path(__file__).parent
TESTS_TABLES_PATH = TESTS_PATH / 'tests_tables'
with open(TESTS_PATH / 'conf.json', 'r') as tests_json:
TESTS_OPTIONS = json.load(tests_json)

Expand Down Expand Up @@ -361,8 +362,8 @@ def get_tests_from_csvs(get_option: Callable[[str], Any]) -> TestsType:

types_to_run__heavy_first = get_test_types_to_run__heavy_first(get_option)

compile_xfail_list = [line[0] for line in argument_line_iterator(TESTS_PATH / "xfail_compile.csv", 1)]
run_xfail_list = [line[0] for line in argument_line_iterator(TESTS_PATH / "xfail_run.csv", 1)]
compile_xfail_list = [line[0] for line in argument_line_iterator(TESTS_TABLES_PATH / "xfail_compile.csv", 1)]
run_xfail_list = [line[0] for line in argument_line_iterator(TESTS_TABLES_PATH / "xfail_run.csv", 1)]

save_debug_file, debug_info_length = get_option(DEBUG_INFO_FLAG)
if is_parallel_active():
Expand All @@ -371,7 +372,7 @@ def get_tests_from_csvs(get_option: Callable[[str], Any]) -> TestsType:
compile_tests: List[ParameterSet] = []
if check_compile_tests:
compiles_csvs = {
test_type: TESTS_PATH / f"test_compile_{test_type}.csv" for test_type in types_to_run__heavy_first
test_type: TESTS_TABLES_PATH / f"test_compile_{test_type}.csv" for test_type in types_to_run__heavy_first
}
for test_type in types_to_run__heavy_first:
compile_tests.extend(
Expand All @@ -381,7 +382,9 @@ def get_tests_from_csvs(get_option: Callable[[str], Any]) -> TestsType:

run_tests: List[ParameterSet] = []
if check_run_tests:
run_csvs = {test_type: TESTS_PATH / f"test_run_{test_type}.csv" for test_type in types_to_run__heavy_first}
run_csvs = {
test_type: TESTS_TABLES_PATH / f"test_run_{test_type}.csv" for test_type in types_to_run__heavy_first
}
for test_type in types_to_run__heavy_first:
run_tests.extend(
get_run_tests_params_from_csv(run_csvs[test_type], run_xfail_list, save_debug_file, debug_info_length)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 760febd

Please sign in to comment.