mercredi 20 mai 2020

How to import modules for testing?

I am trying to test some functions using quickCheck for my Haskell project. My directory currently looks like this:

|-cswk2
  |-validCard.hs //THIS FILE CONTAINS MY HASKELL FUNCTIONS 
  |-tests
    |-testSuite.hs //THIS FILE CONTAINS MY QUICKCHECK FUNCTIONS 

Inside my Haskell file i have some functions that i want to test, this looks something like this...

validCard.hs:

module Cswk2 where

getCard :: Integer -> [Integer]
...

...while my test file looks like this.

testSuite.hs:

import Test.QuickCheck
import Test.HUnit
import Cswk2

prop_numb :: [Integer] -> Bool
...

Unfortunately, i keep getting an error saying 'Failed to load interface for Cswk2' and was wondering if it was a problem with the way i have structured my directory for testing. I initially tried using cabal and following the user manual to setup a test suite but that lead to many more problems than this and left me more confused. I am new to Haskell so if anyone could highlight what exactly i am doing wrong and advise me on ways to structure a project for testing that would be greatly appreciated?

Aucun commentaire:

Enregistrer un commentaire