From: Michael Orlitzky Date: Sat, 28 Aug 2010 05:39:37 +0000 (-0400) Subject: Added two new tests exposing an existing bug. X-Git-Tag: 0.0.1~20 X-Git-Url: https://gitweb.michael.orlitzky.com/?p=hath.git;a=commitdiff_plain;h=d449d173dd4fcf4a857088ffa58b4ed2dc1aa15e Added two new tests exposing an existing bug. --- diff --git a/src/Cidr.hs b/src/Cidr.hs index f13c4f3..06550ad 100644 --- a/src/Cidr.hs +++ b/src/Cidr.hs @@ -245,6 +245,22 @@ adjacent cidr1 cidr2 -- HUnit Tests +test_min_host1 :: Test +test_min_host1 = + TestCase $ assertEqual "The minimum host in 10.0.0.0/24 is 10.0.0.0" expected actual + where + actual = show $ min_host (cidr_from_string "10.0.0.0/24") + expected = "10.0.0.0" + + +test_max_host1 :: Test +test_max_host1 = + TestCase $ assertEqual "The maximum host in 10.0.0.0/24 is 10.0.0.255" expected actual + where + actual = show $ min_host (cidr_from_string "10.0.0.0/24") + expected = "10.0.0.255" + + test_equality1 :: Test test_equality1 = TestCase $ assertEqual "10.1.1.0/23 equals itself" True (cidr1 == cidr1) @@ -356,7 +372,9 @@ test_combine_all2 = cidr_tests :: [Test] -cidr_tests = [ test_equality1, +cidr_tests = [ test_min_host1, + test_max_host1, + test_equality1, test_contains1, test_contains2, test_contains_proper1,