From: Francis Russell Date: Mon, 7 Jan 2013 16:32:31 +0000 (+0000) Subject: Initial work on supporting a test suite. X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=ce823591d33a8b04a7cd44e2497e4c72d4d99aff;p=francis%2Fofc.git Initial work on supporting a test suite. --- diff --git a/ofc.cabal b/ofc.cabal index 9e91d80..23ca948 100644 --- a/ofc.cabal +++ b/ofc.cabal @@ -22,3 +22,10 @@ Executable ofc Hs-Source-Dirs: src GHC-Options: -Wall Build-Depends: base, ofc + +Test-Suite ofc-tests + Type: exitcode-stdio-1.0 + Hs-Source-Dirs: tests + GHC-Options: -Wall + Main-Is: Main.hs + Build-Depends: base, HUnit, ofc diff --git a/tests/Main.hs b/tests/Main.hs new file mode 100644 index 0000000..93aacfb --- /dev/null +++ b/tests/Main.hs @@ -0,0 +1,18 @@ +module Main where + +import System.Exit (exitFailure, exitSuccess) +import Test.HUnit + +import qualified Tests.Spectral (tests) + +main :: IO () +main = do + results <- runTestTT tests + if (errors results + failures results) > 0 + then exitFailure + else exitSuccess + +tests :: Test +tests = TestList + [ TestLabel "Spectral" Tests.Spectral.tests + ] diff --git a/tests/Tests/Spectral.hs b/tests/Tests/Spectral.hs new file mode 100644 index 0000000..7d8c27c --- /dev/null +++ b/tests/Tests/Spectral.hs @@ -0,0 +1,14 @@ +module Tests.Spectral (tests) where + +import Test.HUnit + +import OFC.Spectral + +tests :: Test +tests = TestList + [ TestCase negateNullBand + ] + +negateNullBand :: Assertion +negateNullBand = (isNullBand $ negateBand nullBand) @? + "Negating the null band produced a non-null band."