Skip to content

Commit

Permalink
officially supporting 'none' as sorting of test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
onqtam committed Feb 2, 2021
1 parent 8492a62 commit b42592e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doc/markdown/commandline.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ All the options can also be set with code (defaults/overrides) if the user [**su
| ```-sce``` ```--subcase-exclude=<filters>``` | Same as ```--test-case-exclude=<filters>``` but filters based on subcase names |
| ```-r``` ```--reporters=<filters>``` | List of [**reporters**](reporters.md) to use (default is ```console```) |
| ```-o``` &nbsp; ```--out=<string>``` | Output filename |
| ```-ob``` &nbsp; ```--order-by=<string>``` | Test cases will be sorted before being executed either by **the file in which they are** / **the test suite they are in** / **their name** / **random**. The possible values of ```<string>``` are ```file```/```suite```/```name```/```rand```. The default is ```file```. **NOTE: the order produced by the ```file```, ```suite``` and ```name``` options is compiler-dependent and might differ depending on the compiler used.** |
| ```-ob``` &nbsp; ```--order-by=<string>``` | Test cases will be sorted before being executed either by **the file in which they are** / **the test suite they are in** / **their name** / **random**. The possible values of ```<string>``` are ```file```/```suite```/```name```/```rand```/```none```. The default is ```file```. **NOTE: the order produced by the ```file```, ```suite``` and ```name``` options is compiler-dependent and might differ depending on the compiler used.** |
| ```-rs``` &nbsp; ```--rand-seed=<int>``` | The seed for random ordering |
| ```-f``` &nbsp;&nbsp;&nbsp; ```--first=<int>``` | The **first** test case to execute which passes the current filters - for range-based execution - see [**the example python script**](../../examples/range_based_execution.py) |
| ```-l``` &nbsp;&nbsp;&nbsp; ```--last=<int>``` | The **last** test case to execute which passes the current filters - for range-based execution - see [**the example python script**](../../examples/range_based_execution.py) |
Expand Down
5 changes: 4 additions & 1 deletion doctest/doctest.h
Original file line number Diff line number Diff line change
Expand Up @@ -5606,7 +5606,7 @@ namespace {
<< Whitespace(sizePrefixDisplay*1) << "output filename\n";
s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "ob, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "order-by=<string> "
<< Whitespace(sizePrefixDisplay*1) << "how the tests should be ordered\n";
s << Whitespace(sizePrefixDisplay*3) << " <string> - by [file/suite/name/rand]\n";
s << Whitespace(sizePrefixDisplay*3) << " <string> - [file/suite/name/rand/none]\n";
s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "rs, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "rand-seed=<int> "
<< Whitespace(sizePrefixDisplay*1) << "seed for random ordering\n";
s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "f, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "first=<int> "
Expand Down Expand Up @@ -6307,6 +6307,9 @@ int Context::run() {
first[i] = first[idxToSwap];
first[idxToSwap] = temp;
}
} else if(p->order_by.compare("none", true) == 0) {
// means no sorting - beneficial for death tests which call into the executable
// with a specific test case in mind - we don't want to slow down the startup times
}
}

Expand Down
5 changes: 4 additions & 1 deletion doctest/parts/doctest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2937,7 +2937,7 @@ namespace {
<< Whitespace(sizePrefixDisplay*1) << "output filename\n";
s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "ob, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "order-by=<string> "
<< Whitespace(sizePrefixDisplay*1) << "how the tests should be ordered\n";
s << Whitespace(sizePrefixDisplay*3) << " <string> - by [file/suite/name/rand]\n";
s << Whitespace(sizePrefixDisplay*3) << " <string> - [file/suite/name/rand/none]\n";
s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "rs, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "rand-seed=<int> "
<< Whitespace(sizePrefixDisplay*1) << "seed for random ordering\n";
s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "f, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "first=<int> "
Expand Down Expand Up @@ -3638,6 +3638,9 @@ int Context::run() {
first[i] = first[idxToSwap];
first[idxToSwap] = temp;
}
} else if(p->order_by.compare("none", true) == 0) {
// means no sorting - beneficial for death tests which call into the executable
// with a specific test case in mind - we don't want to slow down the startup times
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/all_features/test_output/help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
-r, --reporters=<filters> reporters to use (console is default)
-o, --out=<string> output filename
-ob, --order-by=<string> how the tests should be ordered
<string> - by [file/suite/name/rand]
<string> - [file/suite/name/rand/none]
-rs, --rand-seed=<int> seed for random ordering
-f, --first=<int> the first test passing the filters to
execute - for range-based execution
Expand Down

0 comments on commit b42592e

Please sign in to comment.