- reorganization of tests;
- inclusion of first property tests.
This commit is contained in:
parent
7cb1814535
commit
56b6707bef
5 changed files with 49 additions and 10 deletions
|
@ -24,14 +24,15 @@ library
|
|||
, text >= 1.2.1
|
||||
, time >= 1.5
|
||||
|
||||
test-suite unit-test
|
||||
test-suite tests
|
||||
hs-source-dirs: tests
|
||||
default-language: Haskell2010
|
||||
type: exitcode-stdio-1.0
|
||||
main-is: unit-test.hs
|
||||
main-is: tests.hs
|
||||
build-depends: base >= 4.7 && < 5
|
||||
, billy
|
||||
, tasty >= 0.10
|
||||
, tasty-smallcheck >= 0.3
|
||||
, tasty-hunit >= 0.9
|
||||
, tasty-quickcheck >= 0.8
|
||||
, quickcheck-instances >= 0.3
|
||||
, time >= 1.5
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# For more information, see: https://github.com/commercialhaskell/stack/blob/master/doc/yaml_configuration.md
|
||||
|
||||
# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2)
|
||||
resolver: lts-3.7
|
||||
resolver: lts-6.7
|
||||
|
||||
# Local packages, usually specified by relative directory name
|
||||
packages:
|
||||
|
|
30
tests/Billy/Test/Property.hs
Normal file
30
tests/Billy/Test/Property.hs
Normal file
|
@ -0,0 +1,30 @@
|
|||
module Billy.Test.Property where
|
||||
|
||||
import qualified Billy.Bill as B
|
||||
import qualified Billy.Interval as I
|
||||
import qualified Billy.Payer as P
|
||||
import qualified Billy.Split as S
|
||||
import qualified Data.Time.Calendar as D
|
||||
import Test.QuickCheck.Instances as QCI
|
||||
import Test.Tasty
|
||||
import Test.Tasty.QuickCheck as QC
|
||||
|
||||
propertiesTest :: TestTree
|
||||
propertiesTest = testGroup "Properties Test" [intervalProperties]
|
||||
|
||||
intervalProperties :: TestTree
|
||||
intervalProperties = testGroup "Properties Test for Billy.Interval"
|
||||
[ testProperty "Interval always start with smaller date" $
|
||||
\d1 d2 -> let interval = I.new d1 d2 in
|
||||
if d1 < d2
|
||||
then [d1, d2] == I.toEndpoints interval
|
||||
else [d2, d1] == I.toEndpoints interval
|
||||
, testProperty "Interval is Closed by default" $
|
||||
\d1 d2 -> let interval = I.new d1 d2 in
|
||||
d1 `I.belongsTo` interval
|
||||
&& d2 `I.belongsTo` interval
|
||||
, testProperty "In Open Interval, border-dates are not in it" $
|
||||
\d1 d2 -> let interval = I.open $ I.new d1 d2 in
|
||||
not (d1 `I.belongsTo` interval)
|
||||
&& not (d2 `I.belongsTo` interval)
|
||||
]
|
|
@ -1,6 +1,6 @@
|
|||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Main where
|
||||
module Billy.Test.UnitTest where
|
||||
|
||||
import qualified Billy.Bill as B
|
||||
import qualified Billy.Interval as I
|
||||
|
@ -10,11 +10,8 @@ import qualified Data.Time.Calendar as D
|
|||
import Test.Tasty
|
||||
import Test.Tasty.HUnit
|
||||
|
||||
main :: IO ()
|
||||
main = defaultMain tests
|
||||
|
||||
tests :: TestTree
|
||||
tests = testGroup "Tests" [intervalUnitTests, splitUnitTests]
|
||||
unitTests :: TestTree
|
||||
unitTests = testGroup "Unit Tests" [intervalUnitTests, splitUnitTests]
|
||||
|
||||
intervalUnitTests :: TestTree
|
||||
intervalUnitTests = testGroup "Unit Tests for Billy.Interval"
|
11
tests/tests.hs
Normal file
11
tests/tests.hs
Normal file
|
@ -0,0 +1,11 @@
|
|||
module Main where
|
||||
|
||||
import Billy.Test.Property
|
||||
import Billy.Test.UnitTest
|
||||
import Test.Tasty
|
||||
|
||||
main :: IO ()
|
||||
main = defaultMain tests
|
||||
|
||||
tests :: TestTree
|
||||
tests = testGroup "Tests" [unitTests, propertiesTest]
|
Loading…
Reference in a new issue