-- Testing facilities

-- testExpected1 :: IdDB
-- testExpected1 = [
--     ("dead","./hello.c",47,27,IdRef),
--     ("bar","./hello.c",47,16,IdRef),
--     ("foo","./hello.c",47,8,IdRef),
--     ("func2","./hello.c",47,2,IdCall),
--     ("fieldm","./hello.c",42,13,IdRef),
--     ("st3","./hello.c",42,6,IdCall),
--     ("m","./hello.c",42,2,IdRef),
--     ("fieldi","./hello.c",41,11,IdRef),
--     ("st2","./hello.c",41,6,IdRef),
--     ("test_label","./hello.c",40,1,IdLabel),
--     ("fieldk","./hello.c",38,10,IdRef),
--     ("st1","./hello.c",38,6,IdRef),
--     ("only_false","./hello.c",37,16,IdRef),
--     ("cond2","./hello.c",37,6,IdRef),
--     ("else_false","./hello.c",36,24,IdRef),
--     ("if_true","./hello.c",36,14,IdRef),
--     ("cond1","./hello.c",36,6,IdRef),
--     ("global2","./hello.c",34,6,IdRef),
--     ("func3","./hello.c",30,6,IdDecl),
--     ("field2","./hello.c",4,31,IdDecl),
--     ("field1","./hello.c",4,18,IdDecl),
--     ("st1","./hello.c",4,8,IdDecl),
--     ("gloabl2","./hello.c",2,5,IdDecl),
--     ("global0","./hello.c",1,5,IdDecl),
--     ("cond1","./hello.c",43,6,IdRef),
--     ("global1","./hello.c",44,7,IdRef),
--     ("beef","./hello.c",46,7,IdRef)
--     ]
--
-- stringDef :: String
-- stringDef = "\ESC[0m"
--
-- stringRed :: String
-- stringRed = "\ESC[31m"
--
-- stringGreen :: String
-- stringGreen = "\ESC[32m"
--
-- stringColor :: String -> String -> String
-- stringColor color str = color ++ str ++ stringDef
--
-- runTest :: String -> IdDB -> IO ()
-- runTest input_file expected = do
--     ast <- errorOnLeftM "Parse Error" $
--         parseCFile (newGCC "gcc") Nothing [""] input_file
--     case ast of
--         CTranslUnit l _ ->
--             let res = parseTranslUnit [] l in
--             if hasDup res && length res == length expected
--                 then die $ "has duplicate entries"
--                 else checkRes res
--     where
--         hasDup xs = length (nub xs) /= length xs
--         checkRes [] = putStrLn $ stringColor stringGreen "Passed!"
--         checkRes (x:xs) =
--             case find (\e -> e == x) expected of
--                 Just _ -> checkRes xs
--                 _ -> do
--                     putStrLn $ stringColor
--                                 stringRed
--                                 ((show x) ++ " not found in expected")
--                     checkRes xs


