summaryrefslogtreecommitdiff
path: root/packages/tests
diff options
context:
space:
mode:
authorDominic Steinitz <dominic@steinitz.org>2018-04-03 07:41:34 +0100
committerDominic Steinitz <dominic@steinitz.org>2018-04-03 07:41:34 +0100
commit62d745b157313909c275a00cdb0226741678031b (patch)
treee3ff2d556ce9c0b653d25879a1336ca5ed1ced2a /packages/tests
parent617625917faa0d8ab514de2b4f0a178e66dfbf1d (diff)
parent6c120cf8c1271da8c39926b47384ac1b117e7c96 (diff)
Merge branch 'master' into sundials-clean
Diffstat (limited to 'packages/tests')
-rw-r--r--packages/tests/src/Numeric/GSL/Tests.hs2
-rw-r--r--packages/tests/src/Numeric/LinearAlgebra/Tests.hs13
-rw-r--r--packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs8
-rw-r--r--packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs5
-rw-r--r--packages/tests/src/TestBase.hs1
-rw-r--r--packages/tests/src/TestGSL.hs1
6 files changed, 19 insertions, 11 deletions
diff --git a/packages/tests/src/Numeric/GSL/Tests.hs b/packages/tests/src/Numeric/GSL/Tests.hs
index 025427b..ed15935 100644
--- a/packages/tests/src/Numeric/GSL/Tests.hs
+++ b/packages/tests/src/Numeric/GSL/Tests.hs
@@ -1,4 +1,4 @@
1{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-incomplete-patterns #-} 1{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-incomplete-patterns -fno-warn-missing-signatures #-}
2{- | 2{- |
3Module : Numeric.GLS.Tests 3Module : Numeric.GLS.Tests
4Copyright : (c) Alberto Ruiz 2014 4Copyright : (c) Alberto Ruiz 2014
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs
index 2aefc87..960c777 100644
--- a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs
+++ b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs
@@ -1,5 +1,5 @@
1{-# LANGUAGE CPP #-} 1{-# LANGUAGE CPP #-}
2{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-incomplete-patterns #-} 2{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-incomplete-patterns -fno-warn-missing-signatures #-}
3{-# LANGUAGE DataKinds #-} 3{-# LANGUAGE DataKinds #-}
4{-# LANGUAGE TypeFamilies #-} 4{-# LANGUAGE TypeFamilies #-}
5{-# LANGUAGE FlexibleContexts #-} 5{-# LANGUAGE FlexibleContexts #-}
@@ -31,7 +31,7 @@ module Numeric.LinearAlgebra.Tests(
31--, runBigTests 31--, runBigTests
32) where 32) where
33 33
34import Numeric.LinearAlgebra hiding (unitary) 34import Numeric.LinearAlgebra
35import Numeric.LinearAlgebra.Devel 35import Numeric.LinearAlgebra.Devel
36import Numeric.LinearAlgebra.Static(L) 36import Numeric.LinearAlgebra.Static(L)
37import Numeric.LinearAlgebra.Tests.Instances 37import Numeric.LinearAlgebra.Tests.Instances
@@ -514,7 +514,7 @@ indexProp g f x = a1 == g a2 && a2 == a3 && b1 == g b2 && b2 == b3
514 514
515-------------------------------------------------------------------------------- 515--------------------------------------------------------------------------------
516 516
517sliceTest = utest "slice test" $ and 517_sliceTest = utest "slice test" $ and
518 [ testSlice (chol . trustSym) (gen 5 :: Matrix R) 518 [ testSlice (chol . trustSym) (gen 5 :: Matrix R)
519 , testSlice (chol . trustSym) (gen 5 :: Matrix C) 519 , testSlice (chol . trustSym) (gen 5 :: Matrix C)
520 , testSlice qr (rec :: Matrix R) 520 , testSlice qr (rec :: Matrix R)
@@ -617,7 +617,7 @@ sliceTest = utest "slice test" $ and
617 617
618 test_qrgr n t x = qrgr n (QR x t) 618 test_qrgr n t x = qrgr n (QR x t)
619 619
620 ok_qrgr x = simeq 1E-15 q q' 620 ok_qrgr x = TestCase . assertBool "ok_qrgr" $ simeq 1E-15 q q'
621 where 621 where
622 (q,_) = qr x 622 (q,_) = qr x
623 atau = qrRaw x 623 atau = qrRaw x
@@ -646,7 +646,8 @@ sliceTest = utest "slice test" $ and
646 rec :: Numeric t => Matrix t 646 rec :: Numeric t => Matrix t
647 rec = subMatrix (0,0) (4,5) (gen 5) 647 rec = subMatrix (0,0) (4,5) (gen 5)
648 648
649 testSlice f x@(size->sz@(r,c)) = all (==f x) (map f (g y1 ++ g y2)) 649 testSlice f x@(size->sz@(r,c)) =
650 TestList . map (TestCase . assertEqual "" (f x)) $ (map f (g y1 ++ g y2))
650 where 651 where
651 subm = subMatrix 652 subm = subMatrix
652 g y = [ subm (a*r,b*c) sz y | a <-[0..2], b <- [0..2]] 653 g y = [ subm (a*r,b*c) sz y | a <-[0..2], b <- [0..2]]
@@ -841,7 +842,7 @@ runTests n = do
841 , staticTest 842 , staticTest
842 , intTest 843 , intTest
843 , modularTest 844 , modularTest
844 , sliceTest 845 -- , sliceTest
845 ] 846 ]
846 when (errors c + failures c > 0) exitFailure 847 when (errors c + failures c > 0) exitFailure
847 return () 848 return ()
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs
index f0bddd0..59230e0 100644
--- a/packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs
+++ b/packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs
@@ -1,4 +1,8 @@
1{-# LANGUAGE CPP, FlexibleContexts, UndecidableInstances, FlexibleInstances, ScopedTypeVariables #-} 1{-# LANGUAGE CPP, FlexibleContexts, UndecidableInstances, FlexibleInstances, ScopedTypeVariables #-}
2
3{-# OPTIONS_GHC -fno-warn-orphans #-}
4{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
5
2----------------------------------------------------------------------------- 6-----------------------------------------------------------------------------
3{- | 7{- |
4Module : Numeric.LinearAlgebra.Tests.Instances 8Module : Numeric.LinearAlgebra.Tests.Instances
@@ -62,7 +66,7 @@ instance KnownNat n => Arbitrary (Static.R n) where
62 n :: Int 66 n :: Int
63 n = fromIntegral (natVal (Proxy :: Proxy n)) 67 n = fromIntegral (natVal (Proxy :: Proxy n))
64 68
65 shrink v = [] 69 shrink _v = []
66 70
67instance (Element a, Arbitrary a) => Arbitrary (Matrix a) where 71instance (Element a, Arbitrary a) => Arbitrary (Matrix a) where
68 arbitrary = do 72 arbitrary = do
@@ -89,7 +93,7 @@ instance (KnownNat n, KnownNat m) => Arbitrary (Static.L m n) where
89 n :: Int 93 n :: Int
90 n = fromIntegral (natVal (Proxy :: Proxy n)) 94 n = fromIntegral (natVal (Proxy :: Proxy n))
91 95
92 shrink mat = [] 96 shrink _mat = []
93 97
94-- a square matrix 98-- a square matrix
95newtype (Sq a) = Sq (Matrix a) deriving Show 99newtype (Sq a) = Sq (Matrix a) deriving Show
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs
index e3a6242..6cd3a9e 100644
--- a/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs
+++ b/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs
@@ -3,6 +3,8 @@
3{-# LANGUAGE TypeFamilies #-} 3{-# LANGUAGE TypeFamilies #-}
4{-# LANGUAGE DataKinds #-} 4{-# LANGUAGE DataKinds #-}
5 5
6{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
7
6----------------------------------------------------------------------------- 8-----------------------------------------------------------------------------
7{- | 9{- |
8Module : Numeric.LinearAlgebra.Tests.Properties 10Module : Numeric.LinearAlgebra.Tests.Properties
@@ -51,14 +53,13 @@ module Numeric.LinearAlgebra.Tests.Properties (
51 , staticVectorBinaryFailProp 53 , staticVectorBinaryFailProp
52) where 54) where
53 55
54import Numeric.LinearAlgebra.HMatrix hiding (Testable,unitary) 56import Numeric.LinearAlgebra.HMatrix hiding (Testable)
55import qualified Numeric.LinearAlgebra.Static as Static 57import qualified Numeric.LinearAlgebra.Static as Static
56import Test.QuickCheck 58import Test.QuickCheck
57 59
58import Data.Binary 60import Data.Binary
59import Data.Binary.Get (runGet) 61import Data.Binary.Get (runGet)
60import Data.Either (isLeft) 62import Data.Either (isLeft)
61import Debug.Trace (traceShowId)
62#if MIN_VERSION_base(4,11,0) 63#if MIN_VERSION_base(4,11,0)
63import Prelude hiding ((<>)) 64import Prelude hiding ((<>))
64#endif 65#endif
diff --git a/packages/tests/src/TestBase.hs b/packages/tests/src/TestBase.hs
index 23fd675..51867b1 100644
--- a/packages/tests/src/TestBase.hs
+++ b/packages/tests/src/TestBase.hs
@@ -1,3 +1,4 @@
1import Numeric.LinearAlgebra.Tests 1import Numeric.LinearAlgebra.Tests
2 2
3main :: IO ()
3main = runTests 20 4main = runTests 20
diff --git a/packages/tests/src/TestGSL.hs b/packages/tests/src/TestGSL.hs
index 112422d..cc6b1e7 100644
--- a/packages/tests/src/TestGSL.hs
+++ b/packages/tests/src/TestGSL.hs
@@ -1,3 +1,4 @@
1import Numeric.GSL.Tests 1import Numeric.GSL.Tests
2 2
3main :: IO ()
3main = runTests 20 4main = runTests 20