-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need acceptance test suite #61
Comments
@ebarlas FYI |
Something like $ for n in 1 2 5 10 100 1000 10000; do ./create_measurements.sh $n && diff <(./calculate_average_AlexanderYastrebov.sh 2>/dev/null | ./tocsv.sh) <(./calculate_average.sh 2>/dev/null | ./tocsv.sh) && echo "OK $n" || echo "FAIL $n"; done
Created file with 1 measurements in 19 ms
OK 1
Created file with 2 measurements in 17 ms
OK 2
Created file with 5 measurements in 21 ms
OK 5
Created file with 10 measurements in 18 ms
OK 10
Created file with 100 measurements in 22 ms
OK 100
Created file with 1,000 measurements in 29 ms
107c107
< Dolisie;5.1;22.5;39.5
---
> Dolisie;5.1;22.6;39.5
124c124
< Gagnoa;17.7;22.4;25.4
---
> Gagnoa;17.7;22.3;25.4
126c126
< Garissa;21.6;41.5;72.0
---
> Garissa;21.6;41.4;72.0
135c135
< Hamburg;-0.9;9.6;17.9
---
> Hamburg;-0.9;9.5;17.9
FAIL 1000
Created file with 10,000 measurements in 62 ms
369c369
< Timbuktu;10.6;29.9;53.7
---
> Timbuktu;10.6;30.0;53.7
FAIL 10000 could be used to verify a given implementation. |
I manually run the reference impl on my generated file and pipe it to a file (name needs to start with Then in my code I have:
It is crude, but it gets the job done... also I find assertions useful alternative to defensive coding when you cannot aford the extra checks on a normal run. |
Yeah, if someone wanted to create this kind of test (bonus points for automatically running it against all provided entries), that would be awesome and highly welcome. A test runner which sets |
@AlexanderYastrebov, I feel a bit dense, how do you define the expected values in your proposal? Where is tocsv.sh coming from? |
Adds test samples that can be used for unit tests or to verify implementations via: ```sh for sample in $(ls src/test/resources/samples/*.txt) do echo "Validating $sample" rm -f measurements.txt ln -s $sample measurements.txt diff <(./calculate_average.sh) ${sample%.txt}.out done rm measurements.txt ``` For gunnarmorling#61
We can create a set of test measurement and expected output files (aka golden files) and check each implementation against it. I've created #82 for that. Additionally we can have a test like proposed in #61 (comment) that verifies implementation against baseline implementation.
Was added by #36 but its just to simplify debugging of failures, the validator may simply compare impl output to the expected output. |
Adds test samples that can be used for unit tests or to verify implementations via: ```bash for sample in $(ls src/test/resources/samples/*.txt) do echo "Validating $sample" rm -f measurements.txt ln -s $sample measurements.txt diff <(./calculate_average.sh) ${sample%.txt}.out done rm measurements.txt ``` For gunnarmorling#61
This is just a fun excersise, the real validator should use shell script like in gunnarmorling#82 since many implementations depend on different jdks and command line arguments. For gunnarmorling#61
This is just a fun excersise, the real validator should use shell script like in gunnarmorling#82 since many implementations depend on different jdks and command line arguments. For gunnarmorling#61
I added a Unit test in this PR #89 Here is a list with the submissions that I also found to be failing the rules. |
Adds test samples that can be used for unit tests or to verify implementations via: ```bash for sample in $(ls src/test/resources/samples/*.txt) do echo "Validating $sample" rm -f measurements.txt ln -s $sample measurements.txt diff <(./calculate_average.sh) ${sample%.txt}.out done rm measurements.txt ``` For gunnarmorling#61
The script test all implementations and prints PASS or FAIL. In case if failure it also prints implementation output to stderr. This will be handy for adding new test samples. Example usages: ```sh $ ./test_all.sh 2>/dev/null PASS artsiomkorzun PASS baseline PASS bjhara PASS criccomini FAIL ddimtirov FAIL ebarlas PASS filiphr FAIL itaske PASS khmarbaise FAIL kuduwa-keshavram FAIL lawrey PASS padreati FAIL palmr PASS richardstartin FAIL royvanrijn FAIL seijikun PASS spullara PASS truelive $ ./test_all.sh 2>/dev/null | grep PASS | cut -d' ' -f2 artsiomkorzun baseline bjhara criccomini filiphr khmarbaise padreati richardstartin spullara truelive ``` For gunnarmorling#61
The script tests all implementations and prints PASS or FAIL status. In case of failure it also prints implementation output to stderr. This will be handy for adding new test samples. Example usages: ```sh $ ./test_all.sh 2>/dev/null PASS artsiomkorzun PASS baseline PASS bjhara PASS criccomini FAIL ddimtirov FAIL ebarlas PASS filiphr FAIL itaske PASS khmarbaise FAIL kuduwa-keshavram FAIL lawrey PASS padreati FAIL palmr PASS richardstartin FAIL royvanrijn FAIL seijikun PASS spullara PASS truelive $ ./test_all.sh 2>/dev/null | grep PASS | cut -d' ' -f2 artsiomkorzun baseline bjhara criccomini filiphr khmarbaise padreati richardstartin spullara truelive ``` For gunnarmorling#61
The script tests all implementations and prints PASS or FAIL status. In case of failure it also prints implementation output to stderr. This will be handy for adding new test samples. Show test statuses and omit failing output: ```sh $ ./test_all.sh 2>/dev/null PASS artsiomkorzun PASS baseline PASS bjhara PASS criccomini FAIL ddimtirov FAIL ebarlas PASS filiphr FAIL itaske PASS khmarbaise FAIL kuduwa-keshavram FAIL lawrey PASS padreati FAIL palmr PASS richardstartin FAIL royvanrijn FAIL seijikun PASS spullara PASS truelive ``` Show only passing implementations: ``` $ ./test_all.sh 2>/dev/null | grep PASS | cut -d' ' -f2 artsiomkorzun baseline bjhara criccomini filiphr khmarbaise padreati richardstartin spullara truelive ``` For gunnarmorling#61
The script tests all implementations and prints PASS or FAIL status. In case of failure it also prints implementation output to stderr. This will be handy for adding new test samples. Show test statuses and omit failing output: ```sh $ ./test_all.sh 2>/dev/null PASS artsiomkorzun PASS baseline PASS bjhara PASS criccomini FAIL ddimtirov FAIL ebarlas PASS filiphr FAIL itaske PASS khmarbaise FAIL kuduwa-keshavram FAIL lawrey PASS padreati FAIL palmr PASS richardstartin FAIL royvanrijn FAIL seijikun PASS spullara PASS truelive ``` Show only passing implementations: ``` $ ./test_all.sh 2>/dev/null | grep PASS | cut -d' ' -f2 artsiomkorzun baseline bjhara criccomini filiphr khmarbaise padreati richardstartin spullara truelive ``` For gunnarmorling#61
The script tests all implementations and prints PASS or FAIL status. In case of failure it also prints implementation output to stderr. This will be handy for adding new test samples. Show test statuses and omit failing output: ```sh $ ./test_all.sh 2>/dev/null PASS artsiomkorzun PASS baseline PASS bjhara PASS criccomini FAIL ddimtirov FAIL ebarlas PASS filiphr FAIL itaske PASS khmarbaise FAIL kuduwa-keshavram FAIL lawrey PASS padreati FAIL palmr PASS richardstartin FAIL royvanrijn FAIL seijikun PASS spullara PASS truelive ``` Show only passing implementations: ``` $ ./test_all.sh 2>/dev/null | grep PASS | cut -d' ' -f2 artsiomkorzun baseline bjhara criccomini filiphr khmarbaise padreati richardstartin spullara truelive ``` For #61
@gunnarmorling I guess we can close this and work on additional tests case by case. |
Makes sense. Thx for improving the test suite that much, @AlexanderYastrebov! |
The script tests all implementations and prints PASS or FAIL status. In case of failure it also prints implementation output to stderr. This will be handy for adding new test samples. Show test statuses and omit failing output: ```sh $ ./test_all.sh 2>/dev/null PASS artsiomkorzun PASS baseline PASS bjhara PASS criccomini FAIL ddimtirov FAIL ebarlas PASS filiphr FAIL itaske PASS khmarbaise FAIL kuduwa-keshavram FAIL lawrey PASS padreati FAIL palmr PASS richardstartin FAIL royvanrijn FAIL seijikun PASS spullara PASS truelive ``` Show only passing implementations: ``` $ ./test_all.sh 2>/dev/null | grep PASS | cut -d' ' -f2 artsiomkorzun baseline bjhara criccomini filiphr khmarbaise padreati richardstartin spullara truelive ``` For gunnarmorling#61
E.g. current "winner" produces garbage output on trivial input:
The text was updated successfully, but these errors were encountered: