diff --git a/Tests/pem.hs b/Tests/pem.hs
new file mode 100644
--- /dev/null
+++ b/Tests/pem.hs
@@ -0,0 +1,32 @@
+module Main where
+
+import Control.Applicative
+import Control.Monad
+
+import Test.QuickCheck hiding ((.&.))
+import Test.Framework (Test, defaultMain, testGroup)
+import Test.Framework.Providers.QuickCheck2 (testProperty)
+
+import Data.PEM
+import qualified Data.ByteString as B
+
+main :: IO ()
+main = defaultMain tests
+
+tests :: [Test]
+tests =
+    [ testProperty "marshall" testMarshall
+    ]
+
+testMarshall pems = readPems == Right pems
+    where readPems = pemParseBS writtenPems
+          writtenPems = B.concat (map pemWriteBS pems)
+
+arbitraryName = choose (1, 30) >>= \i -> replicateM i arbitraryAscii
+    where arbitraryAscii = elements ['A'..'Z']
+
+arbitraryContent = choose (1,10) >>= \i ->
+                   (B.pack . map fromIntegral) `fmap` replicateM i (choose (0,255) :: Gen Int)
+
+instance Arbitrary PEM where
+    arbitrary = PEM <$> arbitraryName <*> pure [] <*> arbitraryContent
diff --git a/pem.cabal b/pem.cabal
--- a/pem.cabal
+++ b/pem.cabal
@@ -1,5 +1,5 @@
 Name:                pem
-Version:             0.1.0
+Version:             0.1.1
 Description:         Privacy Enhanced Mail (PEM) format reader and writer.
 License:             BSD3
 License-file:        LICENSE
@@ -13,6 +13,7 @@
 Cabal-Version:       >=1.8
 Homepage:            http://github.com/vincenthz/hs-pem
 data-files:          README.md
+extra-source-files:  Tests/pem.hs
 
 Library
   Build-Depends:     base >= 3 && < 5
@@ -33,7 +34,7 @@
     main-is:         pem.hs
     build-depends:   base
                    , bytestring
-                   , test-framework >= 0.3.3 && < 0.6
+                   , test-framework >= 0.3.3 && < 0.7
                    , test-framework-quickcheck2 >= 0.2.9 && < 0.3
                    , QuickCheck >= 2.4.0.1
                    , pem
