TDG - Test Driven Golf
popularity-contest
Our company requires unit testing before code can be deployed to production. Unfortunately, my code is written in esoteric programming languages, none of which have test runners.
Please help me get to production!
InputChallenge
Write a test runner for a programming language (here after called Language X) that takes Language X source code and Language X test cases then outputs the results of running the test cases.
Specification
Input
- Source code written in language X
- Test cases written in language X
Output
Output
- List of test cases. For each test case, include:
- The test case name
- A Truthy value if the code executes without errors and no assertions failed
- A Falsey value if the code errors or an assertion failed
Test Runner
Test Runner
- The test runner can be written in any language. The only constraint is that the source and test code language be the same
- Each test runner must at least provide a helper/utility/function to assert that a value is truthy
Assert.True(false)
=> Fails test
assertTrue(1 == 3)
=> Fails test
is_truthy 1
=> Doesn't fail
[[ "a" = "a" ]]
=> Doesn't fail
Test Cases
Test Cases
- Each test case must have a name/be name-able
it("does stuff", _ => ...)
=> it does stuff
it_does_stuff = _ => ...
=> it_does_stuff
func ItDoesStuff() {...}
=> ItDoesStuff
- A code block of language X code
Submissions
Submissions
For consistency, here are some recommendations:
- Title should be:
# Language X runner written in Language Y
- Where Language X is the source and test code language
- And Language Y is the language the runner is written in
- Runner code in a
## Runner
section
- Example input source code in a
## Example Source
section
- Example input test code in a
## Example Tests
section
- Example output in a
## Example Output
section
Sandbox Questions
- Is this problem to big?
- Should this be more constrained?
- I had trouble thinking of what tag to use. Does popularity-contest fit here?