X-Git-Url: http://gitweb.michael.orlitzky.com/?p=hath.git;a=blobdiff_plain;f=src%2FOctet.hs;h=efc19d5607550e98da3bd47221fecb403e76d9e6;hp=e2e01ea93eadbc9d72d06a522c562227596fdced;hb=ea9bf8a98dbfc40ebad2af43b6594bac0a852dcd;hpb=62733fdca35195dd5ad984bdd5c9d1247d2a9bc0 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 ]