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

feature(t3.rexx): implement 'output' procedure #139

Merged
merged 1 commit into from
Aug 1, 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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions exercises/practice/accumulate/testlib/t3.rexx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

/* functions for the test framework */

init:
init :
parse upper arg outputType
checkNumber = 0
count = 0
Expand All @@ -32,15 +32,22 @@ init:
divider = '----------------------------------------'
spacer = ' '
EOL = "0A"X
output. = '' ; output.0 = 0
return

output : procedure expose output.
parse arg line
output.0 = output.0 + 1
n = output.0 ; output.n = line
return ''

context : procedure expose contextdesc TASK_ID
parse arg desc, task_identifier
contextdesc = desc
if task_identifier \= '' then ; TASK_ID = task_identifier
return ''

check:
check :
parse arg description, procedureCall, variableName, operation, expectedValue
checkNumber = checkNumber + 1

Expand Down Expand Up @@ -81,13 +88,18 @@ check:
testCode = procedureCall op expectedValue
else
testCode = procedureCall op "'"expectedValue"'"
/* Assemble collected output */
output = ''
do i = 1 to output.0
output = output || output.i || EOL
end
/* Package test results as JSON */
checkresult.count = ,
MakeJSONTestResult( ,
description,,
testStatus,,
'Expected' expectedValue conjunction 'got' returnedValue,,
'',,
output,,
testCode,,
TASK_ID,,
EOL)
Expand All @@ -98,7 +110,7 @@ check:

return ''

expect:
expect :
parse arg actual, variableName, op, expected

if variableName <> '' then
Expand Down Expand Up @@ -166,8 +178,9 @@ return text

MakeJSONTestResult : procedure
parse arg name, status, message, output, test_code, task_id, eol
message = CHANGESTR('"', CHANGESTR("0A"X, message, '\n'), '\"')
test_code = CHANGESTR('"', CHANGESTR("0A"X, test_code, '\n'), '\"')
message = CHANGESTR('"', CHANGESTR(eol, message, '\n'), '\"')
output = CHANGESTR('"', CHANGESTR(eol, output, '\n'), '\"')
test_code = CHANGESTR('"', CHANGESTR(eol, test_code, '\n'), '\"')
json = ,
' {' || eol || ,
' "name": "' || name || '",' || eol || ,
Expand Down
25 changes: 19 additions & 6 deletions exercises/practice/acronym/testlib/t3.rexx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

/* functions for the test framework */

init:
init :
parse upper arg outputType
checkNumber = 0
count = 0
Expand All @@ -32,15 +32,22 @@ init:
divider = '----------------------------------------'
spacer = ' '
EOL = "0A"X
output. = '' ; output.0 = 0
return

output : procedure expose output.
parse arg line
output.0 = output.0 + 1
n = output.0 ; output.n = line
return ''

context : procedure expose contextdesc TASK_ID
parse arg desc, task_identifier
contextdesc = desc
if task_identifier \= '' then ; TASK_ID = task_identifier
return ''

check:
check :
parse arg description, procedureCall, variableName, operation, expectedValue
checkNumber = checkNumber + 1

Expand Down Expand Up @@ -81,13 +88,18 @@ check:
testCode = procedureCall op expectedValue
else
testCode = procedureCall op "'"expectedValue"'"
/* Assemble collected output */
output = ''
do i = 1 to output.0
output = output || output.i || EOL
end
/* Package test results as JSON */
checkresult.count = ,
MakeJSONTestResult( ,
description,,
testStatus,,
'Expected' expectedValue conjunction 'got' returnedValue,,
'',,
output,,
testCode,,
TASK_ID,,
EOL)
Expand All @@ -98,7 +110,7 @@ check:

return ''

expect:
expect :
parse arg actual, variableName, op, expected

if variableName <> '' then
Expand Down Expand Up @@ -166,8 +178,9 @@ return text

MakeJSONTestResult : procedure
parse arg name, status, message, output, test_code, task_id, eol
message = CHANGESTR('"', CHANGESTR("0A"X, message, '\n'), '\"')
test_code = CHANGESTR('"', CHANGESTR("0A"X, test_code, '\n'), '\"')
message = CHANGESTR('"', CHANGESTR(eol, message, '\n'), '\"')
output = CHANGESTR('"', CHANGESTR(eol, output, '\n'), '\"')
test_code = CHANGESTR('"', CHANGESTR(eol, test_code, '\n'), '\"')
json = ,
' {' || eol || ,
' "name": "' || name || '",' || eol || ,
Expand Down
25 changes: 19 additions & 6 deletions exercises/practice/all-your-base/testlib/t3.rexx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

/* functions for the test framework */

init:
init :
parse upper arg outputType
checkNumber = 0
count = 0
Expand All @@ -32,15 +32,22 @@ init:
divider = '----------------------------------------'
spacer = ' '
EOL = "0A"X
output. = '' ; output.0 = 0
return

output : procedure expose output.
parse arg line
output.0 = output.0 + 1
n = output.0 ; output.n = line
return ''

context : procedure expose contextdesc TASK_ID
parse arg desc, task_identifier
contextdesc = desc
if task_identifier \= '' then ; TASK_ID = task_identifier
return ''

check:
check :
parse arg description, procedureCall, variableName, operation, expectedValue
checkNumber = checkNumber + 1

Expand Down Expand Up @@ -81,13 +88,18 @@ check:
testCode = procedureCall op expectedValue
else
testCode = procedureCall op "'"expectedValue"'"
/* Assemble collected output */
output = ''
do i = 1 to output.0
output = output || output.i || EOL
end
/* Package test results as JSON */
checkresult.count = ,
MakeJSONTestResult( ,
description,,
testStatus,,
'Expected' expectedValue conjunction 'got' returnedValue,,
'',,
output,,
testCode,,
TASK_ID,,
EOL)
Expand All @@ -98,7 +110,7 @@ check:

return ''

expect:
expect :
parse arg actual, variableName, op, expected

if variableName <> '' then
Expand Down Expand Up @@ -166,8 +178,9 @@ return text

MakeJSONTestResult : procedure
parse arg name, status, message, output, test_code, task_id, eol
message = CHANGESTR('"', CHANGESTR("0A"X, message, '\n'), '\"')
test_code = CHANGESTR('"', CHANGESTR("0A"X, test_code, '\n'), '\"')
message = CHANGESTR('"', CHANGESTR(eol, message, '\n'), '\"')
output = CHANGESTR('"', CHANGESTR(eol, output, '\n'), '\"')
test_code = CHANGESTR('"', CHANGESTR(eol, test_code, '\n'), '\"')
json = ,
' {' || eol || ,
' "name": "' || name || '",' || eol || ,
Expand Down
25 changes: 19 additions & 6 deletions exercises/practice/anagram/testlib/t3.rexx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

/* functions for the test framework */

init:
init :
parse upper arg outputType
checkNumber = 0
count = 0
Expand All @@ -32,15 +32,22 @@ init:
divider = '----------------------------------------'
spacer = ' '
EOL = "0A"X
output. = '' ; output.0 = 0
return

output : procedure expose output.
parse arg line
output.0 = output.0 + 1
n = output.0 ; output.n = line
return ''

context : procedure expose contextdesc TASK_ID
parse arg desc, task_identifier
contextdesc = desc
if task_identifier \= '' then ; TASK_ID = task_identifier
return ''

check:
check :
parse arg description, procedureCall, variableName, operation, expectedValue
checkNumber = checkNumber + 1

Expand Down Expand Up @@ -81,13 +88,18 @@ check:
testCode = procedureCall op expectedValue
else
testCode = procedureCall op "'"expectedValue"'"
/* Assemble collected output */
output = ''
do i = 1 to output.0
output = output || output.i || EOL
end
/* Package test results as JSON */
checkresult.count = ,
MakeJSONTestResult( ,
description,,
testStatus,,
'Expected' expectedValue conjunction 'got' returnedValue,,
'',,
output,,
testCode,,
TASK_ID,,
EOL)
Expand All @@ -98,7 +110,7 @@ check:

return ''

expect:
expect :
parse arg actual, variableName, op, expected

if variableName <> '' then
Expand Down Expand Up @@ -166,8 +178,9 @@ return text

MakeJSONTestResult : procedure
parse arg name, status, message, output, test_code, task_id, eol
message = CHANGESTR('"', CHANGESTR("0A"X, message, '\n'), '\"')
test_code = CHANGESTR('"', CHANGESTR("0A"X, test_code, '\n'), '\"')
message = CHANGESTR('"', CHANGESTR(eol, message, '\n'), '\"')
output = CHANGESTR('"', CHANGESTR(eol, output, '\n'), '\"')
test_code = CHANGESTR('"', CHANGESTR(eol, test_code, '\n'), '\"')
json = ,
' {' || eol || ,
' "name": "' || name || '",' || eol || ,
Expand Down
25 changes: 19 additions & 6 deletions exercises/practice/armstrong-numbers/testlib/t3.rexx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

/* functions for the test framework */

init:
init :
parse upper arg outputType
checkNumber = 0
count = 0
Expand All @@ -32,15 +32,22 @@ init:
divider = '----------------------------------------'
spacer = ' '
EOL = "0A"X
output. = '' ; output.0 = 0
return

output : procedure expose output.
parse arg line
output.0 = output.0 + 1
n = output.0 ; output.n = line
return ''

context : procedure expose contextdesc TASK_ID
parse arg desc, task_identifier
contextdesc = desc
if task_identifier \= '' then ; TASK_ID = task_identifier
return ''

check:
check :
parse arg description, procedureCall, variableName, operation, expectedValue
checkNumber = checkNumber + 1

Expand Down Expand Up @@ -81,13 +88,18 @@ check:
testCode = procedureCall op expectedValue
else
testCode = procedureCall op "'"expectedValue"'"
/* Assemble collected output */
output = ''
do i = 1 to output.0
output = output || output.i || EOL
end
/* Package test results as JSON */
checkresult.count = ,
MakeJSONTestResult( ,
description,,
testStatus,,
'Expected' expectedValue conjunction 'got' returnedValue,,
'',,
output,,
testCode,,
TASK_ID,,
EOL)
Expand All @@ -98,7 +110,7 @@ check:

return ''

expect:
expect :
parse arg actual, variableName, op, expected

if variableName <> '' then
Expand Down Expand Up @@ -166,8 +178,9 @@ return text

MakeJSONTestResult : procedure
parse arg name, status, message, output, test_code, task_id, eol
message = CHANGESTR('"', CHANGESTR("0A"X, message, '\n'), '\"')
test_code = CHANGESTR('"', CHANGESTR("0A"X, test_code, '\n'), '\"')
message = CHANGESTR('"', CHANGESTR(eol, message, '\n'), '\"')
output = CHANGESTR('"', CHANGESTR(eol, output, '\n'), '\"')
test_code = CHANGESTR('"', CHANGESTR(eol, test_code, '\n'), '\"')
json = ,
' {' || eol || ,
' "name": "' || name || '",' || eol || ,
Expand Down
Loading