diff --git a/Network/HTTP/Date/Formatter.hs b/Network/HTTP/Date/Formatter.hs
--- a/Network/HTTP/Date/Formatter.hs
+++ b/Network/HTTP/Date/Formatter.hs
@@ -12,9 +12,11 @@
 
 ----------------------------------------------------------------
 
-{-|
-  Generating HTTP Date in RFC1123 style.
--}
+-- | Generating HTTP Date in RFC1123 style.
+--
+-- >>> formatHTTPDate defaultHTTPDate {hdYear = 1994, hdMonth = 11, hdDay = 15, hdHour = 8, hdMinute = 12, hdSecond = 31, hdWkday = 2}
+-- "Tue, 15 Nov 1994 08:12:31 GMT"
+
 formatHTTPDate :: HTTPDate -> ByteString
 formatHTTPDate hd =
     unsafeCreate 29 $ \ptr -> do
diff --git a/Network/HTTP/Date/Parser.hs b/Network/HTTP/Date/Parser.hs
--- a/Network/HTTP/Date/Parser.hs
+++ b/Network/HTTP/Date/Parser.hs
@@ -11,13 +11,16 @@
 
 ----------------------------------------------------------------
 
-{-|
-  Parsing HTTP Date. Currently only RFC1123 style is supported.
--}
+-- |
+-- Parsing HTTP Date. Currently only RFC1123 style is supported.
+--
+-- >>> parseHTTPDate "Tue, 15 Nov 1994 08:12:31 GMT"
+-- Just (HTTPDate {hdYear = 1994, hdMonth = 11, hdDay = 15, hdHour = 8, hdMinute = 12, hdSecond = 31, hdWkday = 2})
+
 parseHTTPDate :: ByteString -> Maybe HTTPDate
-parseHTTPDate bs = case feed (parse rfc1123Date bs) "" of
-    Done _ ut -> Just ut
-    _         -> Nothing
+parseHTTPDate bs = case parseOnly rfc1123Date bs of
+    Right ut -> Just ut
+    _        -> Nothing
 
 rfc1123Date :: Parser HTTPDate
 rfc1123Date = do
diff --git a/http-date.cabal b/http-date.cabal
--- a/http-date.cabal
+++ b/http-date.cabal
@@ -1,5 +1,5 @@
 Name:                   http-date
-Version:                0.0.1
+Version:                0.0.2
 Author:                 Kazu Yamamoto <kazu@iij.ad.jp>
 Maintainer:             Kazu Yamamoto <kazu@iij.ad.jp>
 License:                BSD3
@@ -7,9 +7,10 @@
 Synopsis:               HTTP Date parser/formatter
 Description:            Fast parser and formatter for HTTP Date
 Category:               Network, Web
-Cabal-Version:          >= 1.6
+Cabal-Version:          >= 1.8
 Build-Type:             Simple
-library
+
+Library
   if impl(ghc >= 6.12)
     GHC-Options:        -Wall -fno-warn-unused-do-bind
   else
@@ -19,8 +20,26 @@
                         Network.HTTP.Date.Formatter
                         Network.HTTP.Date.Types
                         Network.HTTP.Date.Parser
-  Build-Depends:        base >= 4 && < 5,
-                        bytestring, array, attoparsec
+  Build-Depends:        base >= 4 && < 5
+                      , array
+                      , attoparsec
+                      , bytestring
+
+Test-Suite test
+  Type:                 exitcode-stdio-1.0
+  HS-Source-Dirs:       test
+  Main-Is:              Test.hs
+  Other-Modules:        Model
+  Build-Depends:        base >= 4 && < 5
+                      , bytestring
+                      , http-date
+                      , old-locale
+                      , time
+                      , HUnit
+                      , test-framework-doctest
+                      , test-framework-hunit
+                      , test-framework-th-prime
+
 Source-Repository head
   Type:                 git
-  Location:             git://github.com/kazu-yamamoto/http-date
+  Location:             git clone git://github.com/kazu-yamamoto/http-date
diff --git a/test/Model.hs b/test/Model.hs
new file mode 100644
--- /dev/null
+++ b/test/Model.hs
@@ -0,0 +1,14 @@
+module Model where
+
+import Data.ByteString (ByteString)
+import qualified Data.ByteString.Char8 as BS8
+import Data.Time
+import Data.Time.Clock.POSIX
+import System.Locale
+import System.Posix.Types
+
+epochTimeToUtcTime :: EpochTime -> UTCTime
+epochTimeToUtcTime = posixSecondsToUTCTime . realToFrac
+
+utcToDate :: UTCTime -> ByteString
+utcToDate = BS8.pack . formatTime defaultTimeLocale "%a, %d %b %Y %H:%M:%S GMT"
diff --git a/test/Test.hs b/test/Test.hs
new file mode 100644
--- /dev/null
+++ b/test/Test.hs
@@ -0,0 +1,38 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+module Main where
+
+import Control.Monad
+import Model
+import Network.HTTP.Date
+import Test.Framework.Providers.DocTest
+import Test.Framework.Providers.HUnit
+import Test.Framework.TH.Prime
+import Test.HUnit
+
+main :: IO ()
+main = $(defaultMainGenerator)
+
+----------------------------------------------------------------
+
+doc_test :: DocTests
+doc_test = docTest ["Network/HTTP/Date"] ["-XOverloadedStrings"]
+
+----------------------------------------------------------------
+
+case_formatHTTPDate :: Assertion
+case_formatHTTPDate = do
+    forM_ [0,100000..10000000000] $ \epochtime -> do
+        let m = model epochtime
+            o = ours epochtime
+        o @?= m
+  where
+    model = utcToDate . epochTimeToUtcTime
+    ours  = formatHTTPDate . epochTimeToHTTPDate
+
+case_parseHTTPDate :: Assertion
+case_parseHTTPDate = do
+    forM_ [0,100000..10000000000] $ \epochtime -> do
+        let m = epochTimeToHTTPDate epochtime
+            Just o = parseHTTPDate $ formatHTTPDate m
+        o @?= m
