TestFlatCurryXML.curry 884 Bytes
Newer Older
Michael Hanus's avatar
Michael Hanus committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
------------------------------------------------------------------------------
--- Some tests for library `FlatCurry.XML`.
---
--- @author Michael Hanus
------------------------------------------------------------------------------

import FlatCurry.Types
import FlatCurry.Files
import FlatCurry.XML
import XML
import Test.Prop

-- Shows a program in XML format:
showxml mod = do
  prog <- readFlatCurry mod
Michael Hanus's avatar
Michael Hanus committed
16
  putStrLn $ showXmlDoc (flatCurry2Xml prog)
Michael Hanus's avatar
Michael Hanus committed
17
18
19
20
21
22
23
24
25
26
27
28

-- Store a program in XML format:
store mod = do
  prog <- readFlatCurry mod
  flatCurry2XmlFile prog (mod++"_fcy.xml")
  putStrLn (mod++"_fcy.xml"++" written")

-- Test for equality after XML encoding/decoding:
testEqualFcy prog = prog == xml2FlatCurry (flatCurry2Xml prog)

readAndTestEqualFcy mod = do
  prog <- readFlatCurry mod
Michael Hanus's avatar
Michael Hanus committed
29
  return $ testEqualFcy prog
Michael Hanus's avatar
Michael Hanus committed
30
31
32


testXML_test_for_rev = (readAndTestEqualFcy "rev") `returns` True