Skip to content

Commit

Permalink
Add hedgehog-dieharder package
Browse files Browse the repository at this point in the history
  • Loading branch information
moodmosaic committed Apr 27, 2018
1 parent 84f75ec commit aff0daa
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 6 deletions.
13 changes: 9 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,14 @@ install:
cabal new-update head.hackage -v
fi
- grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
- "printf 'packages: \"hedgehog\" \"hedgehog-example\" \"hedgehog-quickcheck\"\\n' > cabal.project"
- "printf 'packages: \"hedgehog\" \"hedgehog-dieharder\" \"hedgehog-example\" \"hedgehog-quickcheck\"\\n' > cabal.project"
- cat cabal.project
- if [ -f "hedgehog/configure.ac" ]; then
(cd "hedgehog" && autoreconf -i);
fi
- if [ -f "hedgehog-dieharder/configure.ac" ]; then
(cd "hedgehog-dieharder" && autoreconf -i);
fi
- if [ -f "hedgehog-example/configure.ac" ]; then
(cd "hedgehog-example" && autoreconf -i);
fi
Expand All @@ -100,20 +103,21 @@ install:
- rm -f cabal.project.freeze
- cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
- rm -rf "hedgehog"/.ghc.environment.* "hedgehog-example"/.ghc.environment.* "hedgehog-quickcheck"/.ghc.environment.* "hedgehog"/dist "hedgehog-example"/dist "hedgehog-quickcheck"/dist
- rm -rf "hedgehog"/.ghc.environment.* "hedgehog-dieharder"/.ghc.environment.* "hedgehog-example"/.ghc.environment.* "hedgehog-quickcheck"/.ghc.environment.* "hedgehog"/dist "hedgehog-dieharder"/dist "hedgehog-example"/dist "hedgehog-quickcheck"/dist
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)

# Here starts the actual work to be performed for the package under test;
# any command which exits with a non-zero exit code causes the build to fail.
script:
# test that source-distributions can be generated
- (cd "hedgehog" && cabal sdist)
- (cd "hedgehog-dieharder" && cabal sdist)
- (cd "hedgehog-example" && cabal sdist)
- (cd "hedgehog-quickcheck" && cabal sdist)
- mv "hedgehog"/dist/hedgehog-*.tar.gz "hedgehog-example"/dist/hedgehog-example-*.tar.gz "hedgehog-quickcheck"/dist/hedgehog-quickcheck-*.tar.gz ${DISTDIR}/
- mv "hedgehog"/dist/hedgehog-*.tar.gz "hedgehog-dieharder"/dist/hedgehog-dieharder-*.tar.gz "hedgehog-example"/dist/hedgehog-example-*.tar.gz "hedgehog-quickcheck"/dist/hedgehog-quickcheck-*.tar.gz ${DISTDIR}/
- cd ${DISTDIR} || false
- find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
- "printf 'packages: hedgehog-*/*.cabal hedgehog-example-*/*.cabal hedgehog-quickcheck-*/*.cabal\\n' > cabal.project"
- "printf 'packages: hedgehog-*/*.cabal hedgehog-dieharder-*/*.cabal hedgehog-example-*/*.cabal hedgehog-quickcheck-*/*.cabal\\n' > cabal.project"
- cat cabal.project
# this builds all libraries and executables (without tests/benchmarks)
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
Expand All @@ -127,6 +131,7 @@ script:

# cabal check
- (cd hedgehog-* && cabal check)
- (cd hedgehog-dieharder-* && cabal check)
- (cd hedgehog-example-* && cabal check)
- (cd hedgehog-quickcheck-* && cabal check)

Expand Down
1 change: 1 addition & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
packages:
hedgehog
hedgehog-dieharder
hedgehog-example
hedgehog-quickcheck

29 changes: 29 additions & 0 deletions hedgehog-dieharder/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Copyright 2018, Nikos Baxevanis
All Rights Reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of
its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49 changes: 49 additions & 0 deletions hedgehog-dieharder/hedgehog-dieharder.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
version: 0

name:
hedgehog-dieharder
author:
Nikos Baxevanis
maintainer:
Nikos Baxevanis <[email protected]>
homepage:
https://github.com/hedgehogqa/haskell-hedgehog
synopsis:
Hedgehog dieharder project.
description:
This is the hedgehog dieharder project. It contains diehard tests.
The diehard tests are a battery of statistical tests for measuring
the quality of our random number generator.
category:
Testing
license:
BSD3
license-file:
LICENSE
cabal-version:
>= 1.8
build-type:
Simple
tested-with:
GHC == 7.10.2
, GHC == 7.10.3
, GHC == 8.0.1
, GHC == 8.0.2
, GHC == 8.2.1
, GHC == 8.2.2
, GHC == 8.4.1

executable dieharder-input
main-is:
Dieharder.hs

ghc-options:
-Wall -threaded -O2

hs-source-dirs:
test

build-depends:
hedgehog
, base >= 3 && < 5
, bytestring >= 0.10.4.0 && < 0.11
15 changes: 15 additions & 0 deletions hedgehog-dieharder/test/Dieharder.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Data.ByteString.Builder (Builder)
import qualified Data.ByteString.Builder as Builder
import System.IO (stdout)

import Hedgehog.Internal.Seed (Seed)
import qualified Hedgehog.Internal.Seed as Seed

main :: IO ()
main =
Builder.hPutBuilder stdout . go =<< Seed.random
where
go :: Seed -> Builder
go s0 =
case Seed.nextWord64 s0 of
(v0, s1) -> Builder.word64LE v0 `mappend` go s1
3 changes: 1 addition & 2 deletions hedgehog/src/Hedgehog/Internal/Seed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
-- overlay (kernel) v113.33.03, and Random.fs in FsCheck v3.
--
-- Other than the choice of initial seed for 'from' this port should be
-- faithful. Currently, we have not rerun the DieHarder, or BigCrush tests on
-- this implementation.
-- faithful.
--
-- 1. Guy L. Steele, Jr., Doug Lea, Christine H. Flood
-- Fast splittable pseudorandom number generators
Expand Down

0 comments on commit aff0daa

Please sign in to comment.