public void TenMinuteWalkCs_SemiRandomWalk_True() { for (int n = 0; n < 4; n++) { var walk = Enumerable.Repeat('s', n) .Concat(Enumerable.Repeat('n', n)) .Concat(Enumerable.Repeat('w', 5 - n)) .Concat(Enumerable.Repeat('e', 5 - n)) .ToArray(); Assert.IsTrue(TenMinuteWalkCs.isValidWalk(walk), new String(walk)); } }
public void TenMinuteWalkCs_TooShortWalk_False() { Random r = new Random(DateTime.Now.Millisecond); char[] nsew = new char[4] { 'n', 's', 'e', 'w' }; for (int i = 1; i < 10; i++) { char[] walk = new char[i]; for (int j = 0; j < i; j++) { walk[j] = nsew[r.Next(4)]; } Assert.IsFalse(TenMinuteWalkCs.isValidWalk(walk), new String(walk)); } }
public void TenMinuteWalkCs_InfiniteWalk_False() { Assert.AreEqual(false, TenMinuteWalkCs.isValidWalk(new char[] { 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n' })); }
public void TenMinuteWalkCs_ValidWalk2_True() { Assert.AreEqual(true, TenMinuteWalkCs.isValidWalk(new char[] { 'n', 's', 'e', 'w', 'n', 's', 'e', 'w', 'n', 's' })); }