Hello,
I am working with NewBinary, I have made a lot of datatypes which are Binary 
instances. Now I want to write some testing for the 
serialization/de-serialization.
I've started with QuickCheck but it seems I can't do IO inside a property of 
QuickCheck, am I right ? If not, how is it done ?
Not being able to work with QuickCheck, I tried HUnit only to find another 
problem (which I would have found with QuickCheck anyway). How do I generate 
a BinHandle where I can write and read what I written ?
Tring to do that I wrote a test for Int:

intSerialization = TestCase (do bh <- openBinMem 1024 []
                                let i :: Int
                                    i = 3
                                put_ bh i
                                i2 <- (get bh) :: IO Int
                                assertEqual "i == i2" i i2)

it didn't work:

*Network.Server.DNS> runTestTT tests
### Error in:   1
user error (HUnit:i == i2
expected: 3
 but got: 209944584)

In general, what method/way do you recommend to test 
serialization/de-serialization (note: I'd like to use QuickCheck if 
possible)?

Thank you.
-- 
Pupeno <[EMAIL PROTECTED]> (http://pupeno.com)

Attachment: pgpOzadl7cc0N.pgp
Description: PGP signature

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to