diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -20,6 +20,16 @@
     cabal build
     cabal install --enable-documentation
 
+To run the tests in the folder testing/, change to the src directory and run 
+
+    cabal configure --enable-tests
+    cabal test
+
+To run the tests with the test coverage report, change to the src directory and run 
+
+    cabal configure --enable-tests -f testcoverage
+    cabal test
+
 You'll need a Haskell Platform, which should include appropriate
 versions of Cabal and GHC.
 
diff --git a/changelog.md b/changelog.md
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,19 @@
 # Changelog for [`hoopl` package](http://hackage.haskell.org/package/hoopl)
 
+## 3.10.1.1 *Aug 2015*
+
+ - Add #if CABAL macro to several hoopl source files such that the Cabal generated macro is not included when building in ghci
+
+ - Change the test code (testing/*) to compare the converted graphs against the expected graphs in AST form 
+
+ - Update the cabal file to run tests and generate a test coverage report 
+ 
+ - Unhide gSplice of Hoopl.Graph
+
+ - Expose Showing of Hoopl.Show
+
+ - Some fixes of testing
+
 ## 3.10.1.0 *Apr 2015*
 
  - Re-export runWithFuel from Compiler.Hoopl.
diff --git a/hoopl.cabal b/hoopl.cabal
--- a/hoopl.cabal
+++ b/hoopl.cabal
@@ -1,5 +1,5 @@
 Name:                hoopl
-Version:             3.10.1.0
+Version:             3.10.2.0
 -- NOTE: Don't forget to update ./changelog.md
 Description:
   Higher-order optimization library
@@ -12,7 +12,7 @@
 Author:              Norman Ramsey, Joao Dias, Simon Marlow and Simon Peyton Jones
 Maintainer:          nr@cs.tufts.edu, andreas.voellmy@gmail.com, email@ningwang.org
 Homepage:            http://ghc.cs.tufts.edu/hoopl/
-Bug-Reports:         http://ghc.haskell.org/trac/ghc/newticket?component=libraries/hoopl
+Bug-Reports:         https://github.com/haskell/hoopl/issues/
 Build-Type:          Simple
 Cabal-Version:       >=1.10
 Synopsis:            A library to support dataflow analysis and optimization
@@ -24,6 +24,11 @@
   Type:       git
   Location:   http://git.haskell.org/packages/hoopl.git
 
+flag testcoverage 
+  description: Enable test coverage report
+  default: False
+
+
 Library
   Default-Language:  Haskell2010
   Other-Extensions:  CPP
@@ -68,3 +73,19 @@
 
   Ghc-Options:       -Wall -fno-warn-name-shadowing
 
+Test-Suite hoopl-test
+  Default-Language:  Haskell2010
+  Type:              exitcode-stdio-1.0
+  Main-Is:           Main.hs
+  Hs-Source-Dirs:    testing src
+  Build-Depends:     base >= 4.3 && < 4.9, 
+                     containers >= 0.4 && < 0.6,
+                     filepath,
+                     mtl >= 2.1.3.1,
+                     parsec >= 3.1.7,
+                     test-framework < 0.9,
+                     test-framework-hunit < 0.4,
+                     mtl >= 2.1.3.1
+
+  if flag(testcoverage) 
+    Ghc-Options: -fhpc
diff --git a/src/Compiler/Hoopl.hs b/src/Compiler/Hoopl.hs
--- a/src/Compiler/Hoopl.hs
+++ b/src/Compiler/Hoopl.hs
@@ -29,7 +29,7 @@
 import Compiler.Hoopl.Debug
 import Compiler.Hoopl.Fuel hiding (withFuel, getFuel, setFuel)
 import Compiler.Hoopl.Block
-import Compiler.Hoopl.Graph hiding (splice, gSplice)
+import Compiler.Hoopl.Graph hiding (splice)
 import Compiler.Hoopl.Label hiding (uniqueToLbl, lblToUnique)
 import Compiler.Hoopl.MkGraph
 import Compiler.Hoopl.Pointed
diff --git a/src/Compiler/Hoopl/Fuel.hs b/src/Compiler/Hoopl/Fuel.hs
--- a/src/Compiler/Hoopl/Fuel.hs
+++ b/src/Compiler/Hoopl/Fuel.hs
@@ -21,9 +21,14 @@
 import Compiler.Hoopl.Checkpoint
 import Compiler.Hoopl.Unique
 
+#if CABAL
 #if !MIN_VERSION_base(4,8,0)
 import Control.Applicative (Applicative(..))
 #endif
+#else
+import Control.Applicative (Applicative(..))
+#endif
+
 import Control.Monad (ap,liftM)
 
 class Monad m => FuelMonad m where
diff --git a/src/Compiler/Hoopl/Graph.hs b/src/Compiler/Hoopl/Graph.hs
--- a/src/Compiler/Hoopl/Graph.hs
+++ b/src/Compiler/Hoopl/Graph.hs
@@ -46,7 +46,11 @@
 import Compiler.Hoopl.Block
 import Compiler.Hoopl.Label
 
+#if CABAL
 #if !MIN_VERSION_base(4,8,0)
+import Control.Applicative (Applicative(..))
+#endif
+#else
 import Control.Applicative (Applicative(..))
 #endif
 import Control.Monad (ap,liftM,liftM2)
diff --git a/src/Compiler/Hoopl/Show.hs b/src/Compiler/Hoopl/Show.hs
--- a/src/Compiler/Hoopl/Show.hs
+++ b/src/Compiler/Hoopl/Show.hs
@@ -4,7 +4,7 @@
 #endif
 
 module Compiler.Hoopl.Show 
-  ( showGraph, showFactBase
+  ( showGraph, showFactBase, Showing
   )
 where
 
diff --git a/src/Compiler/Hoopl/Unique.hs b/src/Compiler/Hoopl/Unique.hs
--- a/src/Compiler/Hoopl/Unique.hs
+++ b/src/Compiler/Hoopl/Unique.hs
@@ -24,9 +24,14 @@
 import qualified Data.IntMap as M
 import qualified Data.IntSet as S
 
+#ifdef CABAL
 #if !MIN_VERSION_base(4,8,0)
 import Control.Applicative
 #endif
+#else
+import Control.Applicative
+#endif
+
 import Control.Monad (ap,liftM)
 
 -----------------------------------------------------------------------------
diff --git a/testing/Main.hs b/testing/Main.hs
new file mode 100644
--- /dev/null
+++ b/testing/Main.hs
@@ -0,0 +1,40 @@
+module Main (main) where
+
+import qualified System.FilePath as FilePath
+
+import qualified Test.Framework as Framework
+import qualified Test.Framework.Providers.HUnit as HUnit
+
+import qualified Test
+
+main :: IO ()
+main = Framework.defaultMain tests
+
+tests :: [Framework.Test]
+tests = [goldensTests]
+
+-- | All the tests that depend on reading an input file with a simple program,
+-- parsing and optimizing it and then comparing with an expected output.
+goldensTests :: Framework.Test
+goldensTests = Framework.testGroup "Goldens tests"
+    [ HUnit.testCase inputFile $ compareWithExpected inputFile expectedFile
+    | (inputFile, expectedFile) <- zip inputFiles expectedFiles ]
+  where
+    compareWithExpected = Test.optTest
+    inputFiles = [ basePath FilePath.</> test | test <- testFileNames ]
+    expectedFiles = [ basePath FilePath.</> test FilePath.<.> "expected"
+                    | test <- testFileNames ]
+    basePath = "testing" FilePath.</> "tests"
+    testFileNames =
+        [ "test1"
+        , "test2"
+        , "test3"
+        , "test4"
+        , "test5"
+        , "test6"
+        , "test7"
+        , "if-test"
+        , "if-test2"
+        , "if-test3"
+        , "if-test4"
+        ]
