X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FOctet.hs;h=efc19d5607550e98da3bd47221fecb403e76d9e6;hb=3c4efe66ab7cb5f528c5a711976ca7c8e56213cf;hp=e2e01ea93eadbc9d72d06a522c562227596fdced;hpb=d74254fd2a30214d7a8e4b9c407a6ec4fd6fed7f;p=hath.git diff --git a/src/Octet.hs b/src/Octet.hs index e2e01ea..efc19d5 100644 --- a/src/Octet.hs +++ b/src/Octet.hs @@ -1,5 +1,7 @@ module Octet where +import Test.HUnit + import Bit -- An Octet consists of eight bits. For our purposes, the most @@ -67,3 +69,14 @@ min_octet = Octet Zero Zero Zero Zero Zero Zero Zero Zero -- The octet with the greatest possible value. max_octet :: Octet max_octet = Octet One One One One One One One One + + + +-- HUnit Tests +test_octet_from_int1 = + TestCase $ assertEqual "octet_from_int 128 should parse as 10000000" oct1 (octet_from_int 128) + where + oct1 = Octet One Zero Zero Zero Zero Zero Zero Zero + + +octet_tests = [ test_octet_from_int1 ]