aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-10-13 18:39:42 +0100
committerAkshay <[email protected]>2020-10-13 18:39:42 +0100
commit8b08ea946d1fc73d8363efb633b8063f750520bf (patch)
treec4b0db535597f25f3750628725fd03f43ac59dab
parentf943fc17e5f80f92d20c86de5ea499bbfbe0cd75 (diff)
rework test suite
-rw-r--r--lisk.cabal12
-rw-r--r--tests/Main.hs4
-rw-r--r--tests/Properties.hs24
3 files changed, 22 insertions, 18 deletions
diff --git a/lisk.cabal b/lisk.cabal
index 9578a85..4687e9c 100644
--- a/lisk.cabal
+++ b/lisk.cabal
@@ -19,7 +19,7 @@ extra-source-files: CHANGELOG.md
19library 19library
20 default-language: Haskell2010 20 default-language: Haskell2010
21 build-depends: 21 build-depends:
22 base >=4.12 && <4.13, 22 base == 4.*,
23 parsec == 3.*, 23 parsec == 3.*,
24 mtl >= 2.1 24 mtl >= 2.1
25 hs-source-dirs: src 25 hs-source-dirs: src
@@ -34,7 +34,7 @@ executable lisk
34 default-language: Haskell2010 34 default-language: Haskell2010
35 main-is: Main.hs 35 main-is: Main.hs
36 build-depends: 36 build-depends:
37 base >=4.12 && <4.13, 37 base == 4.*,
38 parsec == 3.*, 38 parsec == 3.*,
39 readline >= 1.0, 39 readline >= 1.0,
40 mtl >= 2.1, 40 mtl >= 2.1,
@@ -47,12 +47,8 @@ test-suite properties
47 main-is: Main.hs 47 main-is: Main.hs
48 hs-source-dirs: tests 48 hs-source-dirs: tests
49 build-depends: 49 build-depends:
50 base >=4.12 && <4.13, 50 base == 4.*,
51 parsec == 3.*, 51 parsec == 3.*,
52 QuickCheck >= 2.4 && < 3, 52 QuickCheck >= 2.1 && < 3,
53 test-framework >= 0.6 && < 0.9,
54 test-framework-hunit >= 0.3 && < 0.5,
55 test-framework-quickcheck2 >= 0.2 && < 0.4,
56 test-framework-th >= 0.2 && < 0.4,
57 lisk 53 lisk
58 other-modules: Properties 54 other-modules: Properties
diff --git a/tests/Main.hs b/tests/Main.hs
index a05ddb1..c4e0d9b 100644
--- a/tests/Main.hs
+++ b/tests/Main.hs
@@ -1,8 +1,6 @@
1module Main where 1module Main where
2 2
3import Properties 3import Properties
4import Test.Framework.Providers.QuickCheck2
5import Test.Framework.Runners.Console (defaultMain)
6import Test.QuickCheck 4import Test.QuickCheck
7 5
8main = defaultMain [ Properties.tests ] 6main = tests
diff --git a/tests/Properties.hs b/tests/Properties.hs
index b42cd4b..e50c7e8 100644
--- a/tests/Properties.hs
+++ b/tests/Properties.hs
@@ -1,15 +1,25 @@
1{-# LANGUAGE TemplateHaskell #-} 1{-# LANGUAGE TemplateHaskell #-}
2module Properties where 2module Properties where
3 3
4import Parser (Expr (..), 4import Parser (Expr (..), parseLispValue, parseQuote)
5 parseLispValue,
6 parseQuote)
7 5
8import Test.Framework.Providers.QuickCheck2
9import Test.Framework.TH
10import Test.QuickCheck 6import Test.QuickCheck
11import Text.ParserCombinators.Parsec
12 7
13-- some tests would go here hopefully 8-- some tests would go here hopefully
14 9
15tests = $testGroupGenerator 10-- a filler test to test the test suite :^)
11qsort :: (Ord a) => [a] -> [a]
12qsort [] = []
13qsort [x] = [x]
14qsort (x:xs) = qsort left ++ [x] ++ qsort right
15 where left = filter (<= x) xs
16 right = filter (> x) xs
17
18checkList :: (Ord a) => [a] -> Bool
19checkList = ordered . qsort
20 where ordered [] = True
21 ordered [x] = True
22 ordered (x:y:xs) = x <= y && ordered (y:xs)
23
24return []
25tests = $quickCheckAll