    {-# OPTIONS_GHC -fno-warn-orphans #-}

    module Futhark.ProfileTests () where

    import Data.Map qualified as M
    import Data.Text qualified as T
    import Futhark.Profile
    import Test.Tasty.QuickCheck

    printable :: Gen String
    printable :: Gen String
    printable = PrintableString -> String
    getPrintableString (PrintableString -> String) -> Gen PrintableString -> Gen String
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Gen PrintableString
    forall a. Arbitrary a => Gen a
    arbitrary

    arbText :: Gen T.Text
    arbText :: Gen Text
    arbText = String -> Text
    T.pack (String -> Text) -> Gen String -> Gen Text
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Gen String
    printable

    instance Arbitrary ProfilingEvent where
      arbitrary :: Gen ProfilingEvent
    arbitrary = Text -> Double -> Text -> Value -> ProfilingEvent
    ProfilingEvent (Text -> Double -> Text -> Value -> ProfilingEvent)
    -> Gen Text -> Gen (Double -> Text -> Value -> ProfilingEvent)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Gen Text
    arbText Gen (Double -> Text -> Value -> ProfilingEvent)
    -> Gen Double -> Gen (Text -> Value -> ProfilingEvent)
    forall a b. Gen (a -> b) -> Gen a -> Gen b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Gen Double
    forall a. Arbitrary a => Gen a
    arbitrary Gen (Text -> Value -> ProfilingEvent)
    -> Gen Text -> Gen (Value -> ProfilingEvent)
    forall a b. Gen (a -> b) -> Gen a -> Gen b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Gen Text
    arbText Gen (Value -> ProfilingEvent) -> Gen Value -> Gen ProfilingEvent
    forall a b. Gen (a -> b) -> Gen a -> Gen b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Gen Value
    forall a. Arbitrary a => Gen a
    arbitrary

    instance Arbitrary ProfilingReport where
      arbitrary :: Gen ProfilingReport
    arbitrary =
        [ProfilingEvent] -> Map Text Integer -> ProfilingReport
    ProfilingReport
          ([ProfilingEvent] -> Map Text Integer -> ProfilingReport)
    -> Gen [ProfilingEvent]
    -> Gen (Map Text Integer -> ProfilingReport)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Gen [ProfilingEvent]
    forall a. Arbitrary a => Gen a
    arbitrary
          Gen (Map Text Integer -> ProfilingReport)
    -> Gen (Map Text Integer) -> Gen ProfilingReport
    forall a b. Gen (a -> b) -> Gen a -> Gen b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ([(Text, Integer)] -> Map Text Integer
    forall k a. Ord k => [(k, a)] -> Map k a
    M.fromList ([(Text, Integer)] -> Map Text Integer)
    -> Gen [(Text, Integer)] -> Gen (Map Text Integer)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Gen (Text, Integer) -> Gen [(Text, Integer)]
    forall a. Gen a -> Gen [a]
    listOf ((,) (Text -> Integer -> (Text, Integer))
    -> Gen Text -> Gen (Integer -> (Text, Integer))
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Gen Text
    arbText Gen (Integer -> (Text, Integer))
    -> Gen Integer -> Gen (Text, Integer)
    forall a b. Gen (a -> b) -> Gen a -> Gen b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Gen Integer
    forall a. Arbitrary a => Gen a
    arbitrary))