diff --git a/scratchpad/src/test/scala/com/htmlism/scratchpad/ComplicatedResourceSuite.scala b/scratchpad/src/test/scala/com/htmlism/scratchpad/ComplicatedResourceSuite.scala index 0bc3bec..0b15016 100644 --- a/scratchpad/src/test/scala/com/htmlism/scratchpad/ComplicatedResourceSuite.scala +++ b/scratchpad/src/test/scala/com/htmlism/scratchpad/ComplicatedResourceSuite.scala @@ -12,21 +12,22 @@ object ComplicatedResourceSuite extends FunSuite: def setHead(x: Int)(using W: WriteLease[A]): Asm2[Register.A, A] = Move.constA(x, W.to(_.headAddr)) + class FastLease[A](x: A) extends WriteLease[A]: + def canon: A = + x + class PlayerOne extends Player[PlayerOne](40) object PlayerOne extends PlayerOne: - given WriteLease[PlayerOne] with - def canon: PlayerOne = - PlayerOne + val lease: WriteLease[PlayerOne] = + FastLease(PlayerOne) class PlayerTwo extends Player[PlayerTwo](80) object PlayerTwo extends PlayerTwo: - given WriteLease[PlayerTwo] with - def canon: PlayerTwo = - PlayerTwo + val lease: WriteLease[PlayerTwo] = + FastLease(PlayerTwo) test("use write lease") { - // TODO actually this doesn't make sense. the lease shouldn't be canonical/globally available. only when lease is given... - expect.eql(List("LDA", "STA"), PlayerOne.setHead(0).xs) + expect.eql(List("LDA", "STA"), PlayerOne.setHead(0)(using PlayerOne.lease).xs) }