packages feed

fir-0.1.0.0: test/Tests.hs

module Tests where

-- fir-tests
import Folders
  ( Folder(Folder)
  , runTests, runTestsP, runTestsFromFolder
  )
import Test
  ( Test(..), TestOutput )

--------------------------------------------------

runAllTestsP :: (String -> String -> Test -> Bool)
             -> IO [ Folder (String, Test, TestOutput) ]
runAllTestsP f = runTestsP f allTests

runAllTests :: IO [ Folder (String, Test, TestOutput) ]
runAllTests = runTests allTests

runAllTestsFromFolder :: String -> IO [ Folder (String, Test, TestOutput) ]
runAllTestsFromFolder = flip runTestsFromFolder allTests

--------------------------------------------------

allTests :: [ Folder (String, Test) ]
allTests
  = [ Folder "Array"
          [ ( "Applicative"       , Validate  )
          , ( "ApplicativeConvert", Validate  )
          , ( "Runtime"           , Typecheck )
          ]
    , Folder "Atomics"
          [ ( "Operations"  , Validate  )
          , ( "FloatBitwise", Typecheck )
          ]
    , Folder "Bits"
          [ ( "BitCast"   , Validate )
          , ( "Bits"      , Validate )
          , ( "ZipBits"   , Validate )
          , ( "BitReverse", Validate )
          ]
    , Folder "Builtins"
          [ ( "SampleId"     , Validate )
          , ( "SharedBuiltin", Validate )
          ]
    , Folder "Components"
          [ ( "FloatInt"  , Typecheck )
          , ( "FloatWidth", Typecheck )
          , ( "IntWidth"  , Typecheck )
          , ( "Sign"      , Validate  )
          ]
    , Folder "Definitions"
          [ ( "Descriptors"    , Typecheck )
          , ( "OriginLowerLeft", Typecheck )
          , ( "PushConstant"   , Typecheck )
          , ( "UniformRuntimeArray", Typecheck )
          ]
    , Folder "Control"
          [ ( "BreakContinueNested", Validate )
          , ( "BreakInCondition"   , Validate )
          , ( "BreakNested"        , Validate )
          , ( "DeadCode"           , Validate )
          , ( "Def"                , Validate )
          , ( "Loop1"              , Validate )
          , ( "Loop2"              , Validate )
          , ( "Loop3"              , Validate )
          , ( "LoopCondition"      , Validate )
          , ( "LoopsNested"        , Validate )
          , ( "RayQueryVariable"   , Validate )
          , ( "Selection"          , Validate )
          , ( "Switch"             , Validate )
          , ( "TemporaryBranches"  , Validate )
          , ( "TemporaryFunctions" , Validate )
          , ( "TemporaryLoop"      , Validate )
          , ( "TemporarySetter"    , Validate )
          ]
    , Folder "Debug"
          [ ( "Printf", Validate )
          ]
    , Folder "Geometry"
          [ ( "Geometry"   , Validate  )
          , ( "NotGeometry", Typecheck )
          ]
    , Folder "Groups"
          [ ( "GroupAdd", Validate )
          ]
    , Folder "Images"
          [ ( "Gather"   , Validate )
          , ( "ReadWrite", Validate )
          , ( "Sample"   , Validate )
          ]
    , Folder "Inference"
          [ ( "Ising1", Typecheck )
          , ( "Ising2", Typecheck )
          ]
    , Folder "Interface"
          [ ( "ComponentMismatch", Typecheck )
          , ( "ExtraOutput"      , Typecheck )
          , ( "InvalidComponent" , Typecheck )
          , ( "MissingInput"     , Typecheck )
          ]
    , Folder "Layout"
          [ ( "Copy"            , Validate )
          , ( "DescriptorArray" , Validate )
          , ( "FunctionArgument", Validate )
          , ( "LocalVariables"  , Validate )
          , ( "Matrices"        , Validate )
          , ( "NestedUniform"   , Validate )
          , ( "Offsets"         , Validate )
          , ( "PerVertexBlocks" , Validate )
          , ( "Products"        , Validate )
          , ( "PushConstant"    , Validate )
          , ( "RuntimeArray"    , Validate )
          , ( "Selection"       , Validate )
          , ( "StructPadding"   , Validate )
          ]
    , Folder "Matrix"
          [ ( "Applicative", Validate )
          ]
    , Folder "Module"
          [ ( "DiffStageDiffName", Validate  )
          , ( "DiffStageSameName", Validate  )
          , ( "SameStageDiffName", Validate  )
          , ( "SameStageSameName", Typecheck )
          ]
    , Folder "OpenCL"
          [ ( "Kernel", Validate )
          ]
    , Folder "Optics"
          [ ( "ASTIndices"    , Validate  )
          , ( "ASTProducts"   , Validate  )
          , ( "MVP1"          , Validate  )
          , ( "MVP2"          , Validate  )
          , ( "NestedOfType"  , Validate  )
          , ( "NoMatrixIndex" , Typecheck )
          , ( "NoStructField" , Typecheck )
          , ( "NoStructIndex" , Typecheck )
          , ( "NoVectorIndex" , Typecheck )
          , ( "Overlapping"   , Typecheck )
          , ( "ProductIndices", Typecheck )
          , ( "PureProducts"  , Typecheck )
          , ( "UnarySwizzle"  , Validate  )
          , ( "Various"       , Validate  )
          ]
    , Folder "PrimOps"
          [ ( "Rounding", Validate)
          ]
    , Folder "ProgramState"
          [ ( "Shadowing", Validate)
          ]
    , Folder "Small"
          [ ( "HalfArithmetic" , Validate )
          , ( "HalfInputOutput", Validate )
          , ( "IntArithmetic"  , Validate )
          , ( "IntInputOutput" , Validate )
          ]
    , Folder "Tessellation"
          [ ( "Control"   , Validate )
          , ( "Evaluation", Validate )
          ]
    , Folder "Unicode"
          [ ( "Syntax", Validate )
          ]
    , Folder "Vector"
          [ ( "Applicative" , Validate  )
          , ( "Functor"     , Validate  )
          , ( "Swizzle"     , Validate  )
          , ( "MixedSwizzle", Typecheck )
          ]
    , Folder "VertexInput"
          [ ( "CompatibleTypes"       , Typecheck )
          , ( "ComponentOutOfRange"   , Typecheck )
          , ( "DoubleComponents"      , Typecheck )
          , ( "EquivalentComponents"  , Typecheck )
          -- TODO: check that the vertex attributes are compatible with the
          -- vertex shader inputs, and provide every component they consume.
          --, ( "IncompatibleTypes"     , Typecheck )
          --, ( "IncompatibleWidths"    , Typecheck )
          --, ( "MissingComponents"     , Typecheck )
          , ( "InvalidDoubleComponent", Typecheck )
          , ( "InvalidVectorComponent", Typecheck )
          -- TODO: check that the vertex attributes of a 'StructInput'
          -- do not overlap.
          --, ( "Overlap"               , Typecheck )
          , ( "V3Double_Double"       , Typecheck )
          ]
    ]