Skip to content
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

refactor(*): restructure test layout, and modify test infrastructure #127

Merged
merged 2 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions bin/verify-exercises
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ verify_practice_exercise() {
# Check whether exercise is a work-in-progress; if so, skip test, return success
local is_wip=$(jq '.exercises.practice[] | select(.slug=="'${exercise}'") | select(.status=="wip")' config.json)
[ -n "${is_wip}" ] && return 0
# Copy exercise directory contents to temporary directory
# Create temporary directory, and copy exercise directory contents to it
local testdir="$(mktemp -d)"
cp "${srcdir}"/* "${testdir}"/
cp -r "${srcdir}"/* "${testdir}"/
cp "${srcdir}"/.meta/example*.rexx "${testdir}"/
# Prepare and perform exercise tests
echo "Testing ${exercise} ..."
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/accumulate/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"authors": ["ajborla"],
"files": {
"solution": ["accumulate.rexx"],
"solution": ["accumulate.rexx", "accumulate-toplevel.rexx"],
"test": ["test-accumulate"],
"example": [".meta/example.rexx"]
},
Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/accumulate/test-accumulate
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env bash
if [ $# -eq 0 ] ; then ./runt --regina accumulate-check accumulate accumulate-toplevel ; else ./runt "$@" accumulate-check accumulate accumulate-toplevel ; fi
cd "testlib" 2>&1 >/dev/null
if [ $# -eq 0 ] ; then ./runt --regina ../accumulate-check ../accumulate ../accumulate-toplevel ; else ./runt "$@" ../accumulate-check ../accumulate ../accumulate-toplevel ; fi
cd - 2>&1 >/dev/null
4 changes: 3 additions & 1 deletion exercises/practice/accumulate/test-accumulate.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@set options=%*
@if "%1"=="" @set options=--regina
@runt.bat %options% accumulate-check accumulate accumulate-toplevel
cd "testlib"
@call runt.bat %options% ..\accumulate-check ..\accumulate ..\accumulate-toplevel
cd ..
8 changes: 8 additions & 0 deletions exercises/practice/accumulate/testlib/accumulate-funcs.rexx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* accumulate - Additional Test Functions */

/*

Include any test-callable, non-user-visible functions in this file.

*/

File renamed without changes.
2 changes: 1 addition & 1 deletion exercises/practice/acronym/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"authors": ["ajborla"],
"files": {
"solution": ["acronym.rexx"],
"solution": ["acronym.rexx", "acronym-toplevel.rexx"],
"test": ["test-acronym"],
"example": [".meta/example.rexx"]
},
Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/acronym/test-acronym
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env bash
if [ $# -eq 0 ] ; then ./runt --regina acronym-check acronym acronym-toplevel ; else ./runt "$@" acronym-check acronym acronym-toplevel ; fi
cd "testlib" 2>&1 >/dev/null
if [ $# -eq 0 ] ; then ./runt --regina ../acronym-check ../acronym ../acronym-toplevel ; else ./runt "$@" ../acronym-check ../acronym ../acronym-toplevel ; fi
cd - 2>&1 >/dev/null
4 changes: 3 additions & 1 deletion exercises/practice/acronym/test-acronym.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@set options=%*
@if "%1"=="" @set options=--regina
@runt.bat %options% acronym-check acronym acronym-toplevel
cd "testlib"
@call runt.bat %options% ..\acronym-check ..\acronym ..\acronym-toplevel
cd ..
8 changes: 8 additions & 0 deletions exercises/practice/acronym/testlib/acronym-funcs.rexx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* acronym - Additional Test Functions */

/*

Include any test-callable, non-user-visible functions in this file.

*/

File renamed without changes.
2 changes: 1 addition & 1 deletion exercises/practice/all-your-base/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"authors": ["ajborla"],
"files": {
"solution": ["all-your-base.rexx"],
"solution": ["all-your-base.rexx", "all-your-base-toplevel.rexx"],
"test": ["test-all-your-base"],
"example": [".meta/example.rexx"]
},
Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/all-your-base/test-all-your-base
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env bash
if [ $# -eq 0 ] ; then ./runt --regina all-your-base-check all-your-base all-your-base-toplevel ; else ./runt "$@" all-your-base-check all-your-base all-your-base-toplevel ; fi
cd "testlib" 2>&1 >/dev/null
if [ $# -eq 0 ] ; then ./runt --regina ../all-your-base-check ../all-your-base ../all-your-base-toplevel ; else ./runt "$@" ../all-your-base-check ../all-your-base ../all-your-base-toplevel ; fi
cd - 2>&1 >/dev/null
4 changes: 3 additions & 1 deletion exercises/practice/all-your-base/test-all-your-base.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@set options=%*
@if "%1"=="" @set options=--regina
@runt.bat %options% all-your-base-check all-your-base all-your-base-toplevel
cd "testlib"
@call runt.bat %options% ..\all-your-base-check ..\all-your-base ..\all-your-base-toplevel
cd ..
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* all-your-base - Additional Test Functions */

/*

Include any test-callable, non-user-visible functions in this file.

*/

File renamed without changes.
2 changes: 1 addition & 1 deletion exercises/practice/anagram/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"authors": ["ajborla"],
"files": {
"solution": ["anagram.rexx"],
"solution": ["anagram.rexx", "anagram-toplevel.rexx"],
"test": ["test-anagram"],
"example": [".meta/example.rexx"]
},
Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/anagram/test-anagram
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env bash
if [ $# -eq 0 ] ; then ./runt --regina anagram-check anagram anagram-toplevel ; else ./runt "$@" anagram-check anagram anagram-toplevel ; fi
cd "testlib" 2>&1 >/dev/null
if [ $# -eq 0 ] ; then ./runt --regina ../anagram-check ../anagram ../anagram-toplevel ; else ./runt "$@" ../anagram-check ../anagram ../anagram-toplevel ; fi
cd - 2>&1 >/dev/null
4 changes: 3 additions & 1 deletion exercises/practice/anagram/test-anagram.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@set options=%*
@if "%1"=="" @set options=--regina
@runt.bat %options% anagram-check anagram anagram-toplevel
cd "testlib"
@call runt.bat %options% ..\anagram-check ..\anagram ..\anagram-toplevel
cd ..
8 changes: 8 additions & 0 deletions exercises/practice/anagram/testlib/anagram-funcs.rexx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* anagram - Additional Test Functions */

/*

Include any test-callable, non-user-visible functions in this file.

*/

File renamed without changes.
2 changes: 1 addition & 1 deletion exercises/practice/armstrong-numbers/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"authors": ["ajborla"],
"files": {
"solution": ["armstrong-numbers.rexx"],
"solution": ["armstrong-numbers.rexx", "armstrong-numbers-toplevel.rexx"],
"test": ["test-armstrong-numbers"],
"example": [".meta/example.rexx"]
},
Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/armstrong-numbers/test-armstrong-numbers
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env bash
if [ $# -eq 0 ] ; then ./runt --regina armstrong-numbers-check armstrong-numbers armstrong-numbers-toplevel ; else ./runt "$@" armstrong-numbers-check armstrong-numbers armstrong-numbers-toplevel ; fi
cd "testlib" 2>&1 >/dev/null
if [ $# -eq 0 ] ; then ./runt --regina ../armstrong-numbers-check ../armstrong-numbers ../armstrong-numbers-toplevel ; else ./runt "$@" ../armstrong-numbers-check ../armstrong-numbers ../armstrong-numbers-toplevel ; fi
cd - 2>&1 >/dev/null
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@set options=%*
@if "%1"=="" @set options=--regina
@runt.bat %options% armstrong-numbers-check armstrong-numbers armstrong-numbers-toplevel
cd "testlib"
@call runt.bat %options% ..\armstrong-numbers-check ..\armstrong-numbers ..\armstrong-numbers-toplevel
cd ..
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* armstrong-numbers - Additional Test Functions */

/*

Include any test-callable, non-user-visible functions in this file.

*/

File renamed without changes.
2 changes: 1 addition & 1 deletion exercises/practice/atbash-cipher/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"authors": ["ajborla"],
"files": {
"solution": ["atbash-cipher.rexx"],
"solution": ["atbash-cipher.rexx", "atbash-cipher-toplevel.rexx"],
"test": ["test-atbash-cipher"],
"example": [".meta/example.rexx"]
},
Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/atbash-cipher/test-atbash-cipher
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env bash
if [ $# -eq 0 ] ; then ./runt --regina atbash-cipher-check atbash-cipher atbash-cipher-toplevel ; else ./runt "$@" atbash-cipher-check atbash-cipher atbash-cipher-toplevel ; fi
cd "testlib" 2>&1 >/dev/null
if [ $# -eq 0 ] ; then ./runt --regina ../atbash-cipher-check ../atbash-cipher ../atbash-cipher-toplevel ; else ./runt "$@" ../atbash-cipher-check ../atbash-cipher ../atbash-cipher-toplevel ; fi
cd - 2>&1 >/dev/null
4 changes: 3 additions & 1 deletion exercises/practice/atbash-cipher/test-atbash-cipher.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@set options=%*
@if "%1"=="" @set options=--regina
@runt.bat %options% atbash-cipher-check atbash-cipher atbash-cipher-toplevel
cd "testlib"
@call runt.bat %options% ..\atbash-cipher-check ..\atbash-cipher ..\atbash-cipher-toplevel
cd ..
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* atbash-cipher - Additional Test Functions */

/*

Include any test-callable, non-user-visible functions in this file.

*/

File renamed without changes.
2 changes: 1 addition & 1 deletion exercises/practice/bank-account/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"authors": ["ajborla"],
"files": {
"solution": ["bank-account.rexx"],
"solution": ["bank-account.rexx", "bank-account-toplevel.rexx"],
"test": ["test-bank-account"],
"example": [".meta/example.rexx"]
},
Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/bank-account/test-bank-account
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env bash
if [ $# -eq 0 ] ; then ./runt --regina bank-account-check bank-account bank-account-toplevel ; else ./runt "$@" bank-account-check bank-account bank-account-toplevel ; fi
cd "testlib" 2>&1 >/dev/null
if [ $# -eq 0 ] ; then ./runt --regina ../bank-account-check ../bank-account ../bank-account-toplevel ; else ./runt "$@" ../bank-account-check ../bank-account ../bank-account-toplevel ; fi
cd - 2>&1 >/dev/null
4 changes: 3 additions & 1 deletion exercises/practice/bank-account/test-bank-account.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@set options=%*
@if "%1"=="" @set options=--regina
@runt.bat %options% bank-account-check bank-account bank-account-toplevel
cd "testlib"
@call runt.bat %options% ..\bank-account-check ..\bank-account ..\bank-account-toplevel
cd ..
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* bank-account - Additional Test Functions */

/*

Include any test-callable, non-user-visible functions in this file.

*/

File renamed without changes.
2 changes: 1 addition & 1 deletion exercises/practice/beer-song/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"authors": ["ajborla"],
"files": {
"solution": ["beer-song.rexx"],
"solution": ["beer-song.rexx", "beer-song-toplevel.rexx"],
"test": ["test-beer-song"],
"example": [".meta/example.rexx"]
},
Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/beer-song/test-beer-song
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env bash
if [ $# -eq 0 ] ; then ./runt --regina beer-song-check beer-song beer-song-toplevel ; else ./runt "$@" beer-song-check beer-song beer-song-toplevel ; fi
cd "testlib" 2>&1 >/dev/null
if [ $# -eq 0 ] ; then ./runt --regina ../beer-song-check ../beer-song ../beer-song-toplevel ; else ./runt "$@" ../beer-song-check ../beer-song ../beer-song-toplevel ; fi
cd - 2>&1 >/dev/null
4 changes: 3 additions & 1 deletion exercises/practice/beer-song/test-beer-song.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@set options=%*
@if "%1"=="" @set options=--regina
@runt.bat %options% beer-song-check beer-song beer-song-toplevel
cd "testlib"
@call runt.bat %options% ..\beer-song-check ..\beer-song ..\beer-song-toplevel
cd ..
8 changes: 8 additions & 0 deletions exercises/practice/beer-song/testlib/beer-song-funcs.rexx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* beer-song - Additional Test Functions */

/*

Include any test-callable, non-user-visible functions in this file.

*/

File renamed without changes.
2 changes: 1 addition & 1 deletion exercises/practice/binary-search/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"authors": ["ajborla"],
"files": {
"solution": ["binary-search.rexx"],
"solution": ["binary-search.rexx", "binary-search-toplevel.rexx"],
"test": ["test-binary-search"],
"example": [".meta/example.rexx"]
},
Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/binary-search/test-binary-search
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env bash
if [ $# -eq 0 ] ; then ./runt --regina binary-search-check binary-search binary-search-toplevel ; else ./runt "$@" binary-search-check binary-search binary-search-toplevel ; fi
cd "testlib" 2>&1 >/dev/null
if [ $# -eq 0 ] ; then ./runt --regina ../binary-search-check ../binary-search ../binary-search-toplevel ; else ./runt "$@" ../binary-search-check ../binary-search ../binary-search-toplevel ; fi
cd - 2>&1 >/dev/null
4 changes: 3 additions & 1 deletion exercises/practice/binary-search/test-binary-search.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@set options=%*
@if "%1"=="" @set options=--regina
@runt.bat %options% binary-search-check binary-search binary-search-toplevel
cd "testlib"
@call runt.bat %options% ..\binary-search-check ..\binary-search ..\binary-search-toplevel
cd ..
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* binary-search - Additional Test Functions */

/*

Include any test-callable, non-user-visible functions in this file.

*/

File renamed without changes.
2 changes: 1 addition & 1 deletion exercises/practice/bob/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"authors": ["ajborla"],
"files": {
"solution": ["bob.rexx"],
"solution": ["bob.rexx", "bob-toplevel.rexx"],
"test": ["test-bob"],
"example": [".meta/example.rexx"]
},
Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/bob/test-bob
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env bash
if [ $# -eq 0 ] ; then ./runt --regina bob-check bob bob-toplevel ; else ./runt "$@" bob-check bob bob-toplevel ; fi
cd "testlib" 2>&1 >/dev/null
if [ $# -eq 0 ] ; then ./runt --regina ../bob-check ../bob ../bob-toplevel ; else ./runt "$@" ../bob-check ../bob ../bob-toplevel ; fi
cd - 2>&1 >/dev/null
4 changes: 3 additions & 1 deletion exercises/practice/bob/test-bob.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@set options=%*
@if "%1"=="" @set options=--regina
@runt.bat %options% bob-check bob bob-toplevel
cd "testlib"
@call runt.bat %options% ..\bob-check ..\bob ..\bob-toplevel
cd ..
8 changes: 8 additions & 0 deletions exercises/practice/bob/testlib/bob-funcs.rexx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* bob - Additional Test Functions */

/*

Include any test-callable, non-user-visible functions in this file.

*/

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion exercises/practice/clock/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"authors": ["ajborla"],
"files": {
"solution": ["clock.rexx"],
"solution": ["clock.rexx", "clock-toplevel.rexx"],
"test": ["test-clock"],
"example": [".meta/example.rexx"]
},
Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/clock/test-clock
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env bash
if [ $# -eq 0 ] ; then ./runt --regina clock-check clock clock-toplevel ; else ./runt "$@" clock-check clock clock-toplevel ; fi
cd "testlib" 2>&1 >/dev/null
if [ $# -eq 0 ] ; then ./runt --regina ../clock-check ../clock ../clock-toplevel ; else ./runt "$@" ../clock-check ../clock ../clock-toplevel ; fi
cd - 2>&1 >/dev/null
4 changes: 3 additions & 1 deletion exercises/practice/clock/test-clock.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@set options=%*
@if "%1"=="" @set options=--regina
@runt.bat %options% clock-check clock clock-toplevel
cd "testlib"
@call runt.bat %options% ..\clock-check ..\clock ..\clock-toplevel
cd ..
8 changes: 8 additions & 0 deletions exercises/practice/clock/testlib/clock-funcs.rexx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* clock - Additional Test Functions */

/*

Include any test-callable, non-user-visible functions in this file.

*/

File renamed without changes.
2 changes: 1 addition & 1 deletion exercises/practice/collatz-conjecture/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"authors": ["ajborla"],
"files": {
"solution": ["collatz-conjecture.rexx"],
"solution": ["collatz-conjecture.rexx", "collatz-conjecture-toplevel.rexx"],
"test": ["test-collatz-conjecture"],
"example": [".meta/example.rexx"]
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env bash
if [ $# -eq 0 ] ; then ./runt --regina collatz-conjecture-check collatz-conjecture collatz-conjecture-toplevel ; else ./runt "$@" collatz-conjecture-check collatz-conjecture collatz-conjecture-toplevel ; fi
cd "testlib" 2>&1 >/dev/null
if [ $# -eq 0 ] ; then ./runt --regina ../collatz-conjecture-check ../collatz-conjecture ../collatz-conjecture-toplevel ; else ./runt "$@" ../collatz-conjecture-check ../collatz-conjecture ../collatz-conjecture-toplevel ; fi
cd - 2>&1 >/dev/null
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@set options=%*
@if "%1"=="" @set options=--regina
@runt.bat %options% collatz-conjecture-check collatz-conjecture collatz-conjecture-toplevel
cd "testlib"
@call runt.bat %options% ..\collatz-conjecture-check ..\collatz-conjecture ..\collatz-conjecture-toplevel
cd ..
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* collatz-conjecture - Additional Test Functions */

/*

Include any test-callable, non-user-visible functions in this file.

*/

File renamed without changes.
2 changes: 1 addition & 1 deletion exercises/practice/custom-set/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"authors": ["ajborla"],
"files": {
"solution": ["custom-set.rexx"],
"solution": ["custom-set.rexx", "custom-set-toplevel.rexx"],
"test": ["test-custom-set"],
"example": [".meta/example.rexx"]
},
Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/custom-set/test-custom-set
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env bash
if [ $# -eq 0 ] ; then ./runt --regina custom-set-check custom-set custom-set-toplevel ; else ./runt "$@" custom-set-check custom-set custom-set-toplevel ; fi
cd "testlib" 2>&1 >/dev/null
if [ $# -eq 0 ] ; then ./runt --regina ../custom-set-check ../custom-set ../custom-set-toplevel ; else ./runt "$@" ../custom-set-check ../custom-set ../custom-set-toplevel ; fi
cd - 2>&1 >/dev/null
Loading