diff --git a/.gitignore b/.gitignore index e4e5f6c..48723da 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -*~ \ No newline at end of file +*~ +**/tests/results.json diff --git a/Dockerfile b/Dockerfile index 2b3e5bc..f97ab43 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,13 +11,13 @@ RUN apt-get update \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -RUN wget https://www.jsoftware.com/download/j901/install/j901_linux64.tar.gz \ - && tar -xvf j901_linux64.tar.gz \ - && mv j901 /opt/j901 \ +RUN wget https://www.jsoftware.com/download/j9.5/install/j9.5_linux64.tar.gz \ + && tar -xvf j9.5_linux64.tar.gz \ + && mv j9.5 /opt/j9.5 \ && apt-get -y --purge remove wget ca-certificates \ - && rm -rf j901_linux64.tar.gz + && rm -rf j9.5_linux64.tar.gz -RUN /opt/j901/bin/jconsole -js \ +RUN /opt/j9.5/bin/jconsole -js \ "load'pacman'" \ "'update'jpkg''" \ "'install'jpkg'convert/json'" \ diff --git a/bin/run.ijs b/bin/run.ijs index 3005804..e9ceab1 100755 --- a/bin/run.ijs +++ b/bin/run.ijs @@ -1,4 +1,4 @@ -#! /opt/j901/bin/jconsole +#! /opt/j9.5/bin/jconsole require'convert/json general/unittest' @@ -10,12 +10,22 @@ report=: failure`success@.(1=#) status=: (;:'fail pass') {~ [: *./ ('pass'-:1 0&{::)S:1 version=: <3 +NB. REGEX verbs to circumvent the ignore flags on tests +temp_test_path =: < jpath '~temp/test.ijs' +repl_solution_path =: '[a-zA-Z0-9[-]*]*[.]ijs'&(jcwdpath rxapply) +repl_ignore_flag =: '_ignore ?=: ?[1-9]*'&( ( ('[1-9]+' ; '0')&rxrplc) rxapply) + + main=: monad define 'slug indir outdir'=. _3{.ARGV NB. name args to vars and record cd indir=. jpathsep indir outdir=. jpathsep outdir 1!:44 indir NB. cd to indir - result=. }. }: <;._2 unittest indir,'test.ijs' NB. run tests + + (repl_ignore_flag repl_solution_path 1!:1 < indir, 'test.ijs') 1!:2 temp_test_path NB. replace ignore flags and record tests in J's temp folder + + result=. }. }: <;._2 unittest jpath '~temp/test.ijs' NB. run tests + 1!:55 temp_test_path NB. deletes temporary test file if. (1<#result) do. if. 'Suite Error:'-:1{::result do. NB. error running test suite @@ -30,7 +40,7 @@ main=: monad define end. NB. else report pass/fail 'order tasks'=. |: > cutopen each cutopen 1!:1 < jpath '~temp/helper.txt' NB. get ordering and tasks numbers from temporary helper file - 1!:55 < jpath '~user/temp/helper.txt' NB. deletes helper file + 1!:55 < jpath '~temp/helper.txt' NB. deletes helper file tasks=. |: ,: ,. (<'task_id') ,: <"0 tasks NB. tasks has shape 4 2 1 in order to simplify the merge @@ -43,4 +53,4 @@ main=: monad define exit 0 ) -main'' \ No newline at end of file +main'' diff --git a/bin/run.sh b/bin/run.sh index dd3cf78..b42633a 100755 --- a/bin/run.sh +++ b/bin/run.sh @@ -33,7 +33,7 @@ echo "${slug}: testing..." # Run the tests for the provided implementation file and redirect stdout and # stderr to capture it -test_output=$(/opt/j901/bin/jconsole bin/run.ijs "$slug" "$solution_dir/" "$output_dir/") +test_output=$(/opt/j9.5/bin/jconsole bin/run.ijs "$slug" "$solution_dir/" "$output_dir/") jq . ${results_file} | sponge ${results_file} diff --git a/tests/all-fail/example.ijs b/tests/all-fail/example.ijs index cc78be6..b144397 100644 --- a/tests/all-fail/example.ijs +++ b/tests/all-fail/example.ijs @@ -1 +1 @@ -nuc_cnt=: [: +/ =/&'ACGT' \ No newline at end of file +nuc_cnt=: [: +/ =/&'ACGT' diff --git a/tests/all-fail/nucleotide-count.ijs b/tests/all-fail/nucleotide-count.ijs index d4c1e2f..14a2d1d 100644 --- a/tests/all-fail/nucleotide-count.ijs +++ b/tests/all-fail/nucleotide-count.ijs @@ -1 +1 @@ -nuc_cnt=: ] \ No newline at end of file +nuc_cnt=: ] diff --git a/tests/all-fail/results.json b/tests/all-fail/results.json deleted file mode 100644 index 7dbe9e6..0000000 --- a/tests/all-fail/results.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "version": 3, - "status": "fail", - "tests": [ - { - "status": "fail", - "name": "nuc_cnt1", - "message": "|assertion failure: assert", - "test_code": "assert 0 0 0 0-:nuc_cnt''", - "task_id": "1" - }, - { - "status": "fail", - "name": "nuc_cnt2", - "message": "|assertion failure: assert", - "test_code": "assert 0 0 1 0-:nuc_cnt 1$'G'", - "task_id": "1" - }, - { - "status": "fail", - "name": "nuc_cnt3", - "message": "|assertion failure: assert", - "test_code": "assert 0 0 7 0-:nuc_cnt'GGGGGGG'", - "task_id": "1" - }, - { - "status": "fail", - "name": "nuc_cnt4", - "message": "|assertion failure: assert", - "test_code": "assert 20 12 17 21-:nuc_cnt'AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC'", - "task_id": "1" - } - ] -} diff --git a/tests/empty-file/example.ijs b/tests/empty-file/example.ijs index cc78be6..b144397 100644 --- a/tests/empty-file/example.ijs +++ b/tests/empty-file/example.ijs @@ -1 +1 @@ -nuc_cnt=: [: +/ =/&'ACGT' \ No newline at end of file +nuc_cnt=: [: +/ =/&'ACGT' diff --git a/tests/empty-file/results.json b/tests/empty-file/results.json deleted file mode 100644 index a3557a1..0000000 --- a/tests/empty-file/results.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "version": 3, - "status": "fail", - "tests": [ - { - "status": "fail", - "name": "nuc_cnt1", - "message": "|value error: nuc_cnt", - "test_code": "rt 0 0 0 0-: nuc_cnt''", - "task_id": "1" - }, - { - "status": "fail", - "name": "nuc_cnt2", - "message": "|value error: nuc_cnt", - "test_code": "rt 0 0 1 0-: nuc_cnt 1$'G'", - "task_id": "1" - }, - { - "status": "fail", - "name": "nuc_cnt3", - "message": "|value error: nuc_cnt", - "test_code": "rt 0 0 7 0-: nuc_cnt'GGGGGGG'", - "task_id": "1" - }, - { - "status": "fail", - "name": "nuc_cnt4", - "message": "|value error: nuc_cnt", - "test_code": "rt 20 12 17 21-: nuc_cnt'AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC'", - "task_id": "1" - } - ] -} diff --git a/tests/multiple-tasks/difference-of-squares.ijs b/tests/multiple-tasks/difference-of-squares.ijs index 8de48da..432f503 100644 --- a/tests/multiple-tasks/difference-of-squares.ijs +++ b/tests/multiple-tasks/difference-of-squares.ijs @@ -1,3 +1,3 @@ square_of_sum=: [: *: +/ @ i. @ >: sum_of_square=: [: +/ *: @ i. @ >: -difference_of_squares =: square_of_sum - sum_of_square \ No newline at end of file +difference_of_squares =: square_of_sum - sum_of_square diff --git a/tests/multiple-tasks/results.json b/tests/multiple-tasks/results.json deleted file mode 100644 index 94e2e32..0000000 --- a/tests/multiple-tasks/results.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "version": 3, - "status": "pass", - "tests": [ - { - "status": "pass", - "name": "square_of_sum_1", - "message": "OK", - "task_id": "1" - }, - { - "status": "pass", - "name": "square_of_sum_5", - "message": "OK", - "task_id": "1" - }, - { - "status": "pass", - "name": "square_of_sum_100", - "message": "OK", - "task_id": "1" - }, - { - "status": "pass", - "name": "sum_of_square_5", - "message": "OK", - "task_id": "2" - }, - { - "status": "pass", - "name": "sum_of_square_100", - "message": "OK", - "task_id": "2" - }, - { - "status": "pass", - "name": "difference_of_squares_0", - "message": "OK", - "task_id": "3" - }, - { - "status": "pass", - "name": "difference_of_squares_5", - "message": "OK", - "task_id": "3" - }, - { - "status": "pass", - "name": "difference_of_squares_100", - "message": "OK", - "task_id": "3" - } - ] -} diff --git a/tests/partial-fail/example.ijs b/tests/partial-fail/example.ijs index cc78be6..b144397 100644 --- a/tests/partial-fail/example.ijs +++ b/tests/partial-fail/example.ijs @@ -1 +1 @@ -nuc_cnt=: [: +/ =/&'ACGT' \ No newline at end of file +nuc_cnt=: [: +/ =/&'ACGT' diff --git a/tests/partial-fail/nucleotide-count.ijs b/tests/partial-fail/nucleotide-count.ijs index cc78be6..b144397 100644 --- a/tests/partial-fail/nucleotide-count.ijs +++ b/tests/partial-fail/nucleotide-count.ijs @@ -1 +1 @@ -nuc_cnt=: [: +/ =/&'ACGT' \ No newline at end of file +nuc_cnt=: [: +/ =/&'ACGT' diff --git a/tests/partial-fail/results.json b/tests/partial-fail/results.json deleted file mode 100644 index d1a0ab8..0000000 --- a/tests/partial-fail/results.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "version": 3, - "status": "fail", - "tests": [ - { - "status": "pass", - "name": "nuc_cnt1", - "message": "OK", - "task_id": "1" - }, - { - "status": "fail", - "name": "nuc_cnt2", - "message": "|assertion failure: assert", - "test_code": "assert 0 0 1 0-:1,nuc_cnt 1$'G'", - "task_id": "1" - }, - { - "status": "pass", - "name": "nuc_cnt3", - "message": "OK", - "task_id": "1" - }, - { - "status": "pass", - "name": "nuc_cnt4", - "message": "OK", - "task_id": "1" - } - ] -} diff --git a/tests/success/example.ijs b/tests/success/example.ijs index cc78be6..b144397 100644 --- a/tests/success/example.ijs +++ b/tests/success/example.ijs @@ -1 +1 @@ -nuc_cnt=: [: +/ =/&'ACGT' \ No newline at end of file +nuc_cnt=: [: +/ =/&'ACGT' diff --git a/tests/success/nucleotide-count.ijs b/tests/success/nucleotide-count.ijs index cc78be6..b144397 100644 --- a/tests/success/nucleotide-count.ijs +++ b/tests/success/nucleotide-count.ijs @@ -1 +1 @@ -nuc_cnt=: [: +/ =/&'ACGT' \ No newline at end of file +nuc_cnt=: [: +/ =/&'ACGT' diff --git a/tests/success/results.json b/tests/success/results.json deleted file mode 100644 index dcd688d..0000000 --- a/tests/success/results.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "version": 3, - "status": "pass", - "tests": [ - { - "status": "pass", - "name": "nuc_cnt1", - "message": "OK", - "task_id": "1" - }, - { - "status": "pass", - "name": "nuc_cnt2", - "message": "OK", - "task_id": "1" - }, - { - "status": "pass", - "name": "nuc_cnt3", - "message": "OK", - "task_id": "1" - }, - { - "status": "pass", - "name": "nuc_cnt4", - "message": "OK", - "task_id": "1" - } - ] -} diff --git a/tests/syntax-error/example.ijs b/tests/syntax-error/example.ijs index cc78be6..b144397 100644 --- a/tests/syntax-error/example.ijs +++ b/tests/syntax-error/example.ijs @@ -1 +1 @@ -nuc_cnt=: [: +/ =/&'ACGT' \ No newline at end of file +nuc_cnt=: [: +/ =/&'ACGT' diff --git a/tests/syntax-error/expected_results.json b/tests/syntax-error/expected_results.json index c1eef58..b909718 100644 --- a/tests/syntax-error/expected_results.json +++ b/tests/syntax-error/expected_results.json @@ -1,5 +1,5 @@ { "version": 3, "status": "error", - "message": "|syntax error: script\n| nuc_cnt=: ''<\n|[-0] nucleotide-count.ijs\n" + "message": "|syntax error in script, unexecutable fragment (noun verb)\n| nuc_cnt=: ''<\n|[-1] nucleotide-count.ijs\n" } diff --git a/tests/syntax-error/nucleotide-count.ijs b/tests/syntax-error/nucleotide-count.ijs index 2394789..a4838ef 100644 --- a/tests/syntax-error/nucleotide-count.ijs +++ b/tests/syntax-error/nucleotide-count.ijs @@ -1 +1 @@ -nuc_cnt=: '' < NB. 'syntax error \ No newline at end of file +nuc_cnt=: '' < NB. 'syntax error diff --git a/tests/syntax-error/results.json b/tests/syntax-error/results.json deleted file mode 100644 index c1eef58..0000000 --- a/tests/syntax-error/results.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": 3, - "status": "error", - "message": "|syntax error: script\n| nuc_cnt=: ''<\n|[-0] nucleotide-count.ijs\n" -} diff --git a/tests/unordered/results.json b/tests/unordered/results.json deleted file mode 100644 index d31fe68..0000000 --- a/tests/unordered/results.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "version": 3, - "status": "pass", - "tests": [ - { - "status": "pass", - "name": "empty_rna_sequence", - "message": "OK", - "task_id": "1" - }, - { - "status": "pass", - "name": "rna_complement_of_cytosine_is_guanine", - "message": "OK", - "task_id": "1" - }, - { - "status": "pass", - "name": "rna_complement_of_guanine_is_cytosine", - "message": "OK", - "task_id": "1" - }, - { - "status": "pass", - "name": "rna_complement_of_thymine_is_adenine", - "message": "OK", - "task_id": "1" - }, - { - "status": "pass", - "name": "rna_complement_of_adenine_is_uracil", - "message": "OK", - "task_id": "1" - }, - { - "status": "pass", - "name": "rna_complement", - "message": "OK", - "task_id": "1" - } - ] -} diff --git a/tests/unordered/rna-transcription.ijs b/tests/unordered/rna-transcription.ijs index 2529234..d8021f5 100644 --- a/tests/unordered/rna-transcription.ijs +++ b/tests/unordered/rna-transcription.ijs @@ -1 +1 @@ -rna=: 'UGCA' {~ 'ACGT'&i. \ No newline at end of file +rna=: 'UGCA' {~ 'ACGT'&i.