[Haskell-beginners] Inventing QuickCheck properties

Dan Serban dserban01 at gmail.com
Thu Apr 16 10:08:21 UTC 2015


Hi,

I'm writing QuickCheck properties for the swipeLeft function in a game of 2048.
I could think of 3 very basic properties so far and I'm wondering if
you guys can think of any other interesting ones.
Here are mine:
- Verify That It Makes The Number Of Zeroes Go Up
(applies "length . (filter (==0))" to both input and output and then
does a <= comparison)
- Verify That It Cleanly Separates Zeroes To The Right-Hand Side
(applies "all (==0) . snd . break (==0)" to the output)
- Verify that It Preserves The SumTotal
(assert that the sum of all integers is left unchanged)

-Dan


More information about the Beginners mailing list