futhark-0.7.4: An optimising compiler for a functional, array-oriented language.

Safe HaskellNone
LanguageHaskell2010

Futhark.Test

Description

Facilities for reading Futhark test programs. A Futhark test program is an ordinary Futhark program where an initial comment block specifies input- and output-sets.

Synopsis

Documentation

testSpecFromFile :: FilePath -> IO ProgramTest Source #

Read the test specification from the given Futhark program. Note: will call error on parse errors.

testSpecsFromPaths :: [FilePath] -> IO [(FilePath, ProgramTest)] Source #

Read test specifications from the given paths, which can be a files or directories containing .fut files and further directories. Calls error on parse errors, or if any of the immediately passed path names do not name a file that exists.

valuesFromByteString :: String -> ByteString -> Either String [Value] Source #

Try to parse a several values from a byte string. The String parameter is used for error messages.

getValues :: MonadIO m => FilePath -> Values -> m [Value] Source #

Get the actual core Futhark values corresponding to a Values specification. The FilePath is the directory which file paths are read relative to.

getValuesBS :: MonadIO m => FilePath -> Values -> m ByteString Source #

Extract a pretty representation of some Values. In the IO monad because this might involve reading from a file. There is no guarantee that the resulting byte string yields a readable value.

compareValues :: [Value] -> [Value] -> Maybe [Mismatch] Source #

Compare two sets of Futhark values for equality. Shapes and types must also match.

data Mismatch Source #

Two values differ in some way.

Instances
Show Mismatch Source # 
Instance details

Defined in Futhark.Test.Values

data ProgramTest Source #

Description of a test to be carried out on a Futhark program. The Futhark program is stored separately.

Instances
Show ProgramTest Source # 
Instance details

Defined in Futhark.Test

data StructureTest Source #

A structure test specifies a compilation pipeline, as well as metrics for the program coming out the other end.

Instances
Show StructureTest Source # 
Instance details

Defined in Futhark.Test

data WarningTest Source #

A warning test requires that a warning matching the regular expression is produced. The program must also compile succesfully.

Constructors

ExpectedWarning Text Regex 
Instances
Show WarningTest Source # 
Instance details

Defined in Futhark.Test

data TestAction Source #

How to test a program.

Instances
Show TestAction Source # 
Instance details

Defined in Futhark.Test

data ExpectedError Source #

The error expected for a negative test.

Constructors

AnyError 
ThisError Text Regex 
Instances
Show ExpectedError Source # 
Instance details

Defined in Futhark.Test

data InputOutputs Source #

Input and output pairs for some entry point(s).

Constructors

InputOutputs 
Instances
Show InputOutputs Source # 
Instance details

Defined in Futhark.Test

data TestRun Source #

A condition for execution, input, and expected result.

Instances
Show TestRun Source # 
Instance details

Defined in Futhark.Test

data ExpectedResult values Source #

How a test case is expected to terminate.

Constructors

Succeeds (Maybe values)

Execution suceeds, with or without expected result values.

RunTimeFailure ExpectedError

Execution fails with this error.

Instances
Show values => Show (ExpectedResult values) Source # 
Instance details

Defined in Futhark.Test

Methods

showsPrec :: Int -> ExpectedResult values -> ShowS #

show :: ExpectedResult values -> String #

showList :: [ExpectedResult values] -> ShowS #

data Values Source #

Several Values - either literally, or by reference to a file.

Constructors

Values [Value] 
InFile FilePath 
Instances
Show Values Source # 
Instance details

Defined in Futhark.Test

data Value Source #

An efficiently represented Futhark value. Use pretty to get a human-readable representation, and the instances of Get and Put to obtain binary representations

Instances
Show Value Source # 
Instance details

Defined in Futhark.Test.Values

Methods

showsPrec :: Int -> Value -> ShowS #

show :: Value -> String #

showList :: [Value] -> ShowS #

Binary Value Source # 
Instance details

Defined in Futhark.Test.Values

Methods

put :: Value -> Put #

get :: Get Value #

putList :: [Value] -> Put #

Pretty Value Source # 
Instance details

Defined in Futhark.Test.Values

Methods

ppr :: Value -> Doc #

pprPrec :: Int -> Value -> Doc #

pprList :: [Value] -> Doc #