1. Thijs Alkemade
  2. haskell-unittyped

Commits

Takayuki Muranushi  committed f39b7a3

start testing unbox.

  • Participants
  • Parent commits 017b0c8
  • Branches default

Comments (0)

Files changed (2)

File tests/TestUnbox.hs

View file
+{-# LANGUAGE KindSignatures, DataKinds, MultiParamTypeClasses, FunctionalDependencies, ExistentialQuantification, TypeFamilies #-}
+module Main where
+
+import UnitTyped
+import UnitTyped.SI
+import UnitTyped.SI.Derived
+import UnitTyped.SI.Derived.Length
+import UnitTyped.SI.Derived.Mass
+import UnitTyped.SI.Derived.Count
+import UnitTyped.SI.Derived.Time
+import UnitTyped.SI.Meta
+import UnitTyped.SI.Constants
+import UnitTyped.Bytes
+import UnitTyped.NoPrelude
+import UnitTyped.SI.Show
+
+import qualified Prelude
+import Control.Monad (foldM, unless)
+import qualified Data.Vector.Unboxed as VU
+import Prelude (zip, show, (++), IO, Bool(..), Integer, return, error, putStrLn)
+import System.Exit (exitFailure)
+
+
+t1 = hertz == (1 /| second)
+
+runTest :: Bool -> (Bool, Integer) -> IO Bool
+runTest b (True, _) = return b
+runTest b (False, i) = do { putStrLn ("Test " ++ show i ++ " failed.")
+                                                  ; return False
+                                                  }
+
+main = do { b <- foldM runTest True (zip [t1] [1..])
+                  ; unless b exitFailure
+                  }

File unittyped.cabal

View file
   tag: 0.2
 
 library
-  build-depends:   base >= 4.6 && < 4.7, time, old-locale, containers
+  build-depends:   base >= 4.6 && < 4.7, vector >= 0.10, time, old-locale, containers
   extensions:      FlexibleInstances
                    UndecidableInstances
                    FunctionalDependencies
     type:          exitcode-stdio-1.0
     main-is:       tests/TestSI.hs
     build-depends: base >= 4.6 && < 4.7, unittyped
+
+Test-Suite test-unbox
+    type:          exitcode-stdio-1.0
+    main-is:       tests/TestUnbox.hs
+    build-depends: base >= 4.6 && < 4.7, unittyped, vector >= 0.10