dns >= 0.3.7,
iproute == 1.2.*,
MissingH == 1.2.*,
- parallel-io == 0.3.*
+ parallel-io == 0.3.*,
+ -- Test deps
+ HUnit == 1.2.*,
+ test-framework == 0.8.*,
+ test-framework-hunit == 0.3.*
main-is:
Main.hs
-optc-O3
-optc-march=native
+test-suite testsuite
+ type: exitcode-stdio-1.0
+ hs-source-dirs: src test
+ main-is: TestSuite.hs
+ build-depends:
+ base == 4.*,
+ bytestring == 0.10.*,
+ cmdargs == 0.10.*,
+ dns >= 0.3.7,
+ iproute == 1.2.*,
+ MissingH == 1.2.*,
+ parallel-io == 0.3.*,
+ -- Test deps
+ HUnit == 1.2.*,
+ test-framework == 0.8.*,
+ test-framework-hunit == 0.3.*
+
+ -- It's not entirely clear to me why I have to reproduce all of this.
+ ghc-options:
+ -Wall
+ -fwarn-hi-shadowing
+ -fwarn-missing-signatures
+ -fwarn-name-shadowing
+ -fwarn-orphans
+ -fwarn-type-defaults
+ -fwarn-tabs
+ -fwarn-incomplete-record-updates
+ -fwarn-monomorphism-restriction
+ -fwarn-unused-do-bind
+ -rtsopts
+ -threaded
+ -optc-O3
+ -optc-march=native
+
+
source-repository head
type: git
location: http://michael.orlitzky.com/git/haeredes.git
module DNS (
LookupResult,
+ dns_tests,
lookupMX',
lookupNS',
normalize,
rdata,
rrtype,
withResolver )
+import Test.Framework (Test, testGroup)
+import Test.Framework.Providers.HUnit (testCase)
+import Test.HUnit (assertEqual)
import Text.Read (readMaybe)
type LookupResult = (Domain, Maybe [Domain])
normalize_case :: Domain -> Domain
normalize_case = BS.map toLower
+
+
+test_normalize_case :: Test
+test_normalize_case =
+ testCase desc $
+ assertEqual desc expected actual
+ where
+ desc = "normalize_case lowercases DNS names"
+ expected = BS.pack "example.com"
+ actual = normalize_case $ BS.pack "ExAmPlE.COM"
+
+dns_tests :: Test
+dns_tests =
+ testGroup "DNS Tests" [
+ test_normalize_case ]