Beispiel #1
0
 public void TestTarget()
 {
     Pattern pattern = new Pattern(new PatternElement[] {
         new PatternElement { Count = new[] {1}, Predicate = TargetPredicate, IsTarget = true }
     });
     Assert.IsTrue(pattern.Match(null, new Coords(5, 7), Pattern.Direction.Any));
     Assert.IsFalse(pattern.Match(null, new Coords(7, 5), Pattern.Direction.Any));
 }
Beispiel #2
0
 public void TestRange()
 {
     Pattern pattern = new Pattern(new PatternElement[] {
         new PatternElement { Count = new[] {1}, Predicate = TargetPredicate, IsTarget = true },
         new PatternElement { Count = new[] {1, 2, 3, 4, 5, 6}, Predicate = TruePredicate },
         new PatternElement { Count = new[] {1}, Predicate = TenPredicate },
     });
     Assert.IsFalse(pattern.Match(null, new Coords(5,7), Pattern.Direction.Up));
     Assert.IsTrue(pattern.Match(null, new Coords(5, 7), Pattern.Direction.Down));
 }
Beispiel #3
0
 public void TestEmpty()
 {
     Pattern pattern = new Pattern(new PatternElement[] { });
     Assert.IsTrue(pattern.Match(null, new Coords(1, 2), Pattern.Direction.Any));
 }