Skip to content

trinary: Make exercise schema-compliant #645

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

Merged
merged 2 commits into from
Mar 7, 2017
Merged
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
135 changes: 75 additions & 60 deletions exercises/trinary/canonical-data.json
Original file line number Diff line number Diff line change
@@ -1,62 +1,77 @@
{
"to_decimal": {
"description": "returns the decimal representation of the input trinary value",
"cases": [
{
"description": "trinary 1 is decimal 1",
"input": 1,
"expected": 1
},
{
"description": "trinary 2 is decimal 2",
"input": 2,
"expected": 2
},
{
"description": "trinary 10 is decimal 3",
"input": 10,
"expected": 3
},
{
"description": "trinary 11 is decimal 4",
"input": 11,
"expected": 4
},
{
"description": "trinary 100 is decimal 9",
"input": 100,
"expected": 9
},
{
"description": "trinary 112 is decimal 14",
"input": 112,
"expected": 14
},
{
"description": "trinary 222 is decimal 26",
"input": 222,
"expected": 26
},
{
"description": "trinary 1122000120 is decimal 32091",
"input": 1122000120,
"expected": 32091
},
{
"description": "invalid trinary digits returns 0",
"input": "1234",
"expected": 0
},
{
"description": "invalid word as input returns 0",
"input": "carrot",
"expected": 0
},
{
"description": "invalid numbers with letters as input returns 0",
"input": "0a1b2c",
"expected": 0
}
]
}
"exercise": "trinary",
"version": "1.0.0",
"cases": [
{
"description": "returns the decimal representation of the input trinary value",
"cases": [
{
"description": "trinary 1 is decimal 1",
"property": "toDecimal",
"input": 1,
"expected": 1
},
{
"description": "trinary 2 is decimal 2",
"property": "toDecimal",
"input": 2,
"expected": 2
},
{
"description": "trinary 10 is decimal 3",
"property": "toDecimal",
"input": 10,
"expected": 3
},
{
"description": "trinary 11 is decimal 4",
"property": "toDecimal",
"input": 11,
"expected": 4
},
{
"description": "trinary 100 is decimal 9",
"property": "toDecimal",
"input": 100,
"expected": 9
},
{
"description": "trinary 112 is decimal 14",
"property": "toDecimal",
"input": 112,
"expected": 14
},
{
"description": "trinary 222 is decimal 26",
"property": "toDecimal",
"input": 222,
"expected": 26
},
{
"description": "trinary 1122000120 is decimal 32091",
"property": "toDecimal",
"input": 1122000120,
"expected": 32091
},
{
"description": "invalid trinary digits returns 0",
"property": "toDecimal",
"input": "1234",
"expected": 0
},
{
"description": "invalid word as input returns 0",
"property": "toDecimal",
"input": "carrot",
"expected": 0
},
{
"description": "invalid numbers with letters as input returns 0",
"property": "toDecimal",
"input": "0a1b2c",
"expected": 0
}
]
}
]
}