module Main where

import System.IO (BufferMode (LineBuffering), hSetBuffering, hSetEncoding, stdout, utf8)
import qualified Test.Cardano.Ledger.Binary.Failure as Failure
import qualified Test.Cardano.Ledger.Binary.PlainSpec as PlainSpec
import qualified Test.Cardano.Ledger.Binary.RoundTripSpec as RoundTripSpec
import qualified Test.Cardano.Ledger.Binary.Success as Success
import qualified Test.Cardano.Ledger.Binary.Vintage.Coders as Vintage.Coders
import qualified Test.Cardano.Ledger.Binary.Vintage.Drop as Vintage.Drop
import qualified Test.Cardano.Ledger.Binary.Vintage.Failure as Vintage.Failure
import qualified Test.Cardano.Ledger.Binary.Vintage.RoundTrip as Vintage.RoundTrip
import qualified Test.Cardano.Ledger.Binary.Vintage.Serialization as Vintage.Serialization
import qualified Test.Cardano.Ledger.Binary.Vintage.SizeBounds as Vintage.SizeBounds
import Test.Hspec

spec :: Spec
spec :: Spec
spec = do
  forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"Vintage Test Suite" forall a b. (a -> b) -> a -> b
$ do
    forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"RoundTrip" forall a b. (a -> b) -> a -> b
$ IO Bool
Vintage.RoundTrip.tests forall a. (HasCallStack, Show a, Eq a) => IO a -> a -> Expectation
`shouldReturn` Bool
True
    forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"SizeBounds" forall a b. (a -> b) -> a -> b
$ IO Bool
Vintage.SizeBounds.tests forall a. (HasCallStack, Show a, Eq a) => IO a -> a -> Expectation
`shouldReturn` Bool
True
    forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"Serialization" forall a b. (a -> b) -> a -> b
$ IO Bool
Vintage.Serialization.tests forall a. (HasCallStack, Show a, Eq a) => IO a -> a -> Expectation
`shouldReturn` Bool
True
    forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"Drop" forall a b. (a -> b) -> a -> b
$ IO Bool
Vintage.Drop.tests forall a. (HasCallStack, Show a, Eq a) => IO a -> a -> Expectation
`shouldReturn` Bool
True
    forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"Failure" forall a b. (a -> b) -> a -> b
$ IO Bool
Vintage.Failure.tests forall a. (HasCallStack, Show a, Eq a) => IO a -> a -> Expectation
`shouldReturn` Bool
True
    Spec
Vintage.Coders.spec
  Spec
PlainSpec.spec
  forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"Versioned" forall a b. (a -> b) -> a -> b
$ do
    Spec
RoundTripSpec.spec
    Spec
Failure.spec
    Spec
Success.spec

main :: IO ()
Expectation
main = do
  Handle -> BufferMode -> Expectation
hSetBuffering Handle
stdout BufferMode
LineBuffering
  Handle -> TextEncoding -> Expectation
hSetEncoding Handle
stdout TextEncoding
utf8
  Spec -> Expectation
hspec Spec
spec