Skip to content

Commit

Permalink
Add regression test for Copilot-Language/copilot#431
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanGlScott committed Jan 8, 2024
1 parent b399ebc commit 9024e68
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions copilot-verifier/copilot-verifier.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ library copilot-verifier-examples
Copilot.Verifier.Examples.ShouldPass.Array
Copilot.Verifier.Examples.ShouldPass.ArrayGen
Copilot.Verifier.Examples.ShouldPass.ArrayOfStructs
Copilot.Verifier.Examples.ShouldPass.ArrayTriggerArgument
Copilot.Verifier.Examples.ShouldPass.Arith
Copilot.Verifier.Examples.ShouldPass.Clock
Copilot.Verifier.Examples.ShouldPass.Counter
Expand Down
2 changes: 2 additions & 0 deletions copilot-verifier/examples/Copilot/Verifier/Examples.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import qualified Copilot.Verifier.Examples.ShouldFail.Partial.SubSignedWrap a
import qualified Copilot.Verifier.Examples.ShouldPass.Array as Array
import qualified Copilot.Verifier.Examples.ShouldPass.ArrayGen as ArrayGen
import qualified Copilot.Verifier.Examples.ShouldPass.ArrayOfStructs as ArrayOfStructs
import qualified Copilot.Verifier.Examples.ShouldPass.ArrayTriggerArgument as ArrayTriggerArgument
import qualified Copilot.Verifier.Examples.ShouldPass.Arith as Arith
import qualified Copilot.Verifier.Examples.ShouldPass.Clock as Clock
import qualified Copilot.Verifier.Examples.ShouldPass.Counter as Counter
Expand Down Expand Up @@ -62,6 +63,7 @@ shouldPassExamples verb = Map.fromList
[ example "Array" (Array.verifySpec verb)
, example "ArrayGen" (ArrayGen.verifySpec verb)
, example "ArrayOfStructs" (ArrayOfStructs.verifySpec verb)
, example "ArrayTriggerArgument" (ArrayTriggerArgument.verifySpec verb)
, example "Arith" (Arith.verifySpec verb)
, example "Clock" (Clock.verifySpec verb)
, example "Counter" (Counter.verifySpec verb)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{-# LANGUAGE DataKinds #-}

-- | A regression test for
-- <https://github.com/Copilot-Language/copilot/issues/431>.
module Copilot.Verifier.Examples.ShouldPass.ArrayTriggerArgument where

import Language.Copilot
import Copilot.Compile.C99
import Copilot.Verifier ( Verbosity, VerifierOptions(..)
, defaultVerifierOptions, verifyWithOptions )

spec :: Spec
spec = trigger "f" true [arg stream]
where
stream :: Stream (Array 2 Int16)
stream = constant (array [3,4])

verifySpec :: Verbosity -> IO ()
verifySpec verb = do
spec' <- reify spec
verifyWithOptions
defaultVerifierOptions{verbosity = verb}
mkDefaultCSettings [] "arrayTriggerArgument" spec'

0 comments on commit 9024e68

Please sign in to comment.