-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.hs
33 lines (25 loc) · 1.14 KB
/
test.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
module Main where
import Converter
import Data.Char (toLower)
import Control.Monad (when)
import System.Environment (getArgs)
import System.Exit (exitWith, ExitCode (..))
main :: IO ()
main = do
argsToMd <- return $ ["toMd"] ++ map ("./testing/lhs-md/"++) ["input0.lhs", "input1.lhs", "input2.lhs"]
argsToLhs <- return $ ["toLhs"] ++ map ("./testing/md-lhs/"++) ["input0.md", "input1.md", "input2.md"]
checkToMd <- return $ map ("./testing/lhs-md/"++) ["output0.md", "output1.md", "output2.md"]
checkToLhs <- return $ map ("./testing/md-lhs/"++) ["output0.lhs", "output1.lhs", "output2.lhs"]
let pathsToMd = tail argsToMd
pathsToLhs = tail argsToLhs
toMdFiles <- mapM readFile pathsToMd
toLhsFiles <- mapM readFile pathsToLhs
toMdOutputs <- mapM readFile checkToMd
toLhsOutputs <- mapM readFile checkToLhs
-- convert
convertedToMd <- return $ map convertToMd toMdFiles
convertedToLhs <- return $ map convertToLhs toLhsFiles
-- check
exitWith $ if (convertedToMd == toMdOutputs && convertedToLhs == toLhsOutputs)
then ExitFailure 1
else ExitSuccess