module TestUtils.TestCases
  ( AppType(..)
  , InputTypeAbleFSS(..)
  , TestCollectorInputType(..)
  , TestCollectorOutputType(..)
  , TestCollectorScenario(..)
  , TestDataType(..)
  , TestInputType(..)
  , TestOutputType(..)
  , TestScenarioCohort(..)
  , createCollectorTests
  , createTestsCartesian
  ) where

import           Test.Tasty        (TestTree, testGroup)
import           TestUtils.S3Utils

-- Enumeration of test applications
data AppType = AppRowWise | AppColumnWise

-- Enumeration of test data cases
data TestDataType = TestDataEmpty | TestDataSmall | TestDataManySubj | TestDataManyEvent

-- Enumeration of input sources
data TestInputType = TestInputFile | TestInputStdin | TestInputS3

-- Enumeration of output sources
data TestOutputType = TestOutputFile | TestOutputStdout | TestOutputS3

-- Enumeration of input sources for cohort-collector
--
-- TODO: there are other input sources not covered here: --dir and --bucket
data TestCollectorInputType = TestCollectorInputFile | TestCollectorInputS3

-- Enumeration of output sources for cohort-collector
--
-- TODO: there are other output sources not covered here: --outdir
data TestCollectorOutputType =
    TestCollectorOutputFile
  | TestCollectorOutputStdout
  | TestCollectorOutputS3

-- Test scenario type for the filter application
data TestScenarioFilter = TestScenarioFilter
  { TestScenarioFilter -> TestDataType
getFilterTestDataType  :: TestDataType
  , TestScenarioFilter -> TestInputType
getFilterTestInputType :: TestInputType
  }

-- Test scenario type for the cohort application
data TestScenarioCohort = TestScenarioCohort
  { TestScenarioCohort -> AppType
getCohortAppType        :: AppType
  , TestScenarioCohort -> TestDataType
getCohortTestDataType   :: TestDataType
  , TestScenarioCohort -> TestInputType
getCohortTestInputType  :: TestInputType
  , TestScenarioCohort -> TestOutputType
getCohortTestOutputType :: TestOutputType
  }

-- Test scenario type for the cohort-collector application
data TestCollectorScenario = TestCollectorScenario
  { TestCollectorScenario -> AppType
getTestCollectorAppType    :: AppType
  , TestCollectorScenario -> TestCollectorInputType
getTestCollectorInputType  :: TestCollectorInputType
  , TestCollectorScenario -> TestCollectorOutputType
getTestCollectorOutputType :: TestCollectorOutputType
  }

class InputTypeAbleFSS a where
  extractTestInputType :: a -> TestInputType

instance InputTypeAbleFSS TestScenarioCohort where
  extractTestInputType :: TestScenarioCohort -> TestInputType
extractTestInputType = TestScenarioCohort -> TestInputType
getCohortTestInputType

-- Enumerate the test cases
createTestsCartesian :: String -> (TestScenarioCohort -> TestTree) -> TestTree
createTestsCartesian :: String -> (TestScenarioCohort -> TestTree) -> TestTree
createTestsCartesian String
testName TestScenarioCohort -> TestTree
appTest = String -> [TestTree] -> TestTree
testGroup
  String
testName
  [ AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataEmpty     TestInputType
TestInputFile  TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataEmpty     TestInputType
TestInputFile  TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataEmpty     TestInputType
TestInputFile  TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataEmpty     TestInputType
TestInputStdin TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataEmpty     TestInputType
TestInputStdin TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataEmpty     TestInputType
TestInputStdin TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataEmpty     TestInputType
TestInputS3    TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataEmpty     TestInputType
TestInputS3    TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataEmpty     TestInputType
TestInputS3    TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataSmall     TestInputType
TestInputFile  TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataSmall     TestInputType
TestInputFile  TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataSmall     TestInputType
TestInputFile  TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataSmall     TestInputType
TestInputStdin TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataSmall     TestInputType
TestInputStdin TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataSmall     TestInputType
TestInputStdin TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataSmall     TestInputType
TestInputS3    TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataSmall     TestInputType
TestInputS3    TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataSmall     TestInputType
TestInputS3    TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataManySubj  TestInputType
TestInputFile  TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataManySubj  TestInputType
TestInputFile  TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataManySubj  TestInputType
TestInputFile  TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataManySubj  TestInputType
TestInputStdin TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataManySubj  TestInputType
TestInputStdin TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataManySubj  TestInputType
TestInputStdin TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataManySubj  TestInputType
TestInputS3    TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataManySubj  TestInputType
TestInputS3    TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataManySubj  TestInputType
TestInputS3    TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataManyEvent TestInputType
TestInputFile  TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataManyEvent TestInputType
TestInputFile  TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataManyEvent TestInputType
TestInputFile  TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataManyEvent TestInputType
TestInputStdin TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataManyEvent TestInputType
TestInputStdin TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataManyEvent TestInputType
TestInputStdin TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataManyEvent TestInputType
TestInputS3    TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataManyEvent TestInputType
TestInputS3    TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestDataType
TestDataManyEvent TestInputType
TestInputS3    TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataEmpty     TestInputType
TestInputFile  TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataEmpty     TestInputType
TestInputFile  TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataEmpty     TestInputType
TestInputFile  TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataEmpty     TestInputType
TestInputStdin TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataEmpty     TestInputType
TestInputStdin TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataEmpty     TestInputType
TestInputStdin TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataEmpty     TestInputType
TestInputS3    TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataEmpty     TestInputType
TestInputS3    TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataEmpty     TestInputType
TestInputS3    TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataSmall     TestInputType
TestInputFile  TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataSmall     TestInputType
TestInputFile  TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataSmall     TestInputType
TestInputFile  TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataSmall     TestInputType
TestInputStdin TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataSmall     TestInputType
TestInputStdin TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataSmall     TestInputType
TestInputStdin TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataSmall     TestInputType
TestInputS3    TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataSmall     TestInputType
TestInputS3    TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataSmall     TestInputType
TestInputS3    TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataManySubj  TestInputType
TestInputFile  TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataManySubj  TestInputType
TestInputFile  TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataManySubj  TestInputType
TestInputFile  TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataManySubj  TestInputType
TestInputStdin TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataManySubj  TestInputType
TestInputStdin TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataManySubj  TestInputType
TestInputStdin TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataManySubj  TestInputType
TestInputS3    TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataManySubj  TestInputType
TestInputS3    TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataManySubj  TestInputType
TestInputS3    TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataManyEvent TestInputType
TestInputFile  TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataManyEvent TestInputType
TestInputFile  TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataManyEvent TestInputType
TestInputFile  TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataManyEvent TestInputType
TestInputStdin TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataManyEvent TestInputType
TestInputStdin TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataManyEvent TestInputType
TestInputStdin TestOutputType
TestOutputS3
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataManyEvent TestInputType
TestInputS3    TestOutputType
TestOutputFile
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataManyEvent TestInputType
TestInputS3    TestOutputType
TestOutputStdout
  , AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestDataType
TestDataManyEvent TestInputType
TestInputS3    TestOutputType
TestOutputS3
  ]
 where
  appTestWrp :: AppType
-> TestDataType -> TestInputType -> TestOutputType -> TestTree
appTestWrp AppType
appType TestDataType
testDataType TestInputType
testInputType TestOutputType
testOutputType = TestScenarioCohort -> TestTree
appTest
    (AppType
-> TestDataType
-> TestInputType
-> TestOutputType
-> TestScenarioCohort
TestScenarioCohort AppType
appType TestDataType
testDataType TestInputType
testInputType TestOutputType
testOutputType)

createCollectorTests
  :: String -> (TestCollectorScenario -> TestTree) -> TestTree
createCollectorTests :: String -> (TestCollectorScenario -> TestTree) -> TestTree
createCollectorTests String
testName TestCollectorScenario -> TestTree
appTest = String -> [TestTree] -> TestTree
testGroup
  String
testName
  [ AppType
-> TestCollectorInputType -> TestCollectorOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestCollectorInputType
TestCollectorInputFile TestCollectorOutputType
TestCollectorOutputFile
  , AppType
-> TestCollectorInputType -> TestCollectorOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestCollectorInputType
TestCollectorInputFile TestCollectorOutputType
TestCollectorOutputStdout
  , AppType
-> TestCollectorInputType -> TestCollectorOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestCollectorInputType
TestCollectorInputFile TestCollectorOutputType
TestCollectorOutputS3
  , AppType
-> TestCollectorInputType -> TestCollectorOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestCollectorInputType
TestCollectorInputS3   TestCollectorOutputType
TestCollectorOutputFile
  , AppType
-> TestCollectorInputType -> TestCollectorOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestCollectorInputType
TestCollectorInputS3   TestCollectorOutputType
TestCollectorOutputStdout
  , AppType
-> TestCollectorInputType -> TestCollectorOutputType -> TestTree
appTestWrp AppType
AppRowWise    TestCollectorInputType
TestCollectorInputS3   TestCollectorOutputType
TestCollectorOutputS3
  , AppType
-> TestCollectorInputType -> TestCollectorOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestCollectorInputType
TestCollectorInputFile TestCollectorOutputType
TestCollectorOutputFile
  , AppType
-> TestCollectorInputType -> TestCollectorOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestCollectorInputType
TestCollectorInputFile TestCollectorOutputType
TestCollectorOutputStdout
  , AppType
-> TestCollectorInputType -> TestCollectorOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestCollectorInputType
TestCollectorInputFile TestCollectorOutputType
TestCollectorOutputS3
  , AppType
-> TestCollectorInputType -> TestCollectorOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestCollectorInputType
TestCollectorInputS3   TestCollectorOutputType
TestCollectorOutputFile
  , AppType
-> TestCollectorInputType -> TestCollectorOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestCollectorInputType
TestCollectorInputS3   TestCollectorOutputType
TestCollectorOutputStdout
  , AppType
-> TestCollectorInputType -> TestCollectorOutputType -> TestTree
appTestWrp AppType
AppColumnWise TestCollectorInputType
TestCollectorInputS3   TestCollectorOutputType
TestCollectorOutputS3
  ]
 where
  appTestWrp :: AppType
-> TestCollectorInputType -> TestCollectorOutputType -> TestTree
appTestWrp AppType
appType TestCollectorInputType
inputType TestCollectorOutputType
outputType =
    TestCollectorScenario -> TestTree
appTest (AppType
-> TestCollectorInputType
-> TestCollectorOutputType
-> TestCollectorScenario
TestCollectorScenario AppType
appType TestCollectorInputType
inputType TestCollectorOutputType
outputType)