Permalink
Browse files

Updated examples --- seem to work.

  • Loading branch information...
1 parent 77885d8 commit 317f0672fe85d6ae33ae00ee3ef3b7b46f07ec9d @leepike committed Dec 31, 2011
Showing with 51 additions and 33 deletions.
  1. +4 −4 Examples/Examples.hs
  2. +12 −12 Examples/Examples2.hs
  3. +1 −1 Examples/LTLExamples.hs
  4. +34 −16 Examples/Test.hs
View
8 Examples/Examples.hs
@@ -131,10 +131,10 @@ examples = do
putStrLn "Interpreter:"
putStrLn ""
interpret 10 spec
- putStrLn ""
- putStrLn ""
- putStrLn "Atom:"
- reify spec >>= compile defaultParams
+ -- putStrLn ""
+ -- putStrLn ""
+ -- putStrLn "Atom:"
+ -- reify spec >>= compile defaultParams
putStrLn "Check equivalence:"
putStrLn ""
putStrLn ""
View
24 Examples/Examples2.hs
@@ -12,12 +12,6 @@ import Data.List (cycle)
--------------------------------------------------------------------------------
-nats :: Stream Word64
-nats = [0] ++ nats + 1
-
-alt :: Stream Bool
-alt = [True] ++ not alt
-
{-
alt2 :: Stream Word64
alt2 = [0,1,2] ++ alt2 + 1
@@ -27,11 +21,21 @@ alt3 = [True,True,False] ++ alt3
fib' :: Stream Word64
fib' = [0, 1] ++ fib' + drop 1 fib
--}
fib :: Stream Word64
fib = [0, 1] ++ fib + drop 1 fib
+fibSpec :: Spec
+fibSpec = do
+ trigger "fib_out" true [arg fib]
+-}
+
+nats :: Stream Word64
+nats = [0] ++ nats + 1
+
+alt :: Stream Bool
+alt = [True] ++ not alt
+
logic :: Stream Bool
logic = [True, False] ++ logic || drop 1 logic
@@ -50,11 +54,7 @@ spec = do
, arg logic
]
-fibSpec :: Spec
-fibSpec = do
- trigger "fib_out" true [arg fib]
-
examples2 :: IO ()
examples2 = do
- reify fibSpec >>= S.compile S.defaultParams
+-- reify fibSpec >>= S.compile S.defaultParams
reify spec >>= S.compile S.defaultParams
View
2 Examples/LTLExamples.hs
@@ -38,7 +38,7 @@ ltlTest = do
trigger "testAlways1" true [ arg $ testAlways 0 0 ]
trigger "testAlways2" true [ arg $ testAlways 5 1 ]
trigger "testNext" true [ arg $ testNext ]
- trigger "testFuture" true [ arg $ testFuture 9 10 ]
+ trigger "testFuture" true [ arg $ testFuture 12 10 ]
trigger "testUntil" true [ arg $ testUntil 5 6 4 ]
trigger "testRelease" true [ arg $ testRelease 5 5 4 ]
View
50 Examples/Test.hs
@@ -6,7 +6,10 @@
module Main where
-import System.Directory (removeFile, removeDirectoryRecursive)
+import System.Directory (removeDirectoryRecursive, doesDirectoryExist)
+import qualified Copilot.Compile.C99 as C99
+import qualified Copilot.Compile.SBV as SBV
+import Control.Monad (when)
import AddMult
import Array
@@ -31,55 +34,70 @@ import VotingExamples
main :: IO ()
main = do
+ cleanup
putStrLn "Testing addMult ..."
- addMult >> sbvCleanup
+ addMult >> cleanup
+ putStrLn ""
putStrLn "Testing array ..."
array >> cleanup
- putStrLn "Testing badExtVars ..."
+ putStrLn ""
+-- putStrLn "Testing badExtVars ..."
-- badExtVars >> cleanup
+ putStrLn ""
putStrLn "Testing castEx ..."
castEx >> cleanup
+ putStrLn ""
putStrLn "Testing clockExamples ..."
clockExamples >> cleanup
+ putStrLn ""
putStrLn "Testing engineExample ..."
engineExample >> cleanup
+ putStrLn ""
putStrLn "Testing examples ..."
- examples >> sbvCleanup
+ examples >> cleanup
+ putStrLn ""
putStrLn "Testing examples2 ..."
- examples2 >> sbvCleanup
+ examples2 >> cleanup
+ putStrLn ""
putStrLn "Testing extFuns ..."
extFuns >> cleanup
+ putStrLn ""
putStrLn "Testing localEx ..."
localEx >> cleanup
+ putStrLn ""
putStrLn "Testing ltlExamples ..."
ltlExamples >> cleanup
+ putStrLn ""
putStrLn "Testing ptltlExamples ..."
ptltlExamples >> cleanup
+ putStrLn ""
putStrLn "Testing randomEx ..."
randomEx >> cleanup
+ putStrLn ""
putStrLn "Testing regExpExamples ..."
regExpExamples >> cleanup
+ putStrLn ""
putStrLn "Testing stackExamples ..."
stackExamples >> cleanup
+ putStrLn ""
putStrLn "Testing statExamples ..."
statExamples >> cleanup
+ putStrLn ""
putStrLn "Testing votingExamples ..."
votingExamples >> cleanup
-
- putStrLn "*********************************"
- putStrLn " Ok, things seem to work. Enjoy!"
- putStrLn "*********************************"
+ putStrLn ""
+ putStrLn ""
+ putStrLn "************************************"
+ putStrLn " Ok, the basic tests passed. Enjoy!"
+ putStrLn "************************************"
--------------------------------------------------------------------------------
-sbvCleanup :: IO ()
-sbvCleanup = removeDirectoryRecursive "copilot"
-
cleanup :: IO ()
cleanup = do
- --
- -- removeFile "copilot.c"
- -- removeFile "copilot.h"
- return ()
+ b0 <- doesDirectoryExist SBV.sbvDirName
+ when b0 (removeDirectoryRecursive SBV.sbvDirName)
+ b1 <- doesDirectoryExist C99.c99DirName
+ when b1 (removeDirectoryRecursive C99.c99DirName)
--------------------------------------------------------------------------------

0 comments on commit 317f067

Please sign in to comment.