-----------
-- Hspec --
-----------

headerTest =  ["{-# LANGUAGE ScopedTypeVariables #-}"
              ,"{-# LANGUAGE FlexibleContexts    #-}"
              ,"{-# LANGUAGE CPP                 #-}"
              ,"module Main where"
              ,""
              ,""
              ,"-- Tested module."
              ,"import TestCases"
              ,""
              ,"-- Test libraries"
              ,"import Test.Hspec"
              ,"import Test.QuickCheck hiding (getSize)"
              ,""
              ,"-- Helpers"
              ,"import Foreign.Marshal.Array"
              ,"import Foreign.Storable"
              ,""
              ,""
              ,"same_alignment a = getAlignment a `shouldReturn` alignment a"
              ,"same_size a = getSize a `shouldReturn` sizeOf a"
              ,"same_offsets a = do"
              ,"    let offsets = goffsets a"
              ,"    ptr <- mallocArray $ length offsets"
              ,"    pokeArray ptr offsets"
              ,"    checkOffsets a ptr `shouldReturn` True"
              ,""
              ,"same_fields a = do"
              ,"    ptr1 <- newStorable a"
              ,"    ptr2 <- new a"
              ,"    checkFields ptr1 ptr2 `shouldReturn` True"
              ]
headerTest =  ["{-# LANGUAGE ScopedTypeVariables #-}"
              ,"{-# LANGUAGE FlexibleContexts    #-}"
              ,"{-# LANGUAGE CPP                 #-}"
              ,"module Main where"
              ,""
              ,""
              ,"-- Tested module."
              ,"import TestCases"
              ,""
              ,"-- Test libraries"
              ,"import Test.Hspec"
              ,"import Test.QuickCheck hiding (getSize)"
              ,""
              ,"-- Helpers"
              ,"import Foreign.Marshal.Array"
              ,"import Foreign.Storable"
              ,""
              ,""
              ,"same_alignment a = getAlignment a `shouldReturn` alignment a"
              ,"same_size a = getSize a `shouldReturn` sizeOf a"
              ,"same_offsets a = do"
              ,"    let offsets = goffsets a"
              ,"    ptr <- mallocArray $ length offsets"
              ,"    pokeArray ptr offsets"
              ,"    checkOffsets a ptr `shouldReturn` True"
              ,""
              ,"same_fields a = do"
              ,"    ptr1 <- newStorable a"
              ,"    ptr2 <- new a"
              ,"    checkFields ptr1 ptr2 `shouldReturn` True"
              ]
headerTest =  ["{-# LANGUAGE ScopedTypeVariables #-}"
              ,"{-# LANGUAGE FlexibleContexts    #-}"
              ,"{-# LANGUAGE CPP                 #-}"
              ,"module Main where"
              ,""
              ,""
              ,"-- Tested module."
              ,"import TestCases"
              ,""
              ,"-- Test libraries"
              ,"import Test.Hspec"
              ,"import Test.QuickCheck hiding (getSize)"
              ,""
              ,"-- Helpers"
              ,"import Foreign.Marshal.Array"
              ,"import Foreign.Storable"
              ,""
              ,""
              ,"same_alignment a = getAlignment a `shouldReturn` alignment a"
              ,"same_size a = getSize a `shouldReturn` sizeOf a"
              ,"same_offsets a = do"
              ,"    let offsets = goffsets a"
              ,"    ptr <- mallocArray $ length offsets"
              ,"    pokeArray ptr offsets"
              ,"    checkOffsets a ptr `shouldReturn` True"
              ,""
              ,"same_fields a = do"
              ,"    ptr1 <- newStorable a"
              ,"    ptr2 <- new a"
              ,"    checkFields ptr1 ptr2 `shouldReturn` True"
              ]