module Lorentz.TestScenario
{-# DEPRECATED "Use cleveland instead" #-}
( TestScenario
, showTestScenario
) where
import Fmt (Buildable, Builder, fmt, (+|), (|+))
import Lorentz.Constraints (KnownValue, NicePrintedValue, NoOperation)
import Lorentz.Print (printLorentzValue)
import Michelson.Typed.Haskell.Value (IsoValue)
import Tezos.Address (Address)
type TestScenario param = [(Address, param)]
showTestScenario
:: (Buildable param, NicePrintedValue param)
=> TestScenario param -> Text
showTestScenario :: TestScenario param -> Text
showTestScenario = Builder -> Text
forall b. FromBuilder b => Builder -> b
fmt (Builder -> Text)
-> (TestScenario param -> Builder) -> TestScenario param -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Element (TestScenario param) -> Builder)
-> TestScenario param -> Builder
forall t m. (Container t, Monoid m) => (Element t -> m) -> t -> m
foldMap Element (TestScenario param) -> Builder
forall param.
(Buildable param, KnownValue param, NoOperation param) =>
(Address, param) -> Builder
formatParam
where
formatParam
:: (Buildable param, KnownValue param, NoOperation param)
=> (Address, param) -> Builder
formatParam :: (Address, param) -> Builder
formatParam (addr :: Address
addr, param :: param
param) =
"# " Builder -> Builder -> Builder
forall b. FromBuilder b => Builder -> Builder -> b
+| param
param param -> Builder -> Builder
forall a b. (Buildable a, FromBuilder b) => a -> Builder -> b
|+ "\n" Builder -> Builder -> Builder
forall b. FromBuilder b => Builder -> Builder -> b
+|
Address
addr Address -> Builder -> Builder
forall a b. (Buildable a, FromBuilder b) => a -> Builder -> b
|+ "\n" Builder -> Builder -> Builder
forall b. FromBuilder b => Builder -> Builder -> b
+|
Bool -> param -> LText
forall v. NicePrintedValue v => Bool -> v -> LText
printLorentzValue Bool
True param
param LText -> Builder -> Builder
forall a b. (Buildable a, FromBuilder b) => a -> Builder -> b
|+ "\n"
data Parameter
= Param1 Integer Bool
| Param2
| Param3 Natural Natural
deriving stock (forall x. Parameter -> Rep Parameter x)
-> (forall x. Rep Parameter x -> Parameter) -> Generic Parameter
forall x. Rep Parameter x -> Parameter
forall x. Parameter -> Rep Parameter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Parameter x -> Parameter
$cfrom :: forall x. Parameter -> Rep Parameter x
Generic
deriving anyclass WellTypedToT Parameter
WellTypedToT Parameter =>
(Parameter -> Value (ToT Parameter))
-> (Value (ToT Parameter) -> Parameter) -> IsoValue Parameter
Value (ToT Parameter) -> Parameter
Parameter -> Value (ToT Parameter)
forall a.
WellTypedToT a =>
(a -> Value (ToT a)) -> (Value (ToT a) -> a) -> IsoValue a
fromVal :: Value (ToT Parameter) -> Parameter
$cfromVal :: Value (ToT Parameter) -> Parameter
toVal :: Parameter -> Value (ToT Parameter)
$ctoVal :: Parameter -> Value (ToT Parameter)
$cp1IsoValue :: WellTypedToT Parameter
IsoValue
_mkTestScenarioExample :: Address -> TestScenario Parameter
_mkTestScenarioExample :: Address -> TestScenario Parameter
_mkTestScenarioExample owner :: Address
owner =
[ (Address
owner, Integer -> Bool -> Parameter
Param1 5 Bool
False)
, (Address
owner, Parameter
Param2)
, (Address
owner, Natural -> Natural -> Parameter
Param3 2 2)
]