module Main where

import System.IO (
  BufferMode (LineBuffering),
  hSetBuffering,
  hSetEncoding,
  stdout,
  utf8,
 )
import Test.Hspec
import Test.Hspec.Core.Runner (ColorMode (ColorAlways), Config (..), defaultConfig, hspecWith)
import Test.VMap

-- ====================================================================================

customSpecConfig :: Config
customSpecConfig :: Config
customSpecConfig =
  Config
defaultConfig
    { configTimes = True
    , configColorMode = ColorAlways
    }

customSpecMainWithConfig :: Config -> Spec -> IO ()
customSpecMainWithConfig :: Config -> Spec -> IO ()
customSpecMainWithConfig Config
conf Spec
spec = do
  Handle -> BufferMode -> IO ()
hSetBuffering Handle
stdout BufferMode
LineBuffering
  Handle -> TextEncoding -> IO ()
hSetEncoding Handle
stdout TextEncoding
utf8
  Config -> Spec -> IO ()
hspecWith Config
conf Spec
spec

customSpecMain :: Spec -> IO ()
customSpecMain :: Spec -> IO ()
customSpecMain = Config -> Spec -> IO ()
customSpecMainWithConfig Config
customSpecConfig

-- ====================================================================================

tests :: Spec
tests :: Spec
tests =
  String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"vector-map" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
    vMapTests

main :: IO ()
IO ()
main = Spec -> IO ()
customSpecMain Spec
tests