Permalink
Browse files

Using TH.

  • Loading branch information...
1 parent e80d4b1 commit dcdefc0fded69af599af7b90187254c5e3ea5f2d @kazu-yamamoto committed Dec 20, 2011
Showing with 11 additions and 18 deletions.
  1. +11 −18 Test.hs
View
29 Test.hs
@@ -1,31 +1,28 @@
-{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE OverloadedStrings, TemplateHaskell #-}
module Test where
import Control.Applicative
-import Data.Map as M
import Data.IP
import Data.IP.RouteTable as T
+import Data.Map as M
import Network.DomainAuth
+import RPF.IP
import RPF.Parser
import RPF.Types
-import RPF.IP
-import Test.Framework (defaultMain, testGroup, Test)
import Test.Framework.Providers.HUnit
-import Test.HUnit hiding (Test)
+import Test.Framework.TH
+import Test.HUnit
+
+----------------------------------------------------------------
-tests :: [Test]
-tests = [
- testGroup "Policy" [
- testCase "policy1" test_policy1
--- , testCase "policy2" test_policy2
- ]
- ]
+main :: IO ()
+main = $(defaultMainGenerator)
----------------------------------------------------------------
-test_policy1 :: Assertion
-test_policy1 = do
+case_policy1 :: Assertion
+case_policy1 = do
plcy <- parsePolicy <$> readFile "config/rpf.policy"
plcy @?= res
where
@@ -38,7 +35,3 @@ test_policy1 = do
[IPTable (T.fromList [(makeAddrRange (toIPv4 [127,0,0,1]) 32,True)]) T.empty]
[M.fromList [("yahoo.com",True)]]
-----------------------------------------------------------------
-
-main :: IO ()
-main = defaultMain tests

0 comments on commit dcdefc0

Please sign in to comment.