summaryrefslogtreecommitdiff
path: root/src/Test.hs
blob: 8136afbc31aa4d8d1c62988d67cb3cffa31a5e57 (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
module Test (
    Test(..),
    TestStep(..),

    ProcName(..), unpackProcName,
    NodeName(..), 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)

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

newtype NodeName = NodeName Text
    deriving (Eq, Ord)

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