Skip to content

Commit

Permalink
refactor(*): refactor several exercises (#126)
Browse files Browse the repository at this point in the history
Squash commit of the following commits:

- 2024-07-21 10:51:54 +1000 |ajborla| refactor(leap:config.json): reformat to conform to standard format
- 2024-07-21 10:50:31 +1000 |ajborla| refactor(grains:example.rexx): restructure code for brevity
- 2024-07-21 10:48:36 +1000 |ajborla| refactor(gigasecond-check.rexx): reformat to conform to standard format
  • Loading branch information
ajborla authored Jul 21, 2024
1 parent 3294312 commit 6c4d10a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 27 deletions.
23 changes: 11 additions & 12 deletions exercises/practice/gigasecond/gigasecond-check.rexx
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
/* Unit Test Runner: t-rexx */
function = 'From'
context('Checking the' function 'function')
context('Checking the From function')

/* Test Options */
numeric digits 20

/* Unit tests */
check('date only specification of time' function||'("2011-04-25")',,
function||'("2011-04-25")',, '=', '2043-01-01 01:46:40')
check('date only specification of time' 'From("2011-04-25")',,
'From("2011-04-25")',, '=', '2043-01-01 01:46:40')

check('second test for date only specification of time' function||'("1977-06-13")',,
function||'("1977-06-13")',, '=', '2009-02-19 01:46:40')
check('second test for date only specification of time' 'From("1977-06-13")',,
'From("1977-06-13")',, '=', '2009-02-19 01:46:40')

check('third test for date only specification of time' function||'("1959-07-19")',,
function||'("1959-07-19")',, '=', '1991-03-27 01:46:40')
check('third test for date only specification of time' 'From("1959-07-19")',,
'From("1959-07-19")',, '=', '1991-03-27 01:46:40')

check('full time specified' function||'("2015-01-24", "22:00:00")',,
function||'("2015-01-24", "22:00:00")',, '=', '2046-10-02 23:46:40')
check('full time specified' 'From("2015-01-24", "22:00:00")',,
'From("2015-01-24", "22:00:00")',, '=', '2046-10-02 23:46:40')

check('full time with day roll-over' function||'("2015-01-24", "23:59:59")',,
function||'("2015-01-24", "23:59:59")',,'=', '2046-10-03 01:46:39')
check('full time with day roll-over' 'From("2015-01-24", "23:59:59")',,
'From("2015-01-24", "23:59:59")',, '=', '2046-10-03 01:46:39')

3 changes: 1 addition & 2 deletions exercises/practice/grains/.meta/example.rexx
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ Square : procedure
if n < 1 | n > 64 then ; return -1
else ; return ComputeSquare(n)

Total : procedure
return Square(64) * 2 - 1
Total : procedure ; return Square(64) * 2 - 1
18 changes: 5 additions & 13 deletions exercises/practice/leap/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
{
"authors": [
"ajborla"
],
"authors": ["ajborla"],
"files": {
"solution": [
"leap.rexx"
],
"test": [
"test-leap"
],
"example": [
".meta/example.rexx"
]
"solution": ["leap.rexx"],
"test": ["test-leap"],
"example": [".meta/example.rexx"]
},
"blurb": "Determine whether a given year is a leap year.",
"blurb": "Given a year, report if it is a leap year.",
"source": "CodeRanch Cattle Drive, Assignment 3",
"source_url": "https://coderanch.com/t/718816/Leap"
}

0 comments on commit 6c4d10a

Please sign in to comment.