Skip to content
Snippets Groups Projects
TExamples.hs 1.16 KiB
Newer Older
  • Learn to ignore specific revisions
  • Orestis Melkonian's avatar
    Orestis Melkonian committed
    module TExamples where
    
    import System.IO          (stderr, stdout)
    import System.IO.Silently (hSilence)
    import System.IO.Unsafe   (unsafePerformIO)
    
    Orestis Melkonian's avatar
    Orestis Melkonian committed
    import Test.HUnit
    
    
    import API
    
    import Model
    
    Orestis Melkonian's avatar
    Orestis Melkonian committed
    
    
    Orestis Melkonian's avatar
    Orestis Melkonian committed
    src = "examples/javawlp_edsl/src/nl/uu/javawlp_edsl/Main.java"
    
    Orestis Melkonian's avatar
    Orestis Melkonian committed
    
    
    Orestis Melkonian's avatar
    Orestis Melkonian committed
    testEquiv :: Response -> String -> String -> Assertion
    
    Orestis Melkonian's avatar
    Orestis Melkonian committed
    testEquiv b s s' = do
    
      res <- hSilence [stdout, stderr] $ compareSpec Release File (src, s) (src, s')
    
    Orestis Melkonian's avatar
    Orestis Melkonian committed
      (case res of
    
        NotEquivalent _ _ -> NotEquivalent emptyModel defFeedback'
    
        x                 -> x) @?= b
    
    Orestis Melkonian's avatar
    Orestis Melkonian committed
    (.==) = testEquiv Equivalent
    
    (.!=) = testEquiv $ NotEquivalent emptyModel defFeedback'
    
    Orestis Melkonian's avatar
    Orestis Melkonian committed
    (.??) = testEquiv Timeout
    
    Orestis Melkonian's avatar
    Orestis Melkonian committed
    
    
    Orestis Melkonian's avatar
    Orestis Melkonian committed
    examples =
    
      [ "empty1" .== "empty2"
      , "arr1" .!= "arr2"
    
      , "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"
    
      , "sorted2".!= "sorted3"
    
    Orestis Melkonian's avatar
    Orestis Melkonian committed
      , "sorted1".!= "sorted3"
      , "test2" .!= "sorted3"
      , "sorted3" .!= "sorted4"
    
      , "sorted1" .== "sorted4"
    
    Orestis Melkonian's avatar
    Orestis Melkonian committed
      ]