Skip to content

Commit da38f6b

Browse files
authored
Merge pull request #627 from exercism/hamming-schema
Hamming schema
2 parents dad6e03 + bb56dc7 commit da38f6b

File tree

1 file changed

+121
-104
lines changed

1 file changed

+121
-104
lines changed

exercises/hamming/canonical-data.json

Lines changed: 121 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,123 @@
11
{
2-
"#": [
3-
"Language implementations vary on the issue of unequal length strands.",
4-
"A language may elect to simplify this task by only presenting equal",
5-
"length test cases. For languages handling unequal length strands as",
6-
"error condition, unequal length test cases are included here and are",
7-
"indicated with an expected value of -1. Note however that -1 is",
8-
"simply an indication here in the JSON. Actually returning -1 from",
9-
"a hamming distance function may or may not be idiomatic in a language.",
10-
"Language idioms of errors or exceptions should be followed.",
11-
"Alternative interpretations such as ignoring excess length at the end",
12-
"are not represented here."
13-
],
14-
"cases": [
15-
{
16-
"description": "identical strands",
17-
"strand1": "A",
18-
"strand2": "A",
19-
"expected": 0
20-
},
21-
{
22-
"description": "long identical strands",
23-
"strand1": "GGACTGA",
24-
"strand2": "GGACTGA",
25-
"expected": 0
26-
},
27-
{
28-
"description": "complete distance in single nucleotide strands",
29-
"strand1": "A",
30-
"strand2": "G",
31-
"expected": 1
32-
},
33-
{
34-
"description": "complete distance in small strands",
35-
"strand1": "AG",
36-
"strand2": "CT",
37-
"expected": 2
38-
},
39-
{
40-
"description": "small distance in small strands",
41-
"strand1": "AT",
42-
"strand2": "CT",
43-
"expected": 1
44-
},
45-
{
46-
"description": "small distance",
47-
"strand1": "GGACG",
48-
"strand2": "GGTCG",
49-
"expected": 1
50-
},
51-
{
52-
"description": "small distance in long strands",
53-
"strand1": "ACCAGGG",
54-
"strand2": "ACTATGG",
55-
"expected": 2
56-
},
57-
{
58-
"description": "non-unique character in first strand",
59-
"strand1": "AGA",
60-
"strand2": "AGG",
61-
"expected": 1
62-
},
63-
{
64-
"description": "non-unique character in second strand",
65-
"strand1": "AGG",
66-
"strand2": "AGA",
67-
"expected": 1
68-
},
69-
{
70-
"description": "same nucleotides in different positions",
71-
"strand1": "TAG",
72-
"strand2": "GAT",
73-
"expected": 2
74-
},
75-
{
76-
"description": "large distance",
77-
"strand1": "GATACA",
78-
"strand2": "GCATAA",
79-
"expected": 4
80-
},
81-
{
82-
"description": "large distance in off-by-one strand",
83-
"strand1": "GGACGGATTCTG",
84-
"strand2": "AGGACGGATTCT",
85-
"expected": 9
86-
},
87-
{
88-
"description": "empty strands",
89-
"strand1": "",
90-
"strand2": "",
91-
"expected": 0
92-
},
93-
{
94-
"description": "disallow first strand longer",
95-
"strand1": "AATG",
96-
"strand2": "AAA",
97-
"expected": -1
98-
},
99-
{
100-
"description": "disallow second strand longer",
101-
"strand1": "ATA",
102-
"strand2": "AGTG",
103-
"expected": -1
104-
}
105-
]
2+
"exercise": "hamming",
3+
"version": "1.0.0",
4+
"comments": [
5+
"Language implementations vary on the issue of unequal length strands.",
6+
"A language may elect to simplify this task by only presenting equal",
7+
"length test cases. For languages handling unequal length strands as",
8+
"error condition, unequal length test cases are included here and are",
9+
"indicated with an expected value of -1. Note however that -1 is",
10+
"simply an indication here in the JSON. Actually returning -1 from",
11+
"a hamming distance function may or may not be idiomatic in a language.",
12+
"Language idioms of errors or exceptions should be followed.",
13+
"Alternative interpretations such as ignoring excess length at the end",
14+
"are not represented here."
15+
],
16+
"cases": [
17+
{
18+
"description": "identical strands",
19+
"property": "distance",
20+
"strand1": "A",
21+
"strand2": "A",
22+
"expected": 0
23+
},
24+
{
25+
"description": "long identical strands",
26+
"property": "distance",
27+
"strand1": "GGACTGA",
28+
"strand2": "GGACTGA",
29+
"expected": 0
30+
},
31+
{
32+
"description": "complete distance in single nucleotide strands",
33+
"property": "distance",
34+
"strand1": "A",
35+
"strand2": "G",
36+
"expected": 1
37+
},
38+
{
39+
"description": "complete distance in small strands",
40+
"property": "distance",
41+
"strand1": "AG",
42+
"strand2": "CT",
43+
"expected": 2
44+
},
45+
{
46+
"description": "small distance in small strands",
47+
"property": "distance",
48+
"strand1": "AT",
49+
"strand2": "CT",
50+
"expected": 1
51+
},
52+
{
53+
"description": "small distance",
54+
"property": "distance",
55+
"strand1": "GGACG",
56+
"strand2": "GGTCG",
57+
"expected": 1
58+
},
59+
{
60+
"description": "small distance in long strands",
61+
"property": "distance",
62+
"strand1": "ACCAGGG",
63+
"strand2": "ACTATGG",
64+
"expected": 2
65+
},
66+
{
67+
"description": "non-unique character in first strand",
68+
"property": "distance",
69+
"strand1": "AGA",
70+
"strand2": "AGG",
71+
"expected": 1
72+
},
73+
{
74+
"description": "non-unique character in second strand",
75+
"property": "distance",
76+
"strand1": "AGG",
77+
"strand2": "AGA",
78+
"expected": 1
79+
},
80+
{
81+
"description": "same nucleotides in different positions",
82+
"property": "distance",
83+
"strand1": "TAG",
84+
"strand2": "GAT",
85+
"expected": 2
86+
},
87+
{
88+
"description": "large distance",
89+
"property": "distance",
90+
"strand1": "GATACA",
91+
"strand2": "GCATAA",
92+
"expected": 4
93+
},
94+
{
95+
"description": "large distance in off-by-one strand",
96+
"property": "distance",
97+
"strand1": "GGACGGATTCTG",
98+
"strand2": "AGGACGGATTCT",
99+
"expected": 9
100+
},
101+
{
102+
"description": "empty strands",
103+
"property": "distance",
104+
"strand1": "",
105+
"strand2": "",
106+
"expected": 0
107+
},
108+
{
109+
"description": "disallow first strand longer",
110+
"property": "distance",
111+
"strand1": "AATG",
112+
"strand2": "AAA",
113+
"expected": -1
114+
},
115+
{
116+
"description": "disallow second strand longer",
117+
"property": "distance",
118+
"strand1": "ATA",
119+
"strand2": "AGTG",
120+
"expected": -1
121+
}
122+
]
106123
}

0 commit comments

Comments
 (0)