mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2025-04-04 05:30:25 +00:00
correct lease visibility
This commit is contained in:
parent
87be54418f
commit
a13a366b2c
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user