diff --git a/.dockerignore b/.dockerignore index eb47a50..3eb8fac 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,10 @@ -.appends -.git -.github -.gitignore +.git/ +.appends/ +.github/ .gitattributes -.dockerignore +.gitignore Dockerfile +bin/run-in-docker.sh +bin/run-tests-in-docker.sh +bin/run-tests.sh +tests/ diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..f913764 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,31 @@ +# Scripts +*.bash text eol=lf +*.fish text eol=lf +*.sh text eol=lf +# These are explicitly windows files and should use crlf +*.bat text eol=crlf +*.cmd text eol=crlf +*.ps1 text eol=crlf + +# Serialisation +*.json text + +# Text files where line endings should be preserved +*.patch -text + +# Docker +Dockerfile text + +# Documentation +*.markdown text +*.md text +*.txt text +LICENSE text +*README* text + +# +# Exclude files from exporting +# + +.gitattributes export-ignore +.gitignore export-ignore diff --git a/Dockerfile b/Dockerfile index 2cd6e90..2b3e5bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,22 @@ FROM debian:stable-slim -RUN apt-get update && apt-get install -y wget -RUN wget https://www.jsoftware.com/download/j901/install/j901_linux64.tar.gz && \ - tar -xvf j901_linux64.tar.gz && \ - mv j901 /opt/j901 + +# install packages required to run the tests +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + wget \ + jq \ + coreutils \ + moreutils \ + ca-certificates \ + && 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 \ + && apt-get -y --purge remove wget ca-certificates \ + && rm -rf j901_linux64.tar.gz + RUN /opt/j901/bin/jconsole -js \ "load'pacman'" \ "'update'jpkg''" \ @@ -11,5 +25,6 @@ RUN /opt/j901/bin/jconsole -js \ "exit 0" RUN mkdir /opt/test-runner -COPY . /opt/test-runner WORKDIR /opt/test-runner +COPY . . +ENTRYPOINT ["/opt/test-runner/bin/run.sh"] diff --git a/README b/README deleted file mode 100644 index 384c830..0000000 --- a/README +++ /dev/null @@ -1,4 +0,0 @@ -# -*- mode: org -*- - -* J Test Runner - diff --git a/README.md b/README.md new file mode 100644 index 0000000..6b5097b --- /dev/null +++ b/README.md @@ -0,0 +1,51 @@ +# Exercism J Test Runner + +The Docker image to automatically run tests on J solutions submitted to [Exercism]. + +## Run the test runner + +To run the tests of an arbitrary exercise, do the following: + +1. Open a terminal in the project's root +2. Run `./bin/run.sh ` + +Once the test runner has finished, its results will be written to `/results.json`. + +## Run the test runner on an exercise using Docker + +_This script is provided for testing purposes, as it mimics how test runners run in Exercism's production environment._ + +To run the tests of an arbitrary exercise using the Docker image, do the following: + +1. Open a terminal in the project's root +2. Run `./bin/run-in-docker.sh ` + +Once the test runner has finished, its results will be written to `/results.json`. + +## Run the tests + +To run the tests to verify the behavior of the test runner, do the following: + +1. Open a terminal in the project's root +2. Run `./bin/run-tests.sh` + +These are [golden tests][golden] that compare the `results.json` generated by running the current state of the code against the "known good" `tests//results.json`. All files created during the test run itself are discarded. + +When you've made modifications to the code that will result in a new "golden" state, you'll need to generate and commit a new `tests//results.json` file. + +## Run the tests using Docker + +_This script is provided for testing purposes, as it mimics how test runners run in Exercism's production environment._ + +To run the tests to verify the behavior of the test runner using the Docker image, do the following: + +1. Open a terminal in the project's root +2. Run `./bin/run-tests-in-docker.sh` + +These are [golden tests][golden] that compare the `results.json` generated by running the current state of the code against the "known good" `tests//results.json`. All files created during the test run itself are discarded. + +When you've made modifications to the code that will result in a new "golden" state, you'll need to generate and commit a new `tests//results.json` file. + +[test-runners]: https://github.com/exercism/docs/tree/main/building/tooling/test-runners +[golden]: https://ro-che.info/articles/2017-12-04-golden-tests +[exercism]: https://exercism.io diff --git a/bin/run-in-docker.sh b/bin/run-in-docker.sh new file mode 100755 index 0000000..8eab863 --- /dev/null +++ b/bin/run-in-docker.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env sh + +# Synopsis: +# Run the test runner on a solution using the test runner Docker image. +# The test runner Docker image is built automatically. + +# Arguments: +# $1: exercise slug +# $2: path to solution folder +# $3: path to output directory + +# Output: +# Writes the test results to a results.json file in the passed-in output directory. +# The test results are formatted according to the specifications at https://github.com/exercism/docs/blob/main/building/tooling/test-runners/interface.md + +# Example: +# ./bin/run-in-docker.sh two-fer path/to/solution/folder/ path/to/output/directory/ + +# Stop executing when a command returns a non-zero return code +set -e + +# If any required arguments is missing, print the usage and exit +if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then + echo "usage: ./bin/run-in-docker.sh exercise-slug path/to/solution/folder/ path/to/output/directory/" + exit 1 +fi + +slug="$1" +solution_dir=$(realpath "${2%/}") +output_dir=$(realpath "${3%/}") + +# Create the output directory if it doesn't exist +mkdir -p "${output_dir}" + +# Build the Docker image +docker build --rm -t exercism/j-test-runner . + +# Run the Docker image using the settings mimicking the production environment +docker run \ + --rm \ + --network none \ + --read-only \ + --mount type=bind,src="${solution_dir}",dst=/solution \ + --mount type=bind,src="${output_dir}",dst=/output \ + --mount type=tmpfs,dst=/tmp \ + exercism/j-test-runner "${slug}" /solution /output diff --git a/bin/run-tests-in-docker.sh b/bin/run-tests-in-docker.sh new file mode 100755 index 0000000..47780c3 --- /dev/null +++ b/bin/run-tests-in-docker.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env sh + +# Synopsis: +# Test the test runner Docker image by running it against a predefined set of +# solutions with an expected output. +# The test runner Docker image is built automatically. + +# Output: +# Outputs the diff of the expected test results against the actual test results +# generated by the test runner Docker image. + +# Example: +# ./bin/run-tests-in-docker.sh + +# Stop executing when a command returns a non-zero return code +set -e + +# Build the Docker image +docker build --rm -t exercism/j-test-runner . + +# Run the Docker image using the settings mimicking the production environment +docker run \ + --rm \ + --network none \ + --read-only \ + --mount type=bind,src="${PWD}/tests",dst=/opt/test-runner/tests \ + --mount type=tmpfs,dst=/tmp \ + --volume "${PWD}/bin/run-tests.sh:/opt/test-runner/bin/run-tests.sh" \ + --workdir /opt/test-runner \ + --entrypoint /opt/test-runner/bin/run-tests.sh \ + exercism/j-test-runner diff --git a/bin/run-tests.sh b/bin/run-tests.sh new file mode 100755 index 0000000..c7f0267 --- /dev/null +++ b/bin/run-tests.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env sh + +# Synopsis: +# Test the test runner by running it against a predefined set of solutions +# with an expected output. + +# Output: +# Outputs the diff of the expected test results against the actual test results +# generated by the test runner. + +# Example: +# ./bin/run-tests.sh + +exit_code=0 + +# Iterate over all test directories +for test_dir in tests/*; do + test_dir_name=$(basename "${test_dir}") + test_dir_path=$(realpath "${test_dir}") + + bin/run.sh "${test_dir_name}" "${test_dir_path}/" "${test_dir_path}/" + + # OPTIONAL: Normalize the results file + # If the results.json file contains information that changes between + # different test runs (e.g. timing information or paths), you should normalize + # the results file to allow the diff comparison below to work as expected + + file="results.json" + expected_file="expected_${file}" + echo "${test_dir_name}: comparing ${file} to ${expected_file}" + + if ! diff "${test_dir_path}/${file}" "${test_dir_path}/${expected_file}"; then + exit_code=1 + fi +done + +exit ${exit_code} diff --git a/bin/run.ijs b/bin/run.ijs index b37435f..3005804 100755 --- a/bin/run.ijs +++ b/bin/run.ijs @@ -1,30 +1,46 @@ -#!/opt/j901/bin/jconsole +#! /opt/j901/bin/jconsole require'convert/json general/unittest' NB. todo: explore using 9!:24'' NB. security level. prevent student NB. solutions from running certain i/o ops -success=: (;:'status name message'),:'pass';({.,{:)@:;:@:,@:> -failure=: (;:'status name message'),:'fail';([:>[:{.[:;:0&{::);(8}.2&{::) -report=: failure`success@.(1=#) -status=: (;:'fail pass') {~ [: *./ ('pass'-:1 0&{::)S:1 +success=: (;:'status name message') ,: 'pass' ; ({.,{:)@:;:@:,@:> +failure=: (;:'status name message test_code') ,: 'fail' ; ([: > [: {. [: ;: 0&{::) ; (1&{::) ; (8 }. 2&{::) +report=: failure`success@.(1=#) +status=: (;:'fail pass') {~ [: *./ ('pass'-:1 0&{::)S:1 +version=: <3 main=: monad define -'slug indir outdir'=. _3{.ARGV NB. name args to vars and record cd -1!:44 indir NB. cd to indir -result=. }.}:<;._2 unittest indir,'test.ijs' NB. run tests -if. (1<#result) do. - if. 'Suite Error:'-:1{::result do. NB. error running test suite - output=. enc_json |: ('error';(13!:12'')) ,.~ ;:'status message' - output 1!:2 < outdir,'results.json' - exit 1 - end. -end. NB. else report pass/fail -output=. <"_1 (report;.1~[:-.[:>('|'={.)&.>) result NB. report per test -output=. (<,~status) output NB. add status and message -output=. enc_json |: output ,.~ ;:'status tests' NB. encode json -output 1!:2 < outdir,'results.json' -exit 0 + '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 + + if. (1<#result) do. + if. 'Suite Error:'-:1{::result do. NB. error running test suite + 'message_part err_path'=. (({.,:jpathsep@}.)~ >:@(i:&' ')) 13!:12'' NB. Get the path of the script where the error occured + 'i_path err_path'=. indir ,: err_path NB. fill indir to conform shapes + relative_path=. (-. i_path = err_path) # err_path + error_message=. (dltbs message_part), ' ', relative_path + output=. enc_json |: (version, 'error' ; error_message) ,.~ ;:'version status message' + output 1!:2 < outdir,'/results.json' + exit 1 + end. + 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 + tasks=. |: ,: ,. (<'task_id') ,: <"0 tasks NB. tasks has shape 4 2 1 in order to simplify the merge + + + output=. (report;.1~ [: -. ('|'={.)@>) result NB. report per test + output=. <"_1 output ,."2 tasks NB. Add tasks info + output=. (/: order) { (-.&a:"1)each output NB. Remove fill boxes and order + output=. (;:'version status tests') ,. version , (status,<) output NB. add version, status, and message + output=. enc_json |: output + output 1!:2 < outdir,'/results.json' + exit 0 ) -main'' \ No newline at end of file +main'' \ No newline at end of file diff --git a/bin/run.sh b/bin/run.sh index 342dcfa..dd3cf78 100755 --- a/bin/run.sh +++ b/bin/run.sh @@ -1,3 +1,40 @@ #!/usr/bin/env sh -./bin/run.ijs $1 $2 $3 +# Synopsis: +# Run the test runner on a solution. + +# Arguments: +# $1: exercise slug +# $2: path to solution folder +# $3: path to output directory + +# Output: +# Writes the test results to a results.json file in the passed-in output directory. +# The test results are formatted according to the specifications at https://github.com/exercism/docs/blob/main/building/tooling/test-runners/interface.md + +# Example: +# ./bin/run.sh two-fer path/to/solution/folder/ path/to/output/directory/ + +# If any required arguments is missing, print the usage and exit +if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then + echo "usage: ./bin/run.sh exercise-slug path/to/solution/folder/ path/to/output/directory/" + exit 1 +fi + +slug="$1" +solution_dir=$(realpath "$2") +output_dir=$(realpath "$3") +results_file="${output_dir}/results.json" + +# Create the output directory if it doesn't exist +mkdir -p "${output_dir}" + +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/") + +jq . ${results_file} | sponge ${results_file} + +echo "${slug}: done" diff --git a/test/nc-error/nucleotide-count.ijs b/test/nc-error/nucleotide-count.ijs deleted file mode 100644 index a1dd6de..0000000 --- a/test/nc-error/nucleotide-count.ijs +++ /dev/null @@ -1 +0,0 @@ -nuc_cnt=: 'syntax error \ No newline at end of file diff --git a/test/nc-error/test.ijs b/test/nc-error/test.ijs deleted file mode 100644 index b988a61..0000000 --- a/test/nc-error/test.ijs +++ /dev/null @@ -1,19 +0,0 @@ -load'nucleotide-count.ijs' - -test_nuc_cnt1=: monad define -assert 0 0 0 0-:nuc_cnt'' -) - -test_nuc_cnt2=: monad define -assert 0 0 1 0-:nuc_cnt 1$'G' -) - -test_nuc_cnt3=: monad define -assert 0 0 7 0-:nuc_cnt'GGGGGGG' -) - -test_nuc_cnt4=: monad define -assert 20 12 17 21-:nuc_cnt'AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC' -) - -REP=: nuc_cnt f. \ No newline at end of file diff --git a/test/nc-fail/test.ijs b/test/nc-fail/test.ijs deleted file mode 100644 index b988a61..0000000 --- a/test/nc-fail/test.ijs +++ /dev/null @@ -1,19 +0,0 @@ -load'nucleotide-count.ijs' - -test_nuc_cnt1=: monad define -assert 0 0 0 0-:nuc_cnt'' -) - -test_nuc_cnt2=: monad define -assert 0 0 1 0-:nuc_cnt 1$'G' -) - -test_nuc_cnt3=: monad define -assert 0 0 7 0-:nuc_cnt'GGGGGGG' -) - -test_nuc_cnt4=: monad define -assert 20 12 17 21-:nuc_cnt'AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC' -) - -REP=: nuc_cnt f. \ No newline at end of file diff --git a/test/nc-output/nc-fail/nucleotide-count.ijs b/test/nc-output/nc-fail/nucleotide-count.ijs deleted file mode 100644 index d3b324c..0000000 --- a/test/nc-output/nc-fail/nucleotide-count.ijs +++ /dev/null @@ -1 +0,0 @@ -nuc_cnt=: 0: \ No newline at end of file diff --git a/test/nc-output/nc-fail/test.ijs b/test/nc-output/nc-fail/test.ijs deleted file mode 100644 index b988a61..0000000 --- a/test/nc-output/nc-fail/test.ijs +++ /dev/null @@ -1,19 +0,0 @@ -load'nucleotide-count.ijs' - -test_nuc_cnt1=: monad define -assert 0 0 0 0-:nuc_cnt'' -) - -test_nuc_cnt2=: monad define -assert 0 0 1 0-:nuc_cnt 1$'G' -) - -test_nuc_cnt3=: monad define -assert 0 0 7 0-:nuc_cnt'GGGGGGG' -) - -test_nuc_cnt4=: monad define -assert 20 12 17 21-:nuc_cnt'AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC' -) - -REP=: nuc_cnt f. \ No newline at end of file diff --git a/test/nc-output/nucleotide-count.ijs b/test/nc-output/nucleotide-count.ijs deleted file mode 100644 index a01c1f3..0000000 --- a/test/nc-output/nucleotide-count.ijs +++ /dev/null @@ -1,4 +0,0 @@ -nuc_cnt=: monad define -echo 'help!' -+/y=/'ACGT' -) \ No newline at end of file diff --git a/test/nc-output/test.ijs b/test/nc-output/test.ijs deleted file mode 100644 index b988a61..0000000 --- a/test/nc-output/test.ijs +++ /dev/null @@ -1,19 +0,0 @@ -load'nucleotide-count.ijs' - -test_nuc_cnt1=: monad define -assert 0 0 0 0-:nuc_cnt'' -) - -test_nuc_cnt2=: monad define -assert 0 0 1 0-:nuc_cnt 1$'G' -) - -test_nuc_cnt3=: monad define -assert 0 0 7 0-:nuc_cnt'GGGGGGG' -) - -test_nuc_cnt4=: monad define -assert 20 12 17 21-:nuc_cnt'AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC' -) - -REP=: nuc_cnt f. \ No newline at end of file diff --git a/test/nc-pass/test.ijs b/test/nc-pass/test.ijs deleted file mode 100644 index b988a61..0000000 --- a/test/nc-pass/test.ijs +++ /dev/null @@ -1,19 +0,0 @@ -load'nucleotide-count.ijs' - -test_nuc_cnt1=: monad define -assert 0 0 0 0-:nuc_cnt'' -) - -test_nuc_cnt2=: monad define -assert 0 0 1 0-:nuc_cnt 1$'G' -) - -test_nuc_cnt3=: monad define -assert 0 0 7 0-:nuc_cnt'GGGGGGG' -) - -test_nuc_cnt4=: monad define -assert 20 12 17 21-:nuc_cnt'AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC' -) - -REP=: nuc_cnt f. \ No newline at end of file diff --git a/test/nc-error/.meta/version b/tests/all-fail/.meta/version similarity index 100% rename from test/nc-error/.meta/version rename to tests/all-fail/.meta/version diff --git a/test/nc-error/example.ijs b/tests/all-fail/example.ijs similarity index 100% rename from test/nc-error/example.ijs rename to tests/all-fail/example.ijs diff --git a/tests/all-fail/expected_results.json b/tests/all-fail/expected_results.json new file mode 100644 index 0000000..7dbe9e6 --- /dev/null +++ b/tests/all-fail/expected_results.json @@ -0,0 +1,34 @@ +{ + "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/test/nc-fail/nucleotide-count.ijs b/tests/all-fail/nucleotide-count.ijs similarity index 100% rename from test/nc-fail/nucleotide-count.ijs rename to tests/all-fail/nucleotide-count.ijs diff --git a/tests/all-fail/results.json b/tests/all-fail/results.json new file mode 100644 index 0000000..7dbe9e6 --- /dev/null +++ b/tests/all-fail/results.json @@ -0,0 +1,34 @@ +{ + "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/all-fail/test.ijs b/tests/all-fail/test.ijs new file mode 100644 index 0000000..dd8ff8f --- /dev/null +++ b/tests/all-fail/test.ijs @@ -0,0 +1,42 @@ +load 'nucleotide-count.ijs' + + +temppath=: < jpath '~temp/helper.txt' + + +before_all =: monad define + order=: i.0 + tasks=: i.0 +) + +after_all =: monad define + (, LF ,~"1 ":order ,. tasks) 1!:2 temppath +) + +nuc_cnt1_ignore=:0 +test_nuc_cnt1=: monad define + order=:order , 1 + tasks=:tasks , 1 + assert 0 0 0 0-:nuc_cnt'' +) + +nuc_cnt2_ignore=:0 +test_nuc_cnt2=: monad define + order=:order , 2 + tasks=:tasks , 1 + assert 0 0 1 0-:nuc_cnt 1$'G' +) + +nuc_cnt3_ignore=:0 +test_nuc_cnt3=: monad define + order=:order , 3 + tasks=:tasks , 1 + assert 0 0 7 0-:nuc_cnt'GGGGGGG' +) + +nuc_cnt4_ignore=:0 +test_nuc_cnt4=: monad define + order=:order , 4 + tasks=:tasks , 1 + assert 20 12 17 21-:nuc_cnt'AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC' +) diff --git a/test/nc-fail/.meta/version b/tests/empty-file/.meta/version similarity index 100% rename from test/nc-fail/.meta/version rename to tests/empty-file/.meta/version diff --git a/test/nc-fail/example.ijs b/tests/empty-file/example.ijs similarity index 100% rename from test/nc-fail/example.ijs rename to tests/empty-file/example.ijs diff --git a/tests/empty-file/expected_results.json b/tests/empty-file/expected_results.json new file mode 100644 index 0000000..a3557a1 --- /dev/null +++ b/tests/empty-file/expected_results.json @@ -0,0 +1,34 @@ +{ + "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/empty-file/nucleotide-count.ijs b/tests/empty-file/nucleotide-count.ijs new file mode 100644 index 0000000..e69de29 diff --git a/tests/empty-file/results.json b/tests/empty-file/results.json new file mode 100644 index 0000000..a3557a1 --- /dev/null +++ b/tests/empty-file/results.json @@ -0,0 +1,34 @@ +{ + "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/empty-file/test.ijs b/tests/empty-file/test.ijs new file mode 100644 index 0000000..dd8ff8f --- /dev/null +++ b/tests/empty-file/test.ijs @@ -0,0 +1,42 @@ +load 'nucleotide-count.ijs' + + +temppath=: < jpath '~temp/helper.txt' + + +before_all =: monad define + order=: i.0 + tasks=: i.0 +) + +after_all =: monad define + (, LF ,~"1 ":order ,. tasks) 1!:2 temppath +) + +nuc_cnt1_ignore=:0 +test_nuc_cnt1=: monad define + order=:order , 1 + tasks=:tasks , 1 + assert 0 0 0 0-:nuc_cnt'' +) + +nuc_cnt2_ignore=:0 +test_nuc_cnt2=: monad define + order=:order , 2 + tasks=:tasks , 1 + assert 0 0 1 0-:nuc_cnt 1$'G' +) + +nuc_cnt3_ignore=:0 +test_nuc_cnt3=: monad define + order=:order , 3 + tasks=:tasks , 1 + assert 0 0 7 0-:nuc_cnt'GGGGGGG' +) + +nuc_cnt4_ignore=:0 +test_nuc_cnt4=: monad define + order=:order , 4 + tasks=:tasks , 1 + assert 20 12 17 21-:nuc_cnt'AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC' +) diff --git a/tests/multiple-tasks/.docs/instructions.md b/tests/multiple-tasks/.docs/instructions.md new file mode 100644 index 0000000..c3999e8 --- /dev/null +++ b/tests/multiple-tasks/.docs/instructions.md @@ -0,0 +1,17 @@ +# Instructions + +Find the difference between the square of the sum and the sum of the squares of the first N natural numbers. + +The square of the sum of the first ten natural numbers is +(1 + 2 + ... + 10)² = 55² = 3025. + +The sum of the squares of the first ten natural numbers is +1² + 2² + ... + 10² = 385. + +Hence the difference between the square of the sum of the first +ten natural numbers and the sum of the squares of the first ten +natural numbers is 3025 - 385 = 2640. + +You are not expected to discover an efficient solution to this yourself from +first principles; research is allowed, indeed, encouraged. Finding the best +algorithm for the problem is a key skill in software engineering. diff --git a/tests/multiple-tasks/.meta/config.json b/tests/multiple-tasks/.meta/config.json new file mode 100644 index 0000000..f81b5af --- /dev/null +++ b/tests/multiple-tasks/.meta/config.json @@ -0,0 +1,22 @@ +{ + "blurb": "Find the difference between the square of the sum and the sum of the squares of the first N natural numbers.", + "authors": [ + "jitwit" + ], + "contributors": [ + "iHiD" + ], + "files": { + "solution": [ + "difference-of-squares.ijs" + ], + "test": [ + "test.ijs" + ], + "example": [ + ".meta/example.ijs" + ] + }, + "source": "Problem 6 at Project Euler", + "source_url": "http://projecteuler.net/problem=6" +} diff --git a/tests/multiple-tasks/.meta/config/auto_approve b/tests/multiple-tasks/.meta/config/auto_approve new file mode 100644 index 0000000..b1cab17 --- /dev/null +++ b/tests/multiple-tasks/.meta/config/auto_approve @@ -0,0 +1 @@ +json_false diff --git a/tests/multiple-tasks/.meta/config/core b/tests/multiple-tasks/.meta/config/core new file mode 100644 index 0000000..b1cab17 --- /dev/null +++ b/tests/multiple-tasks/.meta/config/core @@ -0,0 +1 @@ +json_false diff --git a/tests/multiple-tasks/.meta/config/deprecated b/tests/multiple-tasks/.meta/config/deprecated new file mode 100644 index 0000000..0598f37 --- /dev/null +++ b/tests/multiple-tasks/.meta/config/deprecated @@ -0,0 +1 @@ +json_true diff --git a/tests/multiple-tasks/.meta/config/unlocked_by b/tests/multiple-tasks/.meta/config/unlocked_by new file mode 100644 index 0000000..48cc97d --- /dev/null +++ b/tests/multiple-tasks/.meta/config/unlocked_by @@ -0,0 +1 @@ +json_null diff --git a/tests/multiple-tasks/.meta/config/uuid b/tests/multiple-tasks/.meta/config/uuid new file mode 100644 index 0000000..760a900 --- /dev/null +++ b/tests/multiple-tasks/.meta/config/uuid @@ -0,0 +1 @@ +4cc22c3d-766e-4593-96fe-2e26e06682b8 diff --git a/tests/multiple-tasks/.meta/config/version b/tests/multiple-tasks/.meta/config/version new file mode 100644 index 0000000..867e524 --- /dev/null +++ b/tests/multiple-tasks/.meta/config/version @@ -0,0 +1 @@ +1.2.0 \ No newline at end of file diff --git a/tests/multiple-tasks/.meta/example.ijs b/tests/multiple-tasks/.meta/example.ijs new file mode 100644 index 0000000..8de48da --- /dev/null +++ b/tests/multiple-tasks/.meta/example.ijs @@ -0,0 +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 diff --git a/tests/multiple-tasks/difference-of-squares.ijs b/tests/multiple-tasks/difference-of-squares.ijs new file mode 100644 index 0000000..8de48da --- /dev/null +++ b/tests/multiple-tasks/difference-of-squares.ijs @@ -0,0 +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 diff --git a/tests/multiple-tasks/expected_results.json b/tests/multiple-tasks/expected_results.json new file mode 100644 index 0000000..94e2e32 --- /dev/null +++ b/tests/multiple-tasks/expected_results.json @@ -0,0 +1,54 @@ +{ + "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/multiple-tasks/results.json b/tests/multiple-tasks/results.json new file mode 100644 index 0000000..94e2e32 --- /dev/null +++ b/tests/multiple-tasks/results.json @@ -0,0 +1,54 @@ +{ + "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/multiple-tasks/test.ijs b/tests/multiple-tasks/test.ijs new file mode 100644 index 0000000..4357a77 --- /dev/null +++ b/tests/multiple-tasks/test.ijs @@ -0,0 +1,61 @@ +load 'difference-of-squares.ijs' + + +temppath=: < jpath '~temp/helper.txt' + +before_all =: monad define + order=: i.0 + tasks=: i.0 +) + +after_all =: monad define + (, LF ,~"1 ":order ,. tasks) 1!:2 temppath +) + +test_square_of_sum_1 =: monad define + order=:order , 1 + tasks=:tasks , 1 + assert 1 = square_of_sum 1 +) + +test_square_of_sum_5 =: monad define + order=:order , 2 + tasks=:tasks , 1 + assert 225 = square_of_sum 5 +) + +test_square_of_sum_100 =: monad define + order=:order , 3 + tasks=:tasks , 1 + assert 25502500 = square_of_sum 100 +) + +test_sum_of_square_5 =: monad define + order=:order , 4 + tasks=:tasks , 2 + assert 55 = sum_of_square 5 +) + +test_sum_of_square_100 =: monad define + order=:order , 5 + tasks=:tasks , 2 + assert 338350 = sum_of_square 100 +) + +test_difference_of_squares_0 =: monad define + order=:order , 6 + tasks=:tasks , 3 + assert 0 = difference_of_squares 0 +) + +test_difference_of_squares_5 =: monad define + order=:order , 7 + tasks=:tasks , 3 + assert 170 = difference_of_squares 5 +) + +test_difference_of_squares_100 =: monad define + order=:order , 8 + tasks=:tasks , 3 + assert 25164150 = difference_of_squares 100 +) diff --git a/test/nc-output/.meta/version b/tests/partial-fail/.meta/version similarity index 100% rename from test/nc-output/.meta/version rename to tests/partial-fail/.meta/version diff --git a/test/nc-output/example.ijs b/tests/partial-fail/example.ijs similarity index 100% rename from test/nc-output/example.ijs rename to tests/partial-fail/example.ijs diff --git a/tests/partial-fail/expected_results.json b/tests/partial-fail/expected_results.json new file mode 100644 index 0000000..d1a0ab8 --- /dev/null +++ b/tests/partial-fail/expected_results.json @@ -0,0 +1,31 @@ +{ + "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/test/nc-pass/nucleotide-count.ijs b/tests/partial-fail/nucleotide-count.ijs similarity index 100% rename from test/nc-pass/nucleotide-count.ijs rename to tests/partial-fail/nucleotide-count.ijs diff --git a/tests/partial-fail/results.json b/tests/partial-fail/results.json new file mode 100644 index 0000000..d1a0ab8 --- /dev/null +++ b/tests/partial-fail/results.json @@ -0,0 +1,31 @@ +{ + "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/partial-fail/test.ijs b/tests/partial-fail/test.ijs new file mode 100644 index 0000000..8ed4904 --- /dev/null +++ b/tests/partial-fail/test.ijs @@ -0,0 +1,42 @@ +load 'nucleotide-count.ijs' + + +temppath=: < jpath '~temp/helper.txt' + + +before_all =: monad define + order=: i.0 + tasks=: i.0 +) + +after_all =: monad define + (, LF ,~"1 ":order ,. tasks) 1!:2 temppath +) + +nuc_cnt1_ignore=:0 +test_nuc_cnt1=: monad define + order=:order , 1 + tasks=:tasks , 1 + assert 0 0 0 0-:nuc_cnt'' +) + +nuc_cnt2_ignore=:0 +test_nuc_cnt2=: monad define + order=:order , 2 + tasks=:tasks , 1 + assert 0 0 1 0-: 1 , nuc_cnt 1$'G' NB. This test should fail +) + +nuc_cnt3_ignore=:0 +test_nuc_cnt3=: monad define + order=:order , 3 + tasks=:tasks , 1 + assert 0 0 7 0-:nuc_cnt'GGGGGGG' +) + +nuc_cnt4_ignore=:0 +test_nuc_cnt4=: monad define + order=:order , 4 + tasks=:tasks , 1 + assert 20 12 17 21-:nuc_cnt'AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC' +) diff --git a/test/nc-output/nc-fail/.meta/version b/tests/success/.meta/version similarity index 100% rename from test/nc-output/nc-fail/.meta/version rename to tests/success/.meta/version diff --git a/test/nc-output/nc-fail/example.ijs b/tests/success/example.ijs similarity index 100% rename from test/nc-output/nc-fail/example.ijs rename to tests/success/example.ijs diff --git a/tests/success/expected_results.json b/tests/success/expected_results.json new file mode 100644 index 0000000..dcd688d --- /dev/null +++ b/tests/success/expected_results.json @@ -0,0 +1,30 @@ +{ + "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/test/nc-pass/example.ijs b/tests/success/nucleotide-count.ijs similarity index 100% rename from test/nc-pass/example.ijs rename to tests/success/nucleotide-count.ijs diff --git a/tests/success/results.json b/tests/success/results.json new file mode 100644 index 0000000..dcd688d --- /dev/null +++ b/tests/success/results.json @@ -0,0 +1,30 @@ +{ + "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/success/test.ijs b/tests/success/test.ijs new file mode 100644 index 0000000..dd8ff8f --- /dev/null +++ b/tests/success/test.ijs @@ -0,0 +1,42 @@ +load 'nucleotide-count.ijs' + + +temppath=: < jpath '~temp/helper.txt' + + +before_all =: monad define + order=: i.0 + tasks=: i.0 +) + +after_all =: monad define + (, LF ,~"1 ":order ,. tasks) 1!:2 temppath +) + +nuc_cnt1_ignore=:0 +test_nuc_cnt1=: monad define + order=:order , 1 + tasks=:tasks , 1 + assert 0 0 0 0-:nuc_cnt'' +) + +nuc_cnt2_ignore=:0 +test_nuc_cnt2=: monad define + order=:order , 2 + tasks=:tasks , 1 + assert 0 0 1 0-:nuc_cnt 1$'G' +) + +nuc_cnt3_ignore=:0 +test_nuc_cnt3=: monad define + order=:order , 3 + tasks=:tasks , 1 + assert 0 0 7 0-:nuc_cnt'GGGGGGG' +) + +nuc_cnt4_ignore=:0 +test_nuc_cnt4=: monad define + order=:order , 4 + tasks=:tasks , 1 + assert 20 12 17 21-:nuc_cnt'AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC' +) diff --git a/test/nc-pass/.meta/version b/tests/syntax-error/.meta/version similarity index 100% rename from test/nc-pass/.meta/version rename to tests/syntax-error/.meta/version diff --git a/tests/syntax-error/example.ijs b/tests/syntax-error/example.ijs new file mode 100644 index 0000000..cc78be6 --- /dev/null +++ b/tests/syntax-error/example.ijs @@ -0,0 +1 @@ +nuc_cnt=: [: +/ =/&'ACGT' \ No newline at end of file diff --git a/tests/syntax-error/expected_results.json b/tests/syntax-error/expected_results.json new file mode 100644 index 0000000..c1eef58 --- /dev/null +++ b/tests/syntax-error/expected_results.json @@ -0,0 +1,5 @@ +{ + "version": 3, + "status": "error", + "message": "|syntax error: script\n| nuc_cnt=: ''<\n|[-0] nucleotide-count.ijs\n" +} diff --git a/tests/syntax-error/nucleotide-count.ijs b/tests/syntax-error/nucleotide-count.ijs new file mode 100644 index 0000000..2394789 --- /dev/null +++ b/tests/syntax-error/nucleotide-count.ijs @@ -0,0 +1 @@ +nuc_cnt=: '' < NB. 'syntax error \ No newline at end of file diff --git a/tests/syntax-error/results.json b/tests/syntax-error/results.json new file mode 100644 index 0000000..c1eef58 --- /dev/null +++ b/tests/syntax-error/results.json @@ -0,0 +1,5 @@ +{ + "version": 3, + "status": "error", + "message": "|syntax error: script\n| nuc_cnt=: ''<\n|[-0] nucleotide-count.ijs\n" +} diff --git a/tests/syntax-error/test.ijs b/tests/syntax-error/test.ijs new file mode 100644 index 0000000..dd8ff8f --- /dev/null +++ b/tests/syntax-error/test.ijs @@ -0,0 +1,42 @@ +load 'nucleotide-count.ijs' + + +temppath=: < jpath '~temp/helper.txt' + + +before_all =: monad define + order=: i.0 + tasks=: i.0 +) + +after_all =: monad define + (, LF ,~"1 ":order ,. tasks) 1!:2 temppath +) + +nuc_cnt1_ignore=:0 +test_nuc_cnt1=: monad define + order=:order , 1 + tasks=:tasks , 1 + assert 0 0 0 0-:nuc_cnt'' +) + +nuc_cnt2_ignore=:0 +test_nuc_cnt2=: monad define + order=:order , 2 + tasks=:tasks , 1 + assert 0 0 1 0-:nuc_cnt 1$'G' +) + +nuc_cnt3_ignore=:0 +test_nuc_cnt3=: monad define + order=:order , 3 + tasks=:tasks , 1 + assert 0 0 7 0-:nuc_cnt'GGGGGGG' +) + +nuc_cnt4_ignore=:0 +test_nuc_cnt4=: monad define + order=:order , 4 + tasks=:tasks , 1 + assert 20 12 17 21-:nuc_cnt'AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC' +) diff --git a/tests/unordered/.docs/instructions.md b/tests/unordered/.docs/instructions.md new file mode 100644 index 0000000..36da381 --- /dev/null +++ b/tests/unordered/.docs/instructions.md @@ -0,0 +1,20 @@ +# Instructions + +Your task is determine the RNA complement of a given DNA sequence. + +Both DNA and RNA strands are a sequence of nucleotides. + +The four nucleotides found in DNA are adenine (**A**), cytosine (**C**), guanine (**G**) and thymine (**T**). + +The four nucleotides found in RNA are adenine (**A**), cytosine (**C**), guanine (**G**) and uracil (**U**). + +Given a DNA strand, its transcribed RNA strand is formed by replacing each nucleotide with its complement: + +- `G` -> `C` +- `C` -> `G` +- `T` -> `A` +- `A` -> `U` + +~~~~exercism/note +If you want to look at how the inputs and outputs are structured, take a look at the examples in the test suite. +~~~~ diff --git a/tests/unordered/.docs/introduction.md b/tests/unordered/.docs/introduction.md new file mode 100644 index 0000000..6b3f44b --- /dev/null +++ b/tests/unordered/.docs/introduction.md @@ -0,0 +1,16 @@ +# Introduction + +You work for a bioengineering company that specializes in developing therapeutic solutions. + +Your team has just been given a new project to develop a targeted therapy for a rare type of cancer. + +~~~~exercism/note +It's all very complicated, but the basic idea is that sometimes people's bodies produce too much of a given protein. +That can cause all sorts of havoc. + +But if you can create a very specific molecule (called a micro-RNA), it can prevent the protein from being produced. + +This technique is called [RNA Interference][rnai]. + +[rnai]: https://admin.acceleratingscience.com/ask-a-scientist/what-is-rnai/ +~~~~ diff --git a/tests/unordered/.meta/config.json b/tests/unordered/.meta/config.json new file mode 100644 index 0000000..fc6f6c4 --- /dev/null +++ b/tests/unordered/.meta/config.json @@ -0,0 +1,22 @@ +{ + "authors": [ + "jitwit" + ], + "contributors": [ + "iHiD" + ], + "files": { + "solution": [ + "rna-transcription.ijs" + ], + "test": [ + "test.ijs" + ], + "example": [ + ".meta/example.ijs" + ] + }, + "blurb": "Given a DNA strand, return its RNA Complement Transcription.", + "source": "Hyperphysics", + "source_url": "https://web.archive.org/web/20220408112140/http://hyperphysics.phy-astr.gsu.edu/hbase/Organic/transcription.html" +} diff --git a/tests/unordered/.meta/config/auto_approve b/tests/unordered/.meta/config/auto_approve new file mode 100644 index 0000000..b1cab17 --- /dev/null +++ b/tests/unordered/.meta/config/auto_approve @@ -0,0 +1 @@ +json_false diff --git a/tests/unordered/.meta/config/core b/tests/unordered/.meta/config/core new file mode 100644 index 0000000..0598f37 --- /dev/null +++ b/tests/unordered/.meta/config/core @@ -0,0 +1 @@ +json_true diff --git a/tests/unordered/.meta/config/deprecated b/tests/unordered/.meta/config/deprecated new file mode 100644 index 0000000..b1cab17 --- /dev/null +++ b/tests/unordered/.meta/config/deprecated @@ -0,0 +1 @@ +json_false diff --git a/tests/unordered/.meta/config/unlocked_by b/tests/unordered/.meta/config/unlocked_by new file mode 100644 index 0000000..48cc97d --- /dev/null +++ b/tests/unordered/.meta/config/unlocked_by @@ -0,0 +1 @@ +json_null diff --git a/tests/unordered/.meta/config/uuid b/tests/unordered/.meta/config/uuid new file mode 100644 index 0000000..d4e1c3c --- /dev/null +++ b/tests/unordered/.meta/config/uuid @@ -0,0 +1 @@ +b6570e32-ed50-4ff9-bc9d-0202aa39b344 diff --git a/tests/unordered/.meta/config/version b/tests/unordered/.meta/config/version new file mode 100644 index 0000000..589268e --- /dev/null +++ b/tests/unordered/.meta/config/version @@ -0,0 +1 @@ +1.3.0 \ No newline at end of file diff --git a/tests/unordered/.meta/example.ijs b/tests/unordered/.meta/example.ijs new file mode 100644 index 0000000..2529234 --- /dev/null +++ b/tests/unordered/.meta/example.ijs @@ -0,0 +1 @@ +rna=: 'UGCA' {~ 'ACGT'&i. \ No newline at end of file diff --git a/tests/unordered/.meta/tests.toml b/tests/unordered/.meta/tests.toml new file mode 100644 index 0000000..6800514 --- /dev/null +++ b/tests/unordered/.meta/tests.toml @@ -0,0 +1,28 @@ +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. + +[b4631f82-c98c-4a2f-90b3-c5c2b6c6f661] +description = "Empty RNA sequence" + +[a9558a3c-318c-4240-9256-5d5ed47005a6] +description = "RNA complement of cytosine is guanine" + +[6eedbb5c-12cb-4c8b-9f51-f8320b4dc2e7] +description = "RNA complement of guanine is cytosine" + +[870bd3ec-8487-471d-8d9a-a25046488d3e] +description = "RNA complement of thymine is adenine" + +[aade8964-02e1-4073-872f-42d3ffd74c5f] +description = "RNA complement of adenine is uracil" + +[79ed2757-f018-4f47-a1d7-34a559392dbf] +description = "RNA complement" diff --git a/tests/unordered/expected_results.json b/tests/unordered/expected_results.json new file mode 100644 index 0000000..d31fe68 --- /dev/null +++ b/tests/unordered/expected_results.json @@ -0,0 +1,42 @@ +{ + "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/results.json b/tests/unordered/results.json new file mode 100644 index 0000000..d31fe68 --- /dev/null +++ b/tests/unordered/results.json @@ -0,0 +1,42 @@ +{ + "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 new file mode 100644 index 0000000..2529234 --- /dev/null +++ b/tests/unordered/rna-transcription.ijs @@ -0,0 +1 @@ +rna=: 'UGCA' {~ 'ACGT'&i. \ No newline at end of file diff --git a/tests/unordered/test.ijs b/tests/unordered/test.ijs new file mode 100644 index 0000000..9448920 --- /dev/null +++ b/tests/unordered/test.ijs @@ -0,0 +1,50 @@ +load 'rna-transcription.ijs' + + +temppath=: < jpath '~temp/helper.txt' + + +before_all=: monad define + order=: i.0 + tasks=: i.0 +) + +after_all=: monad define + (, LF ,~"1 ":order ,. tasks) 1!:2 temppath +) + +test_empty_rna_sequence=: monad define + order=:order , 1 + tasks=: tasks, 1 + assert ''-:rna'' +) + +test_rna_complement_of_cytosine_is_guanine=: monad define + order=:order , 2 + tasks=: tasks, 1 + assert 'C'-:rna'G' +) + +test_rna_complement_of_guanine_is_cytosine=: monad define + order=:order , 3 + tasks=: tasks, 1 + assert 'G'-:rna'C' +) + +test_rna_complement_of_thymine_is_adenine=: monad define + order=:order , 4 + tasks=: tasks, 1 + assert 'A'-:rna'T' +) + +test_rna_complement_of_adenine_is_uracil=: monad define + order=:order , 5 + tasks=: tasks, 1 + assert 'U'-:rna'A' +) + +test_rna_complement=: monad define + order=:order , 6 + tasks=: tasks, 1 + assert 'UGCACCAGAAUU'-:rna'ACGTGGTCTTAA' +)