Skip to content

Commit

Permalink
IP iteral.
Browse files Browse the repository at this point in the history
  • Loading branch information
kazu-yamamoto committed Jul 19, 2011
1 parent 80e15f0 commit c8549ad
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Test.hs
Expand Up @@ -2,7 +2,6 @@

module Test where

import Data.IP
import Data.List
import Network.DNS as DNS
import Test.Framework (defaultMain, testGroup, Test)
Expand All @@ -27,7 +26,7 @@ test_lookupA :: IO ()
test_lookupA = do
rs <- makeResolvSeed defaultResolvConf
withResolver rs $ \resolver ->
DNS.lookupA resolver "www.mew.org" ?= Just [toIPv4 [202,232,15,101]]
DNS.lookupA resolver "www.mew.org" ?= Just ["202.232.15.101"]

(??=) :: (Ord a, Show a) => IO (Maybe [a]) -> [a] -> IO ()
a ??= bs = do
Expand All @@ -41,7 +40,7 @@ test_lookupAAAA = do
rs <- makeResolvSeed defaultResolvConf
withResolver rs $ \resolver -> do
DNS.lookupAAAA resolver "mew.org" ?= Nothing
DNS.lookupAAAA resolver "www.mew.org" ?= Just [read "2001:240:11e:c00::101"]
DNS.lookupAAAA resolver "www.mew.org" ?= Just ["2001:240:11e:c00::101"]

test_lookupTXT :: IO ()
test_lookupTXT = do
Expand All @@ -53,13 +52,13 @@ test_lookupAviaMX :: IO ()
test_lookupAviaMX = do
rs <- makeResolvSeed defaultResolvConf
withResolver rs $ \resolver ->
DNS.lookupAviaMX resolver "mixi.jp" ??= [read "202.32.29.4", read "202.32.29.5"]
DNS.lookupAviaMX resolver "mixi.jp" ??= ["202.32.29.4", "202.32.29.5"]

test_lookupAviaCNAME :: IO ()
test_lookupAviaCNAME = do
rs <- makeResolvSeed defaultResolvConf
withResolver rs $ \resolver ->
DNS.lookupA resolver "foundry1.hongo.wide.ad.jp" ??= [read "203.178.135.1", read "203.178.138.230"]
DNS.lookupA resolver "ghs.google.com" ??= ["64.233.183.121"]

main :: IO ()
main = defaultMain tests

0 comments on commit c8549ad

Please sign in to comment.