From 0a7ca20773396afb1468467d4a06d78618e987f0 Mon Sep 17 00:00:00 2001 From: eNascimento178 <85421753+eNascimento178@users.noreply.github.com> Date: Fri, 29 Mar 2024 15:15:16 -0300 Subject: [PATCH 1/5] Adding abilities to circumvent ignored tests --- bin/run.ijs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/run.ijs b/bin/run.ijs index 3005804..09585a4 100755 --- a/bin/run.ijs +++ b/bin/run.ijs @@ -10,12 +10,22 @@ report=: failure`success@.(1=#) status=: (;:'fail pass') {~ [: *./ ('pass'-:1 0&{::)S:1 version=: <3 +NB. REGEX verbs to circunvent 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 From e50b9ca78a9a1d89783274a561d730e34940c729 Mon Sep 17 00:00:00 2001 From: eNascimento178 <85421753+eNascimento178@users.noreply.github.com> Date: Fri, 29 Mar 2024 15:15:29 -0300 Subject: [PATCH 2/5] Adding abilities to circumvent ignored tests --- bin/run.ijs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/run.ijs b/bin/run.ijs index 09585a4..e13f5cd 100755 --- a/bin/run.ijs +++ b/bin/run.ijs @@ -10,7 +10,7 @@ report=: failure`success@.(1=#) status=: (;:'fail pass') {~ [: *./ ('pass'-:1 0&{::)S:1 version=: <3 -NB. REGEX verbs to circunvent the ignore flags on tests +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) From cb9723747ba7bec310042ab2b9c3be0a7d44ea80 Mon Sep 17 00:00:00 2001 From: eNascimento178 <85421753+eNascimento178@users.noreply.github.com> Date: Sun, 31 Mar 2024 17:26:14 -0300 Subject: [PATCH 3/5] Update .gitignore Update .gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 From 235c352c234a0601ec1f3581627042714b8bd81f Mon Sep 17 00:00:00 2001 From: eNascimento178 <85421753+eNascimento178@users.noreply.github.com> Date: Sun, 31 Mar 2024 17:40:10 -0300 Subject: [PATCH 4/5] Correct EOL character bug --- tests/all-fail/example.ijs | 2 +- tests/all-fail/nucleotide-count.ijs | 2 +- tests/all-fail/results.json | 34 ------------ tests/empty-file/example.ijs | 2 +- tests/empty-file/results.json | 34 ------------ .../multiple-tasks/difference-of-squares.ijs | 2 +- tests/multiple-tasks/results.json | 54 ------------------- tests/partial-fail/example.ijs | 2 +- tests/partial-fail/nucleotide-count.ijs | 2 +- tests/partial-fail/results.json | 31 ----------- tests/success/example.ijs | 2 +- tests/success/nucleotide-count.ijs | 2 +- tests/success/results.json | 30 ----------- tests/syntax-error/example.ijs | 2 +- tests/syntax-error/expected_results.json | 2 +- tests/syntax-error/nucleotide-count.ijs | 2 +- tests/syntax-error/results.json | 5 -- tests/unordered/results.json | 42 --------------- tests/unordered/rna-transcription.ijs | 2 +- 19 files changed, 12 insertions(+), 242 deletions(-) delete mode 100644 tests/all-fail/results.json delete mode 100644 tests/empty-file/results.json delete mode 100644 tests/multiple-tasks/results.json delete mode 100644 tests/partial-fail/results.json delete mode 100644 tests/success/results.json delete mode 100644 tests/syntax-error/results.json delete mode 100644 tests/unordered/results.json 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. From 0e809bab95e4fb62f05d0a3f5c6f15b3ec74e62b Mon Sep 17 00:00:00 2001 From: eNascimento178 <85421753+eNascimento178@users.noreply.github.com> Date: Sun, 31 Mar 2024 17:40:30 -0300 Subject: [PATCH 5/5] Update to J9.5 --- Dockerfile | 10 +++++----- bin/run.ijs | 6 +++--- bin/run.sh | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) 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 e13f5cd..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' @@ -40,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 @@ -53,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}