From ff495db07117040d17b1a049aa56a54deb20a794 Mon Sep 17 00:00:00 2001 From: Norman Thomas Date: Tue, 20 Apr 2021 23:17:06 +0200 Subject: [PATCH] Added 2 bsaic test cases for Interval.isEmpty --- plutus-ledger-api/test/Spec.hs | 2 ++ plutus-ledger-api/test/Spec/IntervalSpec.hs | 22 +++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 plutus-ledger-api/test/Spec/IntervalSpec.hs diff --git a/plutus-ledger-api/test/Spec.hs b/plutus-ledger-api/test/Spec.hs index 9912e4dd537..32f623a7c8b 100644 --- a/plutus-ledger-api/test/Spec.hs +++ b/plutus-ledger-api/test/Spec.hs @@ -7,6 +7,7 @@ import Data.Either import Data.Maybe import Plutus.V1.Ledger.Api import Plutus.V1.Ledger.Examples +import qualified Spec.IntervalSpec main :: IO () main = defaultMain tests @@ -25,4 +26,5 @@ tests :: TestTree tests = testGroup "plutus-ledger-api" [ alwaysTrue , alwaysFalse + , Spec.IntervalSpec.tests ] diff --git a/plutus-ledger-api/test/Spec/IntervalSpec.hs b/plutus-ledger-api/test/Spec/IntervalSpec.hs new file mode 100644 index 00000000000..59f0cbd58d6 --- /dev/null +++ b/plutus-ledger-api/test/Spec/IntervalSpec.hs @@ -0,0 +1,22 @@ +module Spec.IntervalSpec where + +import Test.Tasty +import Test.Tasty.HUnit + +import Plutus.V1.Ledger.Interval +import Plutus.V1.Ledger.Slot + +alwaysIsNotEmpty :: TestTree +alwaysIsNotEmpty = testCase "always is not empty" $ + assertBool "always" (not $ isEmpty (always :: Interval Slot)) + +neverIsEmpty :: TestTree +neverIsEmpty = + testCase "never is empty" $ + assertBool "never" (isEmpty (never :: Interval Slot)) + +tests :: TestTree +tests = testGroup "plutus-ledger-api-interval" [ + neverIsEmpty + , alwaysIsNotEmpty + ]