Skip to content

Hamming schema #627

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 1 commit into from
Mar 6, 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
225 changes: 121 additions & 104 deletions exercises/hamming/canonical-data.json
Original file line number Diff line number Diff line change
@@ -1,106 +1,123 @@
{
"#": [
"Language implementations vary on the issue of unequal length strands.",
"A language may elect to simplify this task by only presenting equal",
"length test cases. For languages handling unequal length strands as",
"error condition, unequal length test cases are included here and are",
"indicated with an expected value of -1. Note however that -1 is",
"simply an indication here in the JSON. Actually returning -1 from",
"a hamming distance function may or may not be idiomatic in a language.",
"Language idioms of errors or exceptions should be followed.",
"Alternative interpretations such as ignoring excess length at the end",
"are not represented here."
],
"cases": [
{
"description": "identical strands",
"strand1": "A",
"strand2": "A",
"expected": 0
},
{
"description": "long identical strands",
"strand1": "GGACTGA",
"strand2": "GGACTGA",
"expected": 0
},
{
"description": "complete distance in single nucleotide strands",
"strand1": "A",
"strand2": "G",
"expected": 1
},
{
"description": "complete distance in small strands",
"strand1": "AG",
"strand2": "CT",
"expected": 2
},
{
"description": "small distance in small strands",
"strand1": "AT",
"strand2": "CT",
"expected": 1
},
{
"description": "small distance",
"strand1": "GGACG",
"strand2": "GGTCG",
"expected": 1
},
{
"description": "small distance in long strands",
"strand1": "ACCAGGG",
"strand2": "ACTATGG",
"expected": 2
},
{
"description": "non-unique character in first strand",
"strand1": "AGA",
"strand2": "AGG",
"expected": 1
},
{
"description": "non-unique character in second strand",
"strand1": "AGG",
"strand2": "AGA",
"expected": 1
},
{
"description": "same nucleotides in different positions",
"strand1": "TAG",
"strand2": "GAT",
"expected": 2
},
{
"description": "large distance",
"strand1": "GATACA",
"strand2": "GCATAA",
"expected": 4
},
{
"description": "large distance in off-by-one strand",
"strand1": "GGACGGATTCTG",
"strand2": "AGGACGGATTCT",
"expected": 9
},
{
"description": "empty strands",
"strand1": "",
"strand2": "",
"expected": 0
},
{
"description": "disallow first strand longer",
"strand1": "AATG",
"strand2": "AAA",
"expected": -1
},
{
"description": "disallow second strand longer",
"strand1": "ATA",
"strand2": "AGTG",
"expected": -1
}
]
"exercise": "hamming",
"version": "1.0.0",
"comments": [
"Language implementations vary on the issue of unequal length strands.",
"A language may elect to simplify this task by only presenting equal",
"length test cases. For languages handling unequal length strands as",
"error condition, unequal length test cases are included here and are",
"indicated with an expected value of -1. Note however that -1 is",
"simply an indication here in the JSON. Actually returning -1 from",
"a hamming distance function may or may not be idiomatic in a language.",
"Language idioms of errors or exceptions should be followed.",
"Alternative interpretations such as ignoring excess length at the end",
"are not represented here."
],
"cases": [
{
"description": "identical strands",
"property": "distance",
"strand1": "A",
"strand2": "A",
"expected": 0
},
{
"description": "long identical strands",
"property": "distance",
"strand1": "GGACTGA",
"strand2": "GGACTGA",
"expected": 0
},
{
"description": "complete distance in single nucleotide strands",
"property": "distance",
"strand1": "A",
"strand2": "G",
"expected": 1
},
{
"description": "complete distance in small strands",
"property": "distance",
"strand1": "AG",
"strand2": "CT",
"expected": 2
},
{
"description": "small distance in small strands",
"property": "distance",
"strand1": "AT",
"strand2": "CT",
"expected": 1
},
{
"description": "small distance",
"property": "distance",
"strand1": "GGACG",
"strand2": "GGTCG",
"expected": 1
},
{
"description": "small distance in long strands",
"property": "distance",
"strand1": "ACCAGGG",
"strand2": "ACTATGG",
"expected": 2
},
{
"description": "non-unique character in first strand",
"property": "distance",
"strand1": "AGA",
"strand2": "AGG",
"expected": 1
},
{
"description": "non-unique character in second strand",
"property": "distance",
"strand1": "AGG",
"strand2": "AGA",
"expected": 1
},
{
"description": "same nucleotides in different positions",
"property": "distance",
"strand1": "TAG",
"strand2": "GAT",
"expected": 2
},
{
"description": "large distance",
"property": "distance",
"strand1": "GATACA",
"strand2": "GCATAA",
"expected": 4
},
{
"description": "large distance in off-by-one strand",
"property": "distance",
"strand1": "GGACGGATTCTG",
"strand2": "AGGACGGATTCT",
"expected": 9
},
{
"description": "empty strands",
"property": "distance",
"strand1": "",
"strand2": "",
"expected": 0
},
{
"description": "disallow first strand longer",
"property": "distance",
"strand1": "AATG",
"strand2": "AAA",
"expected": -1
},
{
"description": "disallow second strand longer",
"property": "distance",
"strand1": "ATA",
"strand2": "AGTG",
"expected": -1
}
]
}