blob: 3458c04200296a586113c02f8a0637af1267503c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
module Test (
Test(..),
TestStep(..),
TestBlock(..),
) where
import Data.Scientific
import Data.Text (Text)
import Network
import Process
import Script.Expr
data Test = Test
{ testName :: Text
, testSteps :: Expr TestBlock
}
newtype TestBlock = TestBlock [ TestStep ]
deriving (Semigroup, Monoid)
data TestStep
= Subnet (TypedVarName Network) Network (Network -> TestBlock)
| DeclNode (TypedVarName Node) Network (Node -> TestBlock)
| Spawn (TypedVarName Process) (Either Network Node) (Process -> TestBlock)
| Send Process Text
| Expect SourceLine Process (Traced Regex) [ TypedVarName Text ] ([ Text ] -> TestBlock)
| Flush Process (Maybe Regex)
| Guard SourceLine EvalTrace Bool
| DisconnectNode Node TestBlock
| DisconnectNodes Network TestBlock
| DisconnectUpstream Network TestBlock
| PacketLoss Scientific Node TestBlock
| Wait
instance ExprType TestBlock where
textExprType _ = "test block"
textExprValue _ = "<test block>"
|