Skip to content
Snippets Groups Projects
TExamples.hs 971 B
Newer Older
  • Learn to ignore specific revisions
  • Orestis Melkonian's avatar
    Orestis Melkonian committed
    module TExamples where
    import System.IO.Unsafe (unsafePerformIO)
    
    Orestis Melkonian's avatar
    Orestis Melkonian committed
    import System.IO.Silently (silence)
    
    Orestis Melkonian's avatar
    Orestis Melkonian committed
    import Test.HUnit
    
    import SimpleFormulaChecker
    
    edslSrc = "examples/javawlp_edsl/src/nl/uu/javawlp_edsl/Main.java"
    
    testEquiv :: Bool -> String -> String -> Assertion
    testEquiv b s s' =
    
    Orestis Melkonian's avatar
    Orestis Melkonian committed
      unsafePerformIO (silence $ compareSpec (edslSrc, s) (edslSrc, s')) @?= b
    
    Orestis Melkonian's avatar
    Orestis Melkonian committed
    (.==) = testEquiv True
    (.!=) = testEquiv False
    
    equivalenceTests =
    
      [ "swap_spec1" .== "swap_spec1"
    
    Orestis Melkonian's avatar
    Orestis Melkonian committed
      , "swap_spec1" .!= "swap_spec2"
      , "getMax_spec1" .!= "getMax_spec2"
      , "test1" .!= "test2"
      , "blob1" .== "blob1"
      , "test1_" .!= "test2"
      , "null1" .!= "null2"
      , "swap_spec1" .!= "swap_spec3"
      , "swap_spec1" .!= "swap_spec4"
      , "null3" .!= "test2"
      , "sorted1" .!= "test2"
      , "sorted1" .!= "sorted2"
      , "sorted1".!= "sorted3"
      , "test2" .!= "sorted3"
      , "sorted3" .!= "sorted4"
      -- , equivalent "sorted1" "sorted4" -- does not terminate (TODO: should time out, but this does not work)
      ]