|
1 | 1 | {
|
2 |
| - "to_decimal": { |
3 |
| - "description": "returns the decimal representation of the input trinary value", |
4 |
| - "cases": [ |
5 |
| - { |
6 |
| - "description": "trinary 1 is decimal 1", |
7 |
| - "input": 1, |
8 |
| - "expected": 1 |
9 |
| - }, |
10 |
| - { |
11 |
| - "description": "trinary 2 is decimal 2", |
12 |
| - "input": 2, |
13 |
| - "expected": 2 |
14 |
| - }, |
15 |
| - { |
16 |
| - "description": "trinary 10 is decimal 3", |
17 |
| - "input": 10, |
18 |
| - "expected": 3 |
19 |
| - }, |
20 |
| - { |
21 |
| - "description": "trinary 11 is decimal 4", |
22 |
| - "input": 11, |
23 |
| - "expected": 4 |
24 |
| - }, |
25 |
| - { |
26 |
| - "description": "trinary 100 is decimal 9", |
27 |
| - "input": 100, |
28 |
| - "expected": 9 |
29 |
| - }, |
30 |
| - { |
31 |
| - "description": "trinary 112 is decimal 14", |
32 |
| - "input": 112, |
33 |
| - "expected": 14 |
34 |
| - }, |
35 |
| - { |
36 |
| - "description": "trinary 222 is decimal 26", |
37 |
| - "input": 222, |
38 |
| - "expected": 26 |
39 |
| - }, |
40 |
| - { |
41 |
| - "description": "trinary 1122000120 is decimal 32091", |
42 |
| - "input": 1122000120, |
43 |
| - "expected": 32091 |
44 |
| - }, |
45 |
| - { |
46 |
| - "description": "invalid trinary digits returns 0", |
47 |
| - "input": "1234", |
48 |
| - "expected": 0 |
49 |
| - }, |
50 |
| - { |
51 |
| - "description": "invalid word as input returns 0", |
52 |
| - "input": "carrot", |
53 |
| - "expected": 0 |
54 |
| - }, |
55 |
| - { |
56 |
| - "description": "invalid numbers with letters as input returns 0", |
57 |
| - "input": "0a1b2c", |
58 |
| - "expected": 0 |
59 |
| - } |
60 |
| - ] |
61 |
| - } |
| 2 | + "exercise": "trinary", |
| 3 | + "version": "1.0.0", |
| 4 | + "cases": [ |
| 5 | + { |
| 6 | + "description": "returns the decimal representation of the input trinary value", |
| 7 | + "cases": [ |
| 8 | + { |
| 9 | + "description": "trinary 1 is decimal 1", |
| 10 | + "property": "toDecimal", |
| 11 | + "input": 1, |
| 12 | + "expected": 1 |
| 13 | + }, |
| 14 | + { |
| 15 | + "description": "trinary 2 is decimal 2", |
| 16 | + "property": "toDecimal", |
| 17 | + "input": 2, |
| 18 | + "expected": 2 |
| 19 | + }, |
| 20 | + { |
| 21 | + "description": "trinary 10 is decimal 3", |
| 22 | + "property": "toDecimal", |
| 23 | + "input": 10, |
| 24 | + "expected": 3 |
| 25 | + }, |
| 26 | + { |
| 27 | + "description": "trinary 11 is decimal 4", |
| 28 | + "property": "toDecimal", |
| 29 | + "input": 11, |
| 30 | + "expected": 4 |
| 31 | + }, |
| 32 | + { |
| 33 | + "description": "trinary 100 is decimal 9", |
| 34 | + "property": "toDecimal", |
| 35 | + "input": 100, |
| 36 | + "expected": 9 |
| 37 | + }, |
| 38 | + { |
| 39 | + "description": "trinary 112 is decimal 14", |
| 40 | + "property": "toDecimal", |
| 41 | + "input": 112, |
| 42 | + "expected": 14 |
| 43 | + }, |
| 44 | + { |
| 45 | + "description": "trinary 222 is decimal 26", |
| 46 | + "property": "toDecimal", |
| 47 | + "input": 222, |
| 48 | + "expected": 26 |
| 49 | + }, |
| 50 | + { |
| 51 | + "description": "trinary 1122000120 is decimal 32091", |
| 52 | + "property": "toDecimal", |
| 53 | + "input": 1122000120, |
| 54 | + "expected": 32091 |
| 55 | + }, |
| 56 | + { |
| 57 | + "description": "invalid trinary digits returns 0", |
| 58 | + "property": "toDecimal", |
| 59 | + "input": "1234", |
| 60 | + "expected": 0 |
| 61 | + }, |
| 62 | + { |
| 63 | + "description": "invalid word as input returns 0", |
| 64 | + "property": "toDecimal", |
| 65 | + "input": "carrot", |
| 66 | + "expected": 0 |
| 67 | + }, |
| 68 | + { |
| 69 | + "description": "invalid numbers with letters as input returns 0", |
| 70 | + "property": "toDecimal", |
| 71 | + "input": "0a1b2c", |
| 72 | + "expected": 0 |
| 73 | + } |
| 74 | + ] |
| 75 | + } |
| 76 | + ] |
62 | 77 | }
|
0 commit comments