otel-effectful-1.0.0: test/Effectful/OpenTelemetry/Logging/SeveritySpec.hs
module Effectful.OpenTelemetry.Logging.SeveritySpec (spec) where
import Arbitrary ()
import Data.Char (toLower, toUpper)
import Effectful
import Effectful.Hspec
import Effectful.OpenTelemetry.Logging.Severity (Severity)
import Effectful.QuickCheck ((.&&.), (===))
import Prelude
spec :: (Hspec :> es) => Eff es ()
spec = parallel do
prop "toEnum/fromEnum round trip" \(s :: Severity) ->
toEnum (fromEnum s) === s
prop "read/show round trip" \(s :: Severity) ->
read (show s) === s
prop "read is case-insensitive" \(s :: Severity) ->
(read (map toLower (show s)) === s) .&&. (read (map toUpper (show s)) === s)