
Try
l = [ 0, 255, 255, 255, 255, 0, 255, 255, 255, 255 , 0, 255, 255, 255, 255, 0] testConvertToList01 = TestCase $ do img <- readImage "../data-test/diagonalImage.pgm" assertEqual "" l (convertToList img)
A TestCase is just an IO action (take a look at the HUnit source code). Alistair. Dmitri Pissarenko wrote:
Hello!
Thanks for your answer!
You probably want something like...
l = [0, 255, 255, 255, 255, 0, 255, 255, 255, 255, 0, 255, 255, 255, 255, 0] testConvertToList01 = do img <- readImage "../data-test/diagonalImage.pgm" return $ TestCase $ assertEqual "" l (convertToList img)
When I use this test case definition, I'm getting an error when constructing the test suite:
tests = TestList [testCommentLine01, testCommentLine02, testConvertToList01]
GHCi writes
TestLik.hs:22: Couldn't match `Test' against `IO Test' Expected type: Test Inferred type: IO Test In the list element: testConvertToList01 In the first argument of `TestList', namely `[testCommentLine01, testCommentLine02, testConvertToList01]'
Best regards
Dmitri Pissarenko -- Dmitri Pissarenko Software Engineer http://dapissarenko.com
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe