mirror of
https://github.com/ilyakooo0/vty.git
synced 2024-11-25 19:22:08 +03:00
add missing test file
This commit is contained in:
parent
000f901a93
commit
e83882c35b
28
test/VerifyAttributes.hs
Normal file
28
test/VerifyAttributes.hs
Normal file
@ -0,0 +1,28 @@
|
||||
module VerifyAttributes where
|
||||
|
||||
import Verify
|
||||
|
||||
import Graphics.Vty.Attributes(MaybeDefault(Default, KeepCurrent, SetTo))
|
||||
|
||||
instance Arbitrary a => Arbitrary (MaybeDefault a) where
|
||||
arbitrary = oneof [pure Default, pure KeepCurrent, SetTo <$> arbitrary]
|
||||
|
||||
oldSem :: MaybeDefault a -> MaybeDefault a -> MaybeDefault a
|
||||
oldSem Default Default = Default
|
||||
oldSem Default KeepCurrent = Default
|
||||
oldSem Default (SetTo v) = SetTo v
|
||||
oldSem KeepCurrent Default = Default
|
||||
oldSem KeepCurrent KeepCurrent = KeepCurrent
|
||||
oldSem KeepCurrent (SetTo v) = SetTo v
|
||||
oldSem (SetTo _v) Default = Default
|
||||
oldSem (SetTo v) KeepCurrent = SetTo v
|
||||
oldSem (SetTo _) (SetTo v) = SetTo v
|
||||
|
||||
sameSemigroupValue :: MaybeDefault Int -> MaybeDefault Int -> Bool
|
||||
sameSemigroupValue xa xb = xa <> xb == oldSem xa xb
|
||||
|
||||
tests :: IO [Test]
|
||||
tests = return
|
||||
[ verify "check that the new Semigroup of MaybeDefault is equivalent to the old one" sameSemigroupValue
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user