File tree 1 file changed +62
-0
lines changed
1 file changed +62
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
62
+ }
You can’t perform that action at this time.
0 commit comments