Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing STM functions purely

I've recently started using STM for some bits in a project of mine, but I'm having trouble figuring out how to test it.

I have no IO in these functions and was hoping I could write QuickCheck properties to test things, but "atomically" (STM a -> IO a) seems to be the only way to get anything out of the STM monad.

Is this possible, or should I just write my tests in HUnit instead?

like image 241
Adam Wagner Avatar asked Nov 13 '22 16:11

Adam Wagner


1 Answers

You can test IO actions with quickcheck: http://hackage.haskell.org/packages/archive/QuickCheck/2.4.1.1/doc/html/Test-QuickCheck-Monadic.html

like image 94
sclv Avatar answered Dec 31 '22 07:12

sclv