rendering of right margin of abacus
This commit is contained in:
parent
fe9263cfae
commit
ec905651ef
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user