summaryrefslogtreecommitdiff
path: root/src/Test.hs
blob: 83ffac52982f0a1a8b015987431615c806a0f624 (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
39
40
module Test (
    Test(..),
    TestStep(..),

    ProcName(..), textProcName, unpackProcName,
    NodeName(..), textNodeName, unpackNodeName,
) where

import Data.Text (Text)
import qualified Data.Text as T

import Text.Regex.TDFA

data Test = Test
    { testName :: Text
    , testSteps :: [TestStep]
    }

data TestStep = Spawn ProcName NodeName
              | Send ProcName Text
              | Expect ProcName Regex
              | Wait

newtype ProcName = ProcName Text
    deriving (Eq, Ord)

textProcName :: ProcName -> Text
textProcName (ProcName name) = name

unpackProcName :: ProcName -> String
unpackProcName (ProcName tname) = T.unpack tname

newtype NodeName = NodeName Text
    deriving (Eq, Ord)

textNodeName :: NodeName -> Text
textNodeName (NodeName name) = name

unpackNodeName :: NodeName -> String
unpackNodeName (NodeName tname) = T.unpack tname