{-|
Module      : Enrollment Features Templates 
Description : Templates for Features pertaining to enrollment
Copyright   : (c) NoviSci, Inc 2020
License     : BSD3
Maintainer  : bsaul@novisci.com

-}
{-# OPTIONS_HADDOCK hide #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}

module Hasklepias.Templates.Features.Enrollment
  ( buildIsEnrolled
  , buildContinuousEnrollment
  , buildEnrollmentTests
  ) where

import           Cohort
import           EventData                  
import           Features
import           Hasklepias.Misc                ( F )
import           Hasklepias.FeatureEvents
import           Hasklepias.Templates.TestUtilities
import           Hasklepias.Reexports
import           Hasklepias.ReexportsUnsafe

{-| Is Enrolled

TODO: describe this

-}
buildIsEnrolled
  :: ( Intervallic i0 a
     , Monoid (container (Interval a))
     , Applicative container
     , Witherable container
     )
  => 
  Predicate (Event a) -- ^ The predicate to filter to Enrollment events (e.g. 'FeatureEvents.isEnrollment')
  -> Definition
       (  Feature indexName (Index i0 a)
       -> Feature eventsName (container (Event a))
       -> Feature varName Status
       )
buildIsEnrolled :: Predicate (Event a)
-> Definition
     (Feature indexName (Index i0 a)
      -> Feature eventsName (container (Event a))
      -> Feature varName Status)
buildIsEnrolled Predicate (Event a)
predicate = (Index i0 a -> container (Event a) -> Status)
-> Definition
     (Feature indexName (Index i0 a)
      -> Feature eventsName (container (Event a))
      -> Feature varName Status)
forall inputs def. Define inputs def => inputs -> Definition def
define
  (\Index i0 a
index ->
    (Event a -> Bool) -> container (Event a) -> container (Event a)
forall (f :: * -> *) a. Filterable f => (a -> Bool) -> f a -> f a
filter (Predicate (Event a) -> Event a -> Bool
forall a. Predicate a -> a -> Bool
getPredicate Predicate (Event a)
predicate)
      (container (Event a) -> container (Event a))
-> (container (Event a) -> container (Interval a))
-> container (Event a)
-> container (Interval a)
forall a b c. (a -> b) -> (b -> c) -> a -> c
.> container (Event a) -> container (Interval a)
forall (f :: * -> *) a (i :: * -> *).
(Applicative f, Ord a, Intervallic i a, Monoid (f (Interval a)),
 Foldable f) =>
f (i a) -> f (Interval a)
combineIntervals
      (container (Event a) -> container (Interval a))
-> (container (Interval a) -> Bool) -> container (Event a) -> Bool
forall a b c. (a -> b) -> (b -> c) -> a -> c
.> (Interval a -> Bool) -> container (Interval a) -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any (ComparativePredicateOf2 (Index i0 a) (Interval a)
forall (i0 :: * -> *) a (i1 :: * -> *).
(Intervallic i0 a, Intervallic i1 a) =>
ComparativePredicateOf2 (i0 a) (i1 a)
concur Index i0 a
index)
      (container (Event a) -> Bool)
-> (Bool -> Status) -> container (Event a) -> Status
forall a b c. (a -> b) -> (b -> c) -> a -> c
.> Bool -> Status
includeIf
  )

makeIsEnrolledTestInputs
  :: (Integral b, IntervalSizeable a b)
  => TestName
  -> Predicate (Event a)
  -> (a, a)
  -> [Event a]
  -> Status
  -> TestCase
       (F "index" (Index Interval a), F "events" [Event a])
       Status
       (Predicate (Event a))
makeIsEnrolledTestInputs :: TestName
-> Predicate (Event a)
-> (a, a)
-> [Event a]
-> Status
-> TestCase
     (F "index" (Index Interval a), F "events" [Event a])
     Status
     (Predicate (Event a))
makeIsEnrolledTestInputs TestName
name Predicate (Event a)
buildArgs (a, a)
intrvl [Event a]
e Status
s = Predicate (Event a)
-> TestName
-> (F "index" (Index Interval a), F "events" [Event a])
-> Feature "result" Status
-> TestCase
     (F "index" (Index Interval a), F "events" [Event a])
     Status
     (Predicate (Event a))
forall a b builderArgs.
builderArgs
-> TestName -> a -> Feature "result" b -> TestCase a b builderArgs
MkTestCase
  Predicate (Event a)
buildArgs
  TestName
name
  (Index Interval a -> F "index" (Index Interval a)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Interval a -> Index Interval a
forall (i :: * -> *) a. Intervallic i a => i a -> Index i a
makeIndex (Interval a -> Index Interval a) -> Interval a -> Index Interval a
forall a b. (a -> b) -> a -> b
$ (a, a) -> Interval a
forall b a.
(Integral b, IntervalSizeable a b) =>
(a, a) -> Interval a
readIntervalSafe (a, a)
intrvl), [Event a] -> F "events" [Event a]
forall (f :: * -> *) a. Applicative f => a -> f a
pure [Event a]
e)
  (Status -> Feature "result" Status
forall (f :: * -> *) a. Applicative f => a -> f a
pure Status
s)


buildIsEnrolledTestCases
  :: [ TestCase
         (F "index" (Index Interval Int), F "events" [Event Int])
         Status
         (Predicate (Event Int))
     ]
buildIsEnrolledTestCases :: [TestCase
   (F "index" (Index Interval Int), F "events" [Event Int])
   Status
   (Predicate (Event Int))]
buildIsEnrolledTestCases =
  [ TestName
-> Predicate (Event Int)
-> (Int, Int)
-> [Event Int]
-> Status
-> TestCase
     (F "index" (Index Interval Int), F "events" [Event Int])
     Status
     (Predicate (Event Int))
f TestName
"Exclude if no events" Predicate (Event Int)
forall a. Predicate (Event a)
isEnrollmentEvent (Int
0, Int
1) [] Status
Exclude
  , TestName
-> Predicate (Event Int)
-> (Int, Int)
-> [Event Int]
-> Status
-> TestCase
     (F "index" (Index Interval Int), F "events" [Event Int])
     Status
     (Predicate (Event Int))
f TestName
"Exclude if only interval meets"
      Predicate (Event Int)
forall a. Predicate (Event a)
isEnrollmentEvent
      (Int
0, Int
1)
      [(Int, Int) -> Event Int
g (Int
1, Int
6)]
      Status
Exclude
  , TestName
-> Predicate (Event Int)
-> (Int, Int)
-> [Event Int]
-> Status
-> TestCase
     (F "index" (Index Interval Int), F "events" [Event Int])
     Status
     (Predicate (Event Int))
f TestName
"Include if concurring interval"
      Predicate (Event Int)
forall a. Predicate (Event a)
isEnrollmentEvent
      (Int
0, Int
1)
      [(Int, Int) -> Event Int
g (-Int
1, Int
4)]
      Status
Include
  , TestName
-> Predicate (Event Int)
-> (Int, Int)
-> [Event Int]
-> Status
-> TestCase
     (F "index" (Index Interval Int), F "events" [Event Int])
     Status
     (Predicate (Event Int))
f TestName
"Include if concurring interval"
      Predicate (Event Int)
forall a. Predicate (Event a)
isEnrollmentEvent
      (Int
0, Int
1)
      [(Int, Int) -> Event Int
g (-Int
1, Int
1), (Int, Int) -> Event Int
g (Int
1, Int
4)]
      Status
Include
  ] where
  f :: TestName
-> Predicate (Event Int)
-> (Int, Int)
-> [Event Int]
-> Status
-> TestCase
     (F "index" (Index Interval Int), F "events" [Event Int])
     Status
     (Predicate (Event Int))
f = TestName
-> Predicate (Event Int)
-> (Int, Int)
-> [Event Int]
-> Status
-> TestCase
     (F "index" (Index Interval Int), F "events" [Event Int])
     Status
     (Predicate (Event Int))
forall b a.
(Integral b, IntervalSizeable a b) =>
TestName
-> Predicate (Event a)
-> (a, a)
-> [Event a]
-> Status
-> TestCase
     (F "index" (Index Interval a), F "events" [Event a])
     Status
     (Predicate (Event a))
makeIsEnrolledTestInputs
  g :: (Int, Int) -> Event Int
g = (Int, Int) -> Event Int
forall b a. (Integral b, IntervalSizeable a b) => (a, a) -> Event a
makeEnrollmentEvent

buildIsEnrolledTests :: TestTree
buildIsEnrolledTests :: TestTree
buildIsEnrolledTests = TestName -> [TestTree] -> TestTree
testGroup
  TestName
"Tests of isEnrolled template"
  ((TestCase
   (F "index" (Index Interval Int), F "events" [Event Int])
   Status
   (Predicate (Event Int))
 -> TestTree)
-> [TestCase
      (F "index" (Index Interval Int), F "events" [Event Int])
      Status
      (Predicate (Event Int))]
-> [TestTree]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap
    (\TestCase
  (F "index" (Index Interval Int), F "events" [Event Int])
  Status
  (Predicate (Event Int))
x -> TestName -> Assertion -> TestTree
testCase (TestCase
  (F "index" (Index Interval Int), F "events" [Event Int])
  Status
  (Predicate (Event Int))
-> TestName
forall a b builderArgs. TestCase a b builderArgs -> TestName
getTestName TestCase
  (F "index" (Index Interval Int), F "events" [Event Int])
  Status
  (Predicate (Event Int))
x)
                    (TestCase
  (F "index" (Index Interval Int), F "events" [Event Int])
  Status
  (Predicate (Event Int))
-> Definition
     (F "index" (Index Interval Int)
      -> F "events" [Event Int] -> Feature "result" Status)
-> Assertion
forall b def defArgs builderArgs.
(Eq b, Show b, Eval def defArgs (Feature "result" b)) =>
TestCase defArgs b builderArgs -> Definition def -> Assertion
makeAssertion TestCase
  (F "index" (Index Interval Int), F "events" [Event Int])
  Status
  (Predicate (Event Int))
x (Predicate (Event Int)
-> Definition
     (F "index" (Index Interval Int)
      -> F "events" [Event Int] -> Feature "result" Status)
forall (i0 :: * -> *) a (container :: * -> *) (indexName :: Symbol)
       (eventsName :: Symbol) (varName :: Symbol).
(Intervallic i0 a, Monoid (container (Interval a)),
 Applicative container, Witherable container) =>
Predicate (Event a)
-> Definition
     (Feature indexName (Index i0 a)
      -> Feature eventsName (container (Event a))
      -> Feature varName Status)
buildIsEnrolled (TestCase
  (F "index" (Index Interval Int), F "events" [Event Int])
  Status
  (Predicate (Event Int))
-> Predicate (Event Int)
forall a b builderArgs. TestCase a b builderArgs -> builderArgs
getBuilderArgs TestCase
  (F "index" (Index Interval Int), F "events" [Event Int])
  Status
  (Predicate (Event Int))
x)))
    )
    [TestCase
   (F "index" (Index Interval Int), F "events" [Event Int])
   Status
   (Predicate (Event Int))]
buildIsEnrolledTestCases
  )


{-| Continuous Enrollment 

TODO: describe this

-}
buildContinuousEnrollment
  :: ( Monoid (container (Interval a))
     , Monoid (container (Maybe (Interval a)))
     , Applicative container
     , Witherable container
     , IntervalSizeable a b
     )
  => (Index i0 a -> AssessmentInterval a) -- ^ function which maps index interval to interval in which to assess enrollment
  -> Predicate (Event a)  -- ^ The predicate to filter to Enrollment events (e.g. 'FeatureEvents.isEnrollment')
  -> b  -- ^ duration of allowable gap between enrollment intervals
  -> Definition
       (  Feature indexName (Index i0 a)
       -> Feature eventsName (container (Event a))
       -> Feature prevName Status
       -> Feature varName Status
       )
buildContinuousEnrollment :: (Index i0 a -> AssessmentInterval a)
-> Predicate (Event a)
-> b
-> Definition
     (Feature indexName (Index i0 a)
      -> Feature eventsName (container (Event a))
      -> Feature prevName Status
      -> Feature varName Status)
buildContinuousEnrollment Index i0 a -> AssessmentInterval a
makeAssessmentInterval Predicate (Event a)
predicate b
allowableGap = (Index i0 a -> container (Event a) -> Status -> Status)
-> Definition
     (Feature indexName (Index i0 a)
      -> Feature eventsName (container (Event a))
      -> Feature prevName Status
      -> Feature varName Status)
forall inputs def. Define inputs def => inputs -> Definition def
define
  (\Index i0 a
index container (Event a)
events Status
prevStatus -> case Status
prevStatus of
    Status
Exclude -> Status
Exclude
    Status
Include -> Bool -> Status
includeIf
      (b -> AssessmentInterval a -> container (Interval a) -> Bool
forall a b (i0 :: * -> *) (i1 :: * -> *) (t :: * -> *).
(IntervalSizeable a b, Intervallic i0 a, IntervalCombinable i1 a,
 Monoid (t (Interval a)), Monoid (t (Maybe (Interval a))),
 Applicative t, Witherable t) =>
b -> i0 a -> t (i1 a) -> Bool
allGapsWithinLessThanDuration
        b
allowableGap
        (Index i0 a -> AssessmentInterval a
makeAssessmentInterval Index i0 a
index)
        (container (Event a) -> container (Interval a)
forall (f :: * -> *) a (i :: * -> *).
(Applicative f, Ord a, Intervallic i a, Monoid (f (Interval a)),
 Foldable f) =>
f (i a) -> f (Interval a)
combineIntervals (container (Event a) -> container (Interval a))
-> container (Event a) -> container (Interval a)
forall a b. (a -> b) -> a -> b
$ (Event a -> Bool) -> container (Event a) -> container (Event a)
forall (f :: * -> *) a. Filterable f => (a -> Bool) -> f a -> f a
filter (Predicate (Event a) -> Event a -> Bool
forall a. Predicate a -> a -> Bool
getPredicate Predicate (Event a)
predicate) container (Event a)
events)
      )
  )


type ContEnrollArgs
  = (Index Interval Int -> AssessmentInterval Int, Predicate (Event Int), Int)

makeContinuousEnrollmentTestInputs
  :: (Integral b, IntervalSizeable a b)
  => TestName
  -> ContEnrollArgs
  -> (a, a)
  -> [Event a]
  -> Status
  -> Status
  -> TestCase
       ( F "index" (Index Interval a)
       , F "events" [Event a]
       , F "prev" Status
       )
       Status
       ContEnrollArgs
makeContinuousEnrollmentTestInputs :: TestName
-> ContEnrollArgs
-> (a, a)
-> [Event a]
-> Status
-> Status
-> TestCase
     (F "index" (Index Interval a), F "events" [Event a],
      F "prev" Status)
     Status
     ContEnrollArgs
makeContinuousEnrollmentTestInputs TestName
name ContEnrollArgs
buildArgs (a, a)
intrvl [Event a]
e Status
prev Status
s = ContEnrollArgs
-> TestName
-> (F "index" (Index Interval a), F "events" [Event a],
    F "prev" Status)
-> Feature "result" Status
-> TestCase
     (F "index" (Index Interval a), F "events" [Event a],
      F "prev" Status)
     Status
     ContEnrollArgs
forall a b builderArgs.
builderArgs
-> TestName -> a -> Feature "result" b -> TestCase a b builderArgs
MkTestCase
  ContEnrollArgs
buildArgs
  TestName
name
  (Index Interval a -> F "index" (Index Interval a)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Interval a -> Index Interval a
forall (i :: * -> *) a. Intervallic i a => i a -> Index i a
makeIndex ((a, a) -> Interval a
forall b a.
(Integral b, IntervalSizeable a b) =>
(a, a) -> Interval a
readIntervalSafe (a, a)
intrvl)), [Event a] -> F "events" [Event a]
forall (f :: * -> *) a. Applicative f => a -> f a
pure [Event a]
e, Status -> F "prev" Status
forall (f :: * -> *) a. Applicative f => a -> f a
pure Status
prev)
  (Status -> Feature "result" Status
forall (f :: * -> *) a. Applicative f => a -> f a
pure Status
s)

commonArgs
  :: (Index Interval Int -> AssessmentInterval Int, Predicate (Event a), Int)
commonArgs :: (Index Interval Int -> AssessmentInterval Int, Predicate (Event a),
 Int)
commonArgs = (Int -> Index Interval Int -> AssessmentInterval Int
forall (i :: * -> *) a b.
(Baseline i a, IntervalSizeable a b) =>
b -> Index i a -> AssessmentInterval a
makeBaselineFromIndex Int
10, Predicate (Event a)
forall a. Predicate (Event a)
isEnrollmentEvent, Int
3)

buildContinuousEnrollmentTestCases
  :: [ TestCase
         ( F "index" (Index Interval Int)
         , F "events" [Event Int]
         , F "prev" Status
         )
         Status
         ContEnrollArgs
     ]
buildContinuousEnrollmentTestCases :: [TestCase
   (F "index" (Index Interval Int), F "events" [Event Int],
    F "prev" Status)
   Status
   ContEnrollArgs]
buildContinuousEnrollmentTestCases =
  [ TestName
-> ContEnrollArgs
-> (Int, Int)
-> [Event Int]
-> Status
-> Status
-> TestCase
     (F "index" (Index Interval Int), F "events" [Event Int],
      F "prev" Status)
     Status
     ContEnrollArgs
f TestName
"Exclude if previously excluded" ContEnrollArgs
forall a.
(Index Interval Int -> AssessmentInterval Int, Predicate (Event a),
 Int)
commonArgs (Int
0, Int
1) [] Status
Exclude Status
Exclude
  , TestName
-> ContEnrollArgs
-> (Int, Int)
-> [Event Int]
-> Status
-> Status
-> TestCase
     (F "index" (Index Interval Int), F "events" [Event Int],
      F "prev" Status)
     Status
     ContEnrollArgs
f TestName
"Exclude if no events"           ContEnrollArgs
forall a.
(Index Interval Int -> AssessmentInterval Int, Predicate (Event a),
 Int)
commonArgs (Int
0, Int
1) [] Status
Include Status
Exclude
  , TestName
-> ContEnrollArgs
-> (Int, Int)
-> [Event Int]
-> Status
-> Status
-> TestCase
     (F "index" (Index Interval Int), F "events" [Event Int],
      F "prev" Status)
     Status
     ContEnrollArgs
f TestName
"Exclude if gap >= 3"
      ContEnrollArgs
forall a.
(Index Interval Int -> AssessmentInterval Int, Predicate (Event a),
 Int)
commonArgs
      (Int
10, Int
11)
      [(Int, Int) -> Event Int
g (Int
1, Int
4), (Int, Int) -> Event Int
g (Int
9, Int
12)]
      Status
Include
      Status
Exclude
      {-
                  -           <- Index
         ----------           <- Baseline
         ---     ---          <- Enrollment
        |--------------|
      -}
  , TestName
-> ContEnrollArgs
-> (Int, Int)
-> [Event Int]
-> Status
-> Status
-> TestCase
     (F "index" (Index Interval Int), F "events" [Event Int],
      F "prev" Status)
     Status
     ContEnrollArgs
f TestName
"Exclude if gap >= 3" ContEnrollArgs
forall a.
(Index Interval Int -> AssessmentInterval Int, Predicate (Event a),
 Int)
commonArgs (Int
10, Int
11) [(Int, Int) -> Event Int
g (Int
1, Int
7)]  Status
Include Status
Exclude
      {-
                  -           <- Index
        ----------            <- Baseline
         ------               <- Enrollment
        |--------------|
      -}
  , TestName
-> ContEnrollArgs
-> (Int, Int)
-> [Event Int]
-> Status
-> Status
-> TestCase
     (F "index" (Index Interval Int), F "events" [Event Int],
      F "prev" Status)
     Status
     ContEnrollArgs
f TestName
"Exclude if gap >= 3" ContEnrollArgs
forall a.
(Index Interval Int -> AssessmentInterval Int, Predicate (Event a),
 Int)
commonArgs (Int
10, Int
11) [(Int, Int) -> Event Int
g (Int
6, Int
13)] Status
Include Status
Exclude
        {-
                  -           <- Index
         ----------           <- Baseline
              -------         <- Enrollment
        |--------------|
      -}
  , TestName
-> ContEnrollArgs
-> (Int, Int)
-> [Event Int]
-> Status
-> Status
-> TestCase
     (F "index" (Index Interval Int), F "events" [Event Int],
      F "prev" Status)
     Status
     ContEnrollArgs
f TestName
"Include if gaps less than 3"
      ContEnrollArgs
forall a.
(Index Interval Int -> AssessmentInterval Int, Predicate (Event a),
 Int)
commonArgs
      (Int
10, Int
11)
      [(Int, Int) -> Event Int
g (Int
1, Int
3), (Int, Int) -> Event Int
g (Int
5, Int
12)]
      Status
Include
      Status
Include
      {-
                  -           <- Index
         ----------           <- Baseline
         --  -------          <- Enrollment
        |--------------|
      -}
  , TestName
-> ContEnrollArgs
-> (Int, Int)
-> [Event Int]
-> Status
-> Status
-> TestCase
     (F "index" (Index Interval Int), F "events" [Event Int],
      F "prev" Status)
     Status
     ContEnrollArgs
f TestName
"Include if gaps less than 3"
      ContEnrollArgs
forall a.
(Index Interval Int -> AssessmentInterval Int, Predicate (Event a),
 Int)
commonArgs
      (Int
10, Int
11)
      [(Int, Int) -> Event Int
g (Int
2, Int
9)]
      Status
Include
      Status
Include
      {-
                  -           <- Index
         ----------           <- Baseline
          -------             <- Enrollment
        |--------------|
      -}
  , TestName
-> ContEnrollArgs
-> (Int, Int)
-> [Event Int]
-> Status
-> Status
-> TestCase
     (F "index" (Index Interval Int), F "events" [Event Int],
      F "prev" Status)
     Status
     ContEnrollArgs
f TestName
"Include if gaps less than 3"
      ContEnrollArgs
forall a.
(Index Interval Int -> AssessmentInterval Int, Predicate (Event a),
 Int)
commonArgs
      (Int
10, Int
11)
      [(Int, Int) -> Event Int
g (Int
1, Int
6), (Int, Int) -> Event Int
g (Int
4, Int
8)]
      Status
Include
      Status
Include
        {-
                  -           <- Index
         ----------           <- Baseline
         -----                <- Enrollment
             ----
        |--------------|
      -}
  ] where
  f :: TestName
-> ContEnrollArgs
-> (Int, Int)
-> [Event Int]
-> Status
-> Status
-> TestCase
     (F "index" (Index Interval Int), F "events" [Event Int],
      F "prev" Status)
     Status
     ContEnrollArgs
f = TestName
-> ContEnrollArgs
-> (Int, Int)
-> [Event Int]
-> Status
-> Status
-> TestCase
     (F "index" (Index Interval Int), F "events" [Event Int],
      F "prev" Status)
     Status
     ContEnrollArgs
forall b a.
(Integral b, IntervalSizeable a b) =>
TestName
-> ContEnrollArgs
-> (a, a)
-> [Event a]
-> Status
-> Status
-> TestCase
     (F "index" (Index Interval a), F "events" [Event a],
      F "prev" Status)
     Status
     ContEnrollArgs
makeContinuousEnrollmentTestInputs
  g :: (Int, Int) -> Event Int
g = (Int, Int) -> Event Int
forall b a. (Integral b, IntervalSizeable a b) => (a, a) -> Event a
makeEnrollmentEvent

buildContinuousEnrollmentTests :: TestTree
buildContinuousEnrollmentTests :: TestTree
buildContinuousEnrollmentTests = TestName -> [TestTree] -> TestTree
testGroup
  TestName
"Tests of continuous enrollment template"
  ((TestCase
   (F "index" (Index Interval Int), F "events" [Event Int],
    F "prev" Status)
   Status
   ContEnrollArgs
 -> TestTree)
-> [TestCase
      (F "index" (Index Interval Int), F "events" [Event Int],
       F "prev" Status)
      Status
      ContEnrollArgs]
-> [TestTree]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap
    (\TestCase
  (F "index" (Index Interval Int), F "events" [Event Int],
   F "prev" Status)
  Status
  ContEnrollArgs
x -> TestName -> Assertion -> TestTree
testCase
      (TestCase
  (F "index" (Index Interval Int), F "events" [Event Int],
   F "prev" Status)
  Status
  ContEnrollArgs
-> TestName
forall a b builderArgs. TestCase a b builderArgs -> TestName
getTestName TestCase
  (F "index" (Index Interval Int), F "events" [Event Int],
   F "prev" Status)
  Status
  ContEnrollArgs
x)
      (TestCase
  (F "index" (Index Interval Int), F "events" [Event Int],
   F "prev" Status)
  Status
  ContEnrollArgs
-> Definition
     (F "index" (Index Interval Int)
      -> F "events" [Event Int]
      -> F "prev" Status
      -> Feature "result" Status)
-> Assertion
forall b def defArgs builderArgs.
(Eq b, Show b, Eval def defArgs (Feature "result" b)) =>
TestCase defArgs b builderArgs -> Definition def -> Assertion
makeAssertion
        TestCase
  (F "index" (Index Interval Int), F "events" [Event Int],
   F "prev" Status)
  Status
  ContEnrollArgs
x
        ((Index Interval Int -> AssessmentInterval Int)
-> Predicate (Event Int)
-> Int
-> Definition
     (F "index" (Index Interval Int)
      -> F "events" [Event Int]
      -> F "prev" Status
      -> Feature "result" Status)
forall (container :: * -> *) a b (i0 :: * -> *)
       (indexName :: Symbol) (eventsName :: Symbol) (prevName :: Symbol)
       (varName :: Symbol).
(Monoid (container (Interval a)),
 Monoid (container (Maybe (Interval a))), Applicative container,
 Witherable container, IntervalSizeable a b) =>
(Index i0 a -> AssessmentInterval a)
-> Predicate (Event a)
-> b
-> Definition
     (Feature indexName (Index i0 a)
      -> Feature eventsName (container (Event a))
      -> Feature prevName Status
      -> Feature varName Status)
buildContinuousEnrollment (Int -> Index Interval Int -> AssessmentInterval Int
forall (i :: * -> *) a b.
(Baseline i a, IntervalSizeable a b) =>
b -> Index i a -> AssessmentInterval a
makeBaselineFromIndex Int
10) Predicate (Event Int)
forall a. Predicate (Event a)
isEnrollmentEvent Int
3)
      )
    )
    [TestCase
   (F "index" (Index Interval Int), F "events" [Event Int],
    F "prev" Status)
   Status
   ContEnrollArgs]
buildContinuousEnrollmentTestCases
  )

buildEnrollmentTests :: TestTree
buildEnrollmentTests :: TestTree
buildEnrollmentTests =
  TestName -> [TestTree] -> TestTree
testGroup TestName
"" [TestTree
buildIsEnrolledTests, TestTree
buildContinuousEnrollmentTests]