Skip to content
Permalink
Browse files

Use Str.Parse in LetterBoxStr[Words] tests

  • Loading branch information...
bobbymcr committed Apr 5, 2019
1 parent 5bc6661 commit bdfc8e06538b444b6d881e45e8037170a08c7aea
Showing with 16 additions and 37 deletions.
  1. +1 −14 test/Words.Test/LetterBoxStrTest.cs
  2. +15 −23 test/Words.Test/LetterBoxStrWordsTest.cs
@@ -113,20 +113,7 @@ public void InputTooShort()

private static LetterBoxStr New()
{
Str box = default(Str)
.Append(Ch.A)
.Append(Ch.B)
.Append(Ch.C)
.Append(Ch.D)
.Append(Ch.E)
.Append(Ch.F)
.Append(Ch.G)
.Append(Ch.H)
.Append(Ch.I)
.Append(Ch.J)
.Append(Ch.K)
.Append(Ch.L);
return new LetterBoxStr(box);
return new LetterBoxStr(Str.Parse("ABCDEFGHIJKL"));
}
}
}
@@ -22,7 +22,7 @@ public void EmptyFindsNothing()
public void OneWordFindsNothing()
{
LetterBoxStrWords words = new LetterBoxStrWords();
words.Add(default(Str).Append(Ch.A).Append(Ch.L).Append(Ch.E), new LetterBoxStr.Vertices(0b100000010001));
words.Add(Str.Parse("ALE"), new LetterBoxStr.Vertices(0b100000010001));

FindSolutions(words).Should().BeEmpty();
}
@@ -31,8 +31,8 @@ public void OneWordFindsNothing()
public void TwoWordsInvalidSolutionFindsNothing()
{
LetterBoxStrWords words = new LetterBoxStrWords();
words.Add(default(Str).Append(Ch.A).Append(Ch.L).Append(Ch.E), new LetterBoxStr.Vertices(0b100000010001));
words.Add(default(Str).Append(Ch.E).Append(Ch.L).Append(Ch.F), new LetterBoxStr.Vertices(0b100000110000));
words.Add(Str.Parse("ALE"), new LetterBoxStr.Vertices(0b100000010001));
words.Add(Str.Parse("ELF"), new LetterBoxStr.Vertices(0b100000110000));

FindSolutions(words).Should().BeEmpty();
}
@@ -41,10 +41,8 @@ public void TwoWordsInvalidSolutionFindsNothing()
public void TwoWordsValidSolutionFindsOne()
{
LetterBoxStrWords words = new LetterBoxStrWords();
Str w1 = default(Str).Append(Ch.A).Append(Ch.D).Append(Ch.B).Append(Ch.E).Append(Ch.C).Append(Ch.F);
Str w2 = default(Str).Append(Ch.F).Append(Ch.G).Append(Ch.J).Append(Ch.H).Append(Ch.K).Append(Ch.I).Append(Ch.L);
words.Add(w1, new LetterBoxStr.Vertices(0b000000111111));
words.Add(w2, new LetterBoxStr.Vertices(0b111111100000));
words.Add(Str.Parse("ADBECF"), new LetterBoxStr.Vertices(0b000000111111));
words.Add(Str.Parse("FGJHKIL"), new LetterBoxStr.Vertices(0b111111100000));

FindSolutions(words).Should().BeEquivalentTo("ADBECF-FGJHKIL");
}
@@ -53,18 +51,12 @@ public void TwoWordsValidSolutionFindsOne()
public void ManyWordsFindsAllSolutions()
{
LetterBoxStrWords words = new LetterBoxStrWords();
Str w1 = default(Str).Append(Ch.A).Append(Ch.D).Append(Ch.B);
words.Add(w1, new LetterBoxStr.Vertices(0b000000001011));
Str w2 = default(Str).Append(Ch.A).Append(Ch.D).Append(Ch.B).Append(Ch.E).Append(Ch.C).Append(Ch.F);
words.Add(w2, new LetterBoxStr.Vertices(0b000000111111));
Str w3 = default(Str).Append(Ch.B).Append(Ch.E).Append(Ch.C).Append(Ch.F).Append(Ch.H).Append(Ch.J).Append(Ch.G).Append(Ch.K).Append(Ch.I).Append(Ch.L);
words.Add(w3, new LetterBoxStr.Vertices(0b111111111110));
Str w4 = default(Str).Append(Ch.F).Append(Ch.G).Append(Ch.J).Append(Ch.H).Append(Ch.K).Append(Ch.I).Append(Ch.L);
words.Add(w4, new LetterBoxStr.Vertices(0b111111100000));
Str w5 = default(Str).Append(Ch.F).Append(Ch.A).Append(Ch.H).Append(Ch.K).Append(Ch.I).Append(Ch.L).Append(Ch.J).Append(Ch.G);
words.Add(w5, new LetterBoxStr.Vertices(0b111111100001));
Str w6 = default(Str).Append(Ch.F).Append(Ch.A).Append(Ch.H).Append(Ch.K).Append(Ch.I).Append(Ch.L).Append(Ch.J);
words.Add(w6, new LetterBoxStr.Vertices(0b111110100001));
words.Add(Str.Parse("ADB"), new LetterBoxStr.Vertices(0b000000001011));
words.Add(Str.Parse("ADBECF"), new LetterBoxStr.Vertices(0b000000111111));
words.Add(Str.Parse("BECFHJGKIL"), new LetterBoxStr.Vertices(0b111111111110));
words.Add(Str.Parse("FGJHKIL"), new LetterBoxStr.Vertices(0b111111100000));
words.Add(Str.Parse("FAHKILJG"), new LetterBoxStr.Vertices(0b111111100001));
words.Add(Str.Parse("FAHKILJ"), new LetterBoxStr.Vertices(0b111110100001));

FindSolutions(words).Should().BeEquivalentTo("ADB-BECFHJGKIL", "ADBECF-FGJHKIL", "ADBECF-FAHKILJG");
}
@@ -76,19 +68,19 @@ public void CountsWords()

words.Count.Should().Be(0);

words.Add(default(Str).Append(Ch.A).Append(Ch.B), default(LetterBoxStr.Vertices));
words.Add(Str.Parse("AB"), default(LetterBoxStr.Vertices));

words.Count.Should().Be(1);

words.Add(default(Str).Append(Ch.A).Append(Ch.B), default(LetterBoxStr.Vertices));
words.Add(Str.Parse("AB"), default(LetterBoxStr.Vertices));

words.Count.Should().Be(1);

words.Add(default(Str).Append(Ch.A).Append(Ch.B).Append(Ch.C), default(LetterBoxStr.Vertices));
words.Add(Str.Parse("ABC"), default(LetterBoxStr.Vertices));

words.Count.Should().Be(2);

words.Add(default(Str).Append(Ch.B).Append(Ch.C).Append(Ch.D), default(LetterBoxStr.Vertices));
words.Add(Str.Parse("ABCD"), default(LetterBoxStr.Vertices));

words.Count.Should().Be(3);
}

0 comments on commit bdfc8e0

Please sign in to comment.
You can’t perform that action at this time.