@@ -4,6 +4,7 @@ import scala.collection.immutable.StringOps
44import org .scalatest .wordspec .AnyWordSpec
55import org .scalatest .matchers .should .Matchers
66import com .sc4nam .module , module .syntax ._ , Implicits ._
7+ import com .sc4nam .module .{NetworkProperties => NP }
78import group ._ , RotFlip ._ , SymGroup ._ , Network ._ , Flags ._
89import RuleTransducer ._
910
@@ -28,39 +29,37 @@ class RuleTransducerSpec extends AnyWordSpec with Matchers {
2829 }
2930 }
3031
31- def makeTileLeft (t : Tile ): Tile = Tile (t.segs map (s => if (! s.network.isTla) s else s.copy(flags = s.flags.spinLeft)))
32- def makeTileRight (t : Tile ): Tile = Tile (t.segs map (s => if (! s.network.isTla) s else s.copy(flags = s.flags.spinRight)))
3332 " Resolver" should {
3433 " resolve left/right-spinned TLAs correctly" in {
3534 val tiles = Seq [Tile ]( Tla3 ~ WE & Road ~ ES , Tla3 ~ WE & Ard3 ~ ES , Tla3 ~ WE & Tla3 ~ ES )
3635 val tile2 = Seq [Tile ]( Tla3 ~ WE , Tla3 ~ WE & Road ~ NS , Tla3 ~ WE & Ard3 ~ NS , Tla3 ~ WE & Tla3 ~ NS )
3736 for (t <- tiles) {
38- resolver(makeTileLeft (t)) should not be resolver(makeTileRight (t))
37+ resolver(NP .projectTlaLeft (t)) should not be resolver(NP .projectTlaRight (t))
3938 }
4039 for (t <- tile2) {
41- resolver(makeTileLeft (t)) should be (resolver(makeTileRight (t)))
40+ resolver(NP .projectTlaLeft (t)) should be (resolver(NP .projectTlaRight (t)))
4241 }
4342 }
4443 " handle flipped left/right-spinned TLAs correctly" in {
4544 val (t1, t2) = ( Tla3 ~ WE & Road ~ ES , Tla3 ~ WE & Road ~ WS )
46- resolver(makeTileLeft (t1)).id should not be (resolver(makeTileLeft (t2)).id)
45+ resolver(NP .projectTlaLeft (t1)).id should not be (resolver(NP .projectTlaLeft (t2)).id)
4746 for ((t, i) <- Seq (t1, t2).zipWithIndex) {
48- makeTileLeft (t).toIdSymTile(resolver).repr.filter(_.flipped ^ (i!= 0 )) should be (Symbol (" empty" ))
49- makeTileRight (t).toIdSymTile(resolver).repr.filter(! _.flipped ^ (i!= 0 )) should be (Symbol (" empty" ))
47+ NP .projectTlaLeft (t).toIdSymTile(resolver).repr.filter(_.flipped ^ (i!= 0 )) should be (Symbol (" empty" ))
48+ NP .projectTlaRight (t).toIdSymTile(resolver).repr.filter(! _.flipped ^ (i!= 0 )) should be (Symbol (" empty" ))
5049 }
5150 }
5251 " find RHS for TLA" in {
53- val rule = (Tla3 ~ WE | (Road ~> Tla3 )~ (2 ,0 ,11 ,0 )) map makeTileLeft map (_.toIdSymTile(resolver))
52+ val rule = (Tla3 ~ WE | (Road ~> Tla3 )~ (2 ,0 ,11 ,0 )) map NP .projectTlaLeft map (_.toIdSymTile(resolver))
5453 possibleMapOrientation(Set (R0F0 , R1F0 ), R3F0 / R2F1 , Quotient .Dih4 , R1F1 / R2F1 ) should not be (Symbol (" empty" ))
5554 createRules(rule, context.tileOrientationCache.cache, context.tileOrientationCache.accum)
5655 }
5756 " resolve diagonal TLA intersections" in {
58- val t1 = makeTileLeft (Tla3 ~ ES & Road ~ WS )
59- val t2 = makeTileRight (Tla3 ~ ES & Road ~ WS )
60- val t3 = makeTileLeft (Tla3 ~ WS & Road ~ ES )
57+ val t1 = NP .projectTlaLeft (Tla3 ~ ES & Road ~ WS )
58+ val t2 = NP .projectTlaRight (Tla3 ~ ES & Road ~ WS )
59+ val t3 = NP .projectTlaLeft (Tla3 ~ WS & Road ~ ES )
6160 resolver(t3) * R0F1 should be (resolver(t2))
6261 resolver(t1).id should not be (resolver(t2).id)
63- resolver(makeTileLeft (Tla3 ~ ES & Tla3 ~ WS )) should be (resolver(makeTileRight (Tla3 ~ ES & Tla3 ~ WS )))
62+ resolver(NP .projectTlaLeft (Tla3 ~ ES & Tla3 ~ WS )) should be (resolver(NP .projectTlaRight (Tla3 ~ ES & Tla3 ~ WS )))
6463 }
6564 }
6665}
0 commit comments