@@ -16,7 +16,7 @@ func Test_loading_list(t *testing.T) {
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
ingredients := len(l.possibleIngredientAllergens)
|
||||
ingredients := len(l.ingredientAllergens)
|
||||
if ingredients != 7 {
|
||||
t.Logf("Expected 7 ingredients, found %d", ingredients)
|
||||
t.FailNow()
|
||||
@@ -38,3 +38,35 @@ func Test_find_allergenfree(t *testing.T) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
func Test_canonical_list(t *testing.T) {
|
||||
l := list{}
|
||||
err := l.load("sample.txt")
|
||||
if err != nil {
|
||||
t.Logf(err.Error())
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
l.isolateIngredientAllergens()
|
||||
list := l.canonicalDangerList()
|
||||
if list != "mxmxvkd,sqjhc,fvjkl" {
|
||||
t.Logf("Expected list of mxmxvkd,sqjhc,fvjkl, got %s", list)
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
||||
func Test_fullcanonical_list(t *testing.T) {
|
||||
l := list{}
|
||||
err := l.load("input.txt")
|
||||
if err != nil {
|
||||
t.Logf(err.Error())
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
l.isolateIngredientAllergens()
|
||||
list := l.canonicalDangerList()
|
||||
if list != "vmhqr,qxfzc,khpdjv,gnrpml,xrmxxvn,rfmvh,rdfr,jxh" {
|
||||
t.Logf("Expected list \"vmhqr,qxfzc,khpdjv,gnrpml,xrmxxvn,rfmvh,rdfr,jxh\", got %s", list)
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user