-- This "package" exists because Cabal throws a circular dependency
-- fit if asked to build the top-level package with tests enabled.

name:          bytestring-tests
version:       0.0.0.0
synopsis:      Tests for the bytestring package
description:   Tests for the bytestring package
homepage:      https://github.com/haskell/bytestring
license:       BSD3
license-file:  ../LICENSE
author:        Bryan O'Sullivan <bos@serpentine.com>
maintainer:    Bryan O'Sullivan <bos@serpentine.com>
category:      Data
build-type:    Simple
cabal-version: >=1.8


flag integer-simple
  description: Use the simple integer library instead of GMP
  default: False

-- QC properties, with GHC RULES disabled
executable prop-compiled
  main-is:          Properties.hs
  other-modules:    Rules
                    QuickCheckUtils
  hs-source-dirs:   . ..
  build-depends:    base, ghc-prim, deepseq, random, directory,
                    test-framework, test-framework-quickcheck2,
                    QuickCheck >= 2.3 && < 2.8
  c-sources:        ../cbits/fpstring.c
  include-dirs:     ../include
  cpp-options:      -DHAVE_TEST_FRAMEWORK=1
  ghc-options:      -fwarn-unused-binds
                    -fno-enable-rewrite-rules
                    -threaded -rtsopts
  extensions:       BangPatterns
                    UnliftedFFITypes,
                    MagicHash,
                    UnboxedTuples,
                    DeriveDataTypeable
                    ScopedTypeVariables
                    NamedFieldPuns

executable regressions
  main-is:          Regressions.hs
  hs-source-dirs:   . ..
  build-depends:    base, ghc-prim, deepseq, random, directory,
                    test-framework, test-framework-hunit, HUnit
  c-sources:        ../cbits/fpstring.c
  include-dirs:     ../include
  cpp-options:      -DHAVE_TEST_FRAMEWORK=1
  ghc-options:      -fwarn-unused-binds
                    -fno-enable-rewrite-rules
                    -threaded -rtsopts
  extensions:       BangPatterns
                    UnliftedFFITypes,
                    MagicHash,
                    UnboxedTuples,
                    DeriveDataTypeable
                    ScopedTypeVariables
                    NamedFieldPuns

executable test-builder
  hs-source-dirs:   . .. builder
  main-is:          TestSuite.hs
  other-modules:    Data.ByteString.Builder.Tests
                    Data.ByteString.Builder.Prim.Tests
                    Data.ByteString.Builder.Prim.TestUtils

  build-depends:    base, ghc-prim,
                    deepseq,
                    QuickCheck                 >= 2.4 && < 3,
                    byteorder                  == 1.0.*,
                    dlist                      >= 0.5 && < 0.8,
                    directory,
                    mtl                        >= 2.0 && < 2.3,
                    HUnit,
                    test-framework,
                    test-framework-hunit,
                    test-framework-quickcheck2  >= 0.3

  cpp-options:      -DHAVE_TEST_FRAMEWORK=1
  ghc-options:      -Wall -fwarn-tabs -fhpc -threaded -rtsopts

  extensions:       CPP, ForeignFunctionInterface
                    UnliftedFFITypes,
                    MagicHash,
                    UnboxedTuples,
                    DeriveDataTypeable
                    ScopedTypeVariables
                    Rank2Types
                    BangPatterns
                    NamedFieldPuns

  c-sources:        ../cbits/fpstring.c
                    ../cbits/itoa.c
  include-dirs:     ../include
  includes:         fpstring.h
  install-includes: fpstring.h

   -- flags for the decimal integer serialization code
  if impl(ghc >= 6.11)
    if !flag(integer-simple)
      cpp-options: -DINTEGER_GMP
      build-depends: integer-gmp >= 0.2

  if impl(ghc >= 6.9) && impl(ghc < 6.11)
    cpp-options: -DINTEGER_GMP
    build-depends: integer >= 0.1 && < 0.2
