rendering of right margin of abacus

This commit is contained in:
Jonathan Lamothe 2024-08-21 20:48:01 -04:00
parent fe9263cfae
commit ec905651ef
2 changed files with 20 additions and 3 deletions

View File

@ -62,6 +62,10 @@ beads a = map
(rungList a) (rungList a)
abacusRight :: AppState -> [String] abacusRight :: AppState -> [String]
abacusRight = undefined abacusRight a =
" " : map
(\n -> if n == a^.rungNum then "<" else " ")
[0..pred (getNumRungs $ a^.abacus)]
++ [" "]
--jl --jl

View File

@ -117,7 +117,20 @@ beadsSpec = describe "beads" $ mapM_
] ]
abacusRightSpec :: Spec abacusRightSpec :: Spec
abacusRightSpec = describe "abacusRight" $ abacusRightSpec = describe "abacusRight" $ mapM_
return () ( \(desc, state, expected) -> context desc $
it ("should be " ++ show expected) $
abacusRight state `shouldBe` expected
)
[ ( "initial state", initialState, initRes )
, ( "rung 5", r5State, r5Res )
, ( "negative rung", negState, negRes )
]
where
r5State = initialState & rungNum .~ 5
negState = initialState & rungNum .~ (-1)
initRes = map (:[]) " < "
r5Res = map (:[]) " < "
negRes = map (:[]) " "
--jl --jl