leancheck-instances 0.0.3 → 0.0.4
raw patch · 18 files changed
+457/−178 lines, 18 filesdep ~leancheckPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: leancheck
API changes (from Hackage documentation)
Files
- .gitignore +1/−0
- .travis.yml +19/−10
- Makefile +6/−2
- bench/tiers.hs +2/−0
- changelog.md +7/−0
- leancheck-instances.cabal +16/−7
- mk/depend.mk +14/−9
- mk/ghcdeps +1/−1
- mk/haddock-i +20/−8
- mk/haskell.mk +24/−6
- mk/install-on +30/−0
- src/Test/LeanCheck/Instances/Time.hs +7/−16
- stack-lts-11.yaml +0/−12
- stack.yaml +3/−7
- test/diff/tiers-Day.out +184/−0
- test/diff/tiers-DiffTime.out +39/−0
- test/diff/tiers-UTCTime.out +54/−77
- test/sdist +30/−23
.gitignore view
@@ -3,6 +3,7 @@ .stack-work idx/ dist/+dist-newstyle/ log/ *.swp *.swo
.travis.yml view
@@ -1,6 +1,6 @@ # .travis.yml file for leancheck-instances #-# Copyright: (c) 2017-2018 Rudy Matela+# Copyright: (c) 2017-2020 Rudy Matela # License: 3-Clause BSD (see the file LICENSE) # Maintainer: Rudy Matela <rudy@matela.com.br> @@ -23,6 +23,8 @@ - ghc --version - cabal --version - haddock --version+- du -hd3 ~/.cabal ~/.ghc || true+- du -hd4 ~/.stack || true - rm -f ~/.cabal/config && cabal update # Download and unpack the stack executable # "Once Travis whitelists the stack.dev files," simply include stack in the@@ -32,36 +34,42 @@ - travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' - stack config set system-ghc --global true - stack --version-- cabal install leancheck bytestring nats text+- cabal install leancheck bytestring nats text || cabal install leancheck bytestring nats text --lib script: - make && make test - make haddock - make test-sdist - cabal test --ghc-option=-O0-- stack $STACKR --no-terminal --skip-ghc-check test --ghc-options=-O0+- stack --resolver $STACKVER --no-terminal --skip-ghc-check test --ghc-options=-O0 matrix: allow_failures: - ghc: 'head' include: - ghc: 'head'- env: GHCVER=head CABALVER=head+ env: GHCVER=head CABALVER=head STACKVER=nightly-2020-03-28 addons: {apt: {packages: [ghc-head, cabal-install-head], sources: hvr-ghc}}+ - ghc: '8.10'+ env: GHCVER=8.10.1 CABALVER=3.2 STACKVER=nightly-2020-03-28+ addons: {apt: {packages: [ghc-8.10.1, cabal-install-3.2], sources: hvr-ghc}}+ - ghc: '8.8'+ env: GHCVER=8.8.3 CABALVER=3.0 STACKVER=lts-15.5+ addons: {apt: {packages: [ghc-8.8.3, cabal-install-3.0], sources: hvr-ghc}} - ghc: '8.6'- env: GHCVER=8.6.1 CABALVER=2.4- addons: {apt: {packages: [ghc-8.6.1, cabal-install-2.4], sources: hvr-ghc}}+ env: GHCVER=8.6.5 CABALVER=2.4 STACKVER=lts-14.27+ addons: {apt: {packages: [ghc-8.6.5, cabal-install-2.4], sources: hvr-ghc}} - ghc: '8.4'- env: GHCVER=8.4.4 CABALVER=2.2+ env: GHCVER=8.4.4 CABALVER=2.2 STACKVER=lts-12.26 addons: {apt: {packages: [ghc-8.4.4, cabal-install-2.2], sources: hvr-ghc}} - ghc: '8.2'- env: GHCVER=8.2.2 CABALVER=2.0+ env: GHCVER=8.2.2 CABALVER=2.0 STACKVER=lts-11.22 addons: {apt: {packages: [ghc-8.2.2, cabal-install-2.0], sources: hvr-ghc}} - ghc: '8.0'- env: GHCVER=8.0.2 CABALVER=1.24+ env: GHCVER=8.0.2 CABALVER=1.24 STACKVER=lts-9.21 addons: {apt: {packages: [ghc-8.0.2, cabal-install-1.24], sources: hvr-ghc}} - ghc: '7.10'- env: GHCVER=7.10.3 CABALVER=1.22 STACK_YAML=stack-lts-11.yaml+ env: GHCVER=7.10.3 CABALVER=1.22 STACKVER=lts-6.35 addons: {apt: {packages: [ghc-7.10.3, cabal-install-1.22], sources: hvr-ghc}} # we only support stack with GHC >= 7.10 - ghc: '7.8'@@ -73,6 +81,7 @@ - cabal --version - haddock --version - rm -f ~/.cabal/config && cabal update+ - cabal install Cabal==1.18.* - cabal install leancheck bytestring nats text script: - make && make test
Makefile view
@@ -99,7 +99,9 @@ ./bench/tiers "Seq Bool" | diff -rud test/diff/tiers-SeqBool.out - ./bench/tiers "IntMap Int" | diff -rud test/diff/tiers-IntMapInt.out - ./bench/tiers "IntSet" | diff -rud test/diff/tiers-IntSet.out -- ./bench/tiers "UTCTime" | diff -rud test/diff/tiers-UTCTime.out -+ ./bench/tiers "UTCTime" 6 | diff -rud test/diff/tiers-UTCTime.out -+ ./bench/tiers "Day" 9 | diff -rud test/diff/tiers-Day.out -+ ./bench/tiers "DiffTime" | diff -rud test/diff/tiers-DiffTime.out - ./bench/tiers "Array Int Int" | diff -rud test/diff/tiers-ArrayIntInt.out - update-diff-test-tiers: bench/tiers@@ -114,5 +116,7 @@ ./bench/tiers "Seq Bool" > test/diff/tiers-SeqBool.out ./bench/tiers "IntMap Int" > test/diff/tiers-IntMapInt.out ./bench/tiers "IntSet" > test/diff/tiers-IntSet.out- ./bench/tiers "UTCTime" > test/diff/tiers-UTCTime.out+ ./bench/tiers "UTCTime" 6 > test/diff/tiers-UTCTime.out+ ./bench/tiers "Day" 9 > test/diff/tiers-Day.out+ ./bench/tiers "DiffTime" > test/diff/tiers-DiffTime.out ./bench/tiers "Array Int Int" > test/diff/tiers-ArrayIntInt.out
bench/tiers.hs view
@@ -112,6 +112,8 @@ "IntMap Int" -> put t n (u :: IntMap Int ) "IntSet" -> put t n (u :: IntSet ) -- time+ "Day" -> put t n (u :: Day )+ "DiffTime" -> put t n (u :: DiffTime ) "UTCTime" -> put t n (u :: UTCTime ) -- unhandled _ -> putStrLn $ "unknown/unhandled type `" ++ t ++ "'"
changelog.md view
@@ -1,6 +1,13 @@ Changelog for leancheck-instances ================================= +v0.0.4+------++* minor improvement on Listable UTCTime+* improve tests++ v0.0.3 ------
leancheck-instances.cabal view
@@ -1,6 +1,6 @@ -- Cabal file for leancheck-instances name: leancheck-instances-version: 0.0.3+version: 0.0.4 synopsis: Common LeanCheck instances description: Listable instances for types provided by the Haskell Platform.@@ -31,13 +31,19 @@ , mk/ghcdeps , mk/haddock-i , mk/haskell.mk+ , mk/install-on , stack.yaml- , stack-lts-11.yaml , test/diff/*.out , test/diff/eg/*.out , test/sdist-tested-with: GHC==8.6, GHC==8.4, GHC==8.2, GHC==8.0- , GHC==7.10, GHC==7.8+tested-with: GHC==8.10+ , GHC==8.8+ , GHC==8.6+ , GHC==8.4+ , GHC==8.2+ , GHC==8.0+ , GHC==7.10+ , GHC==7.8 source-repository head@@ -47,7 +53,7 @@ source-repository this type: git location: https://github.com/rudymatela/leancheck-instances- tag: v0.0.3+ tag: v0.0.4 library exposed-modules: Test.LeanCheck.Instances@@ -60,7 +66,7 @@ , Test.LeanCheck.WithInstances hs-source-dirs: src build-depends: base >= 4 && < 5- , leancheck >= 0.7.7+ , leancheck >= 0.9.2 , bytestring , containers , nats@@ -82,7 +88,10 @@ , text default-language: Haskell2010 -test-suite text+-- This test suite cannot be named simply "text".+-- Otherwise, "cabal v2-install" somehow confuses+-- the test suite with the "text" package.+test-suite text- type: exitcode-stdio-1.0 main-is: text.hs hs-source-dirs: test
mk/depend.mk view
@@ -8,6 +8,7 @@ src/Test/LeanCheck/Instances/Natural.hs \ src/Test/LeanCheck/Instances/Containers.hs \ src/Test/LeanCheck/Instances/ByteString.hs \+ src/Test/LeanCheck/Instances/Array.hs \ bench/tiers.hs eg/test-text: \ eg/test-text.hs \@@ -19,6 +20,7 @@ src/Test/LeanCheck/Instances/Natural.hs \ src/Test/LeanCheck/Instances/Containers.hs \ src/Test/LeanCheck/Instances/ByteString.hs \+ src/Test/LeanCheck/Instances/Array.hs \ eg/test-text.hs mk/All.o: \ src/Test/LeanCheck/Instances/Time.hs \@@ -27,6 +29,7 @@ src/Test/LeanCheck/Instances/Natural.hs \ src/Test/LeanCheck/Instances/Containers.hs \ src/Test/LeanCheck/Instances/ByteString.hs \+ src/Test/LeanCheck/Instances/Array.hs \ mk/All.hs mk/Toplibs.o: \ src/Test/LeanCheck/Instances/Time.hs \@@ -35,12 +38,10 @@ src/Test/LeanCheck/Instances/Natural.hs \ src/Test/LeanCheck/Instances/Containers.hs \ src/Test/LeanCheck/Instances/ByteString.hs \+ src/Test/LeanCheck/Instances/Array.hs \ mk/Toplibs.hs-Setup.o: \- Setup.hs-Setup: \- Setup.hs \- mk/toplibs+src/Test/LeanCheck/Instances/Array.o: \+ src/Test/LeanCheck/Instances/Array.hs src/Test/LeanCheck/Instances/ByteString.o: \ src/Test/LeanCheck/Instances/ByteString.hs src/Test/LeanCheck/Instances/Containers.o: \@@ -55,7 +56,8 @@ src/Test/LeanCheck/Instances.hs \ src/Test/LeanCheck/Instances/Natural.hs \ src/Test/LeanCheck/Instances/Containers.hs \- src/Test/LeanCheck/Instances/ByteString.hs+ src/Test/LeanCheck/Instances/ByteString.hs \+ src/Test/LeanCheck/Instances/Array.hs src/Test/LeanCheck/Instances/Text.o: \ src/Test/LeanCheck/Instances/Text.hs src/Test/LeanCheck/Instances/Time.o: \@@ -67,7 +69,8 @@ src/Test/LeanCheck/Instances.hs \ src/Test/LeanCheck/Instances/Natural.hs \ src/Test/LeanCheck/Instances/Containers.hs \- src/Test/LeanCheck/Instances/ByteString.hs+ src/Test/LeanCheck/Instances/ByteString.hs \+ src/Test/LeanCheck/Instances/Array.hs test/main.o: \ test/main.hs \ src/Test/LeanCheck/Instances/Time.hs \@@ -75,7 +78,8 @@ src/Test/LeanCheck/Instances.hs \ src/Test/LeanCheck/Instances/Natural.hs \ src/Test/LeanCheck/Instances/Containers.hs \- src/Test/LeanCheck/Instances/ByteString.hs+ src/Test/LeanCheck/Instances/ByteString.hs \+ src/Test/LeanCheck/Instances/Array.hs test/main: \ test/main.hs \ mk/toplibs@@ -86,7 +90,8 @@ src/Test/LeanCheck/Instances.hs \ src/Test/LeanCheck/Instances/Natural.hs \ src/Test/LeanCheck/Instances/Containers.hs \- src/Test/LeanCheck/Instances/ByteString.hs+ src/Test/LeanCheck/Instances/ByteString.hs \+ src/Test/LeanCheck/Instances/Array.hs test/text: \ test/text.hs \ mk/toplibs
mk/ghcdeps view
@@ -2,7 +2,7 @@ # # ghcdeps: generate Haskell make dependencies for compiling with GHC. #-# Copyright (c) 2015-2018 Rudy Matela.+# Copyright (c) 2015-2020 Rudy Matela. # Distributed under the 3-Clause BSD licence. # # From a list of files provided on standard input,
mk/haddock-i view
@@ -2,7 +2,7 @@ # # haddock-i: list haddock's -i parameters. #-# Copyright (c) 2015-2018 Rudy Matela.+# Copyright (c) 2015-2020 Rudy Matela. # Distributed under the 3-Clause BSD licence. # # $ haddock-i <package1> <package2> ... <packageN>@@ -11,14 +11,26 @@ # documentation installed on your system, so you can: # # $ haddock-i base template-haskell | xargs haddock <files>-errxit() {+err() { echo "$@" > /dev/stderr+}++errxit() {+ err "$@" exit 1 } -for pkg in "$@"; do- ghc-pkg field $pkg haddock-html,haddock-interfaces ||- errxit "error: haddock-i: cannot find package $pkg (ghc-pkg)"-done |-sed "s/.*: //" |-sed "N;s/\n/,/;s/^/-i/"+iface-for() {+ ghc-pkg field $1 haddock-interfaces | sort -rV | head -1 | sed "s/.*: //"+}++html-for() {+ ghc-pkg field $1 haddock-html | sort -rV | head -1 | sed "s/.*: //"+}++for pkg in "$@"+do+ iface=$(iface-for $pkg)+ html=$(html-for $pkg)+ [ -d "$html" -a -f "$iface" ] && echo "-i$html,$iface" || err "haddock-i: warning: could not find interface file for $pkg"+done
mk/haskell.mk view
@@ -1,6 +1,6 @@ # Implicit rules for compiling Haskell code. #-# Copyright (c) 2015-2018 Rudy Matela.+# Copyright (c) 2015-2020 Rudy Matela. # Distributed under the 3-Clause BSD licence. # # You can optionally configure the "Configuration variables" below in your main@@ -20,6 +20,7 @@ GHCFLAGS ?= GHC ?= ghc GHCCMD = $(GHC) -i$(GHCIMPORTDIRS) $(GHCFLAGS)+HADDOCK ?= haddock # Hugs Parameters HUGSIMPORTDIRS ?= "/usr/lib/hugs/packages/*"@@ -38,18 +39,24 @@ # ALL_HSS: all Haskell files # You can override ALL/LIB_HSS in your main Makefile LIST_LIB_HSS ?= find src -name "*.hs"-LIST_ALL_HSS ?= find \( -path "./dist" -o -path "./.stack-work" \) -prune \+LIST_ALL_HSS ?= find \( -path "./dist*" -o -path "./.stack-work" -o -path "./Setup.hs" \) -prune \ -o -name "*.*hs" -print LIB_HSS ?= $(shell $(LIST_LIB_HSS)) ALL_HSS ?= $(shell $(LIST_ALL_HSS)) +LIB_DEPS ?= base+ALL_DEPS ?= $(LIB_DEPS)+ PKGNAME = $(shell cat *.cabal | grep "^name:" | sed -e "s/name: *//")-HADDOCK_VERSION = $(shell haddock --version | grep version | sed -e 's/.*version //;s/,.*//')+HADDOCK_VERSION = $(shell $(HADDOCK) --version | grep version | sed -e 's/.*version //;s/,.*//') HADDOCK_MAJOR = $(shell echo $(HADDOCK_VERSION) | sed -e 's/\..*//') HADDOCK_MINOR = $(shell echo $(HADDOCK_VERSION) | sed -e 's/[0-9]*\.\([0-9]*\).[0-9]*/\1/') HADDOCK_PKG_NAME = $(shell [ $(HADDOCK_MAJOR) -gt 2 ] \ || [ $(HADDOCK_MAJOR) -eq 2 -a $(HADDOCK_MINOR) -ge 20 ] \ && echo "--package-name=$(PKGNAME)")+HADDOCK_HLNK_SRC = $(shell [ $(HADDOCK_MAJOR) -gt 2 ] \+ || [ $(HADDOCK_MAJOR) -eq 2 -a $(HADDOCK_MINOR) -ge 17 ] \+ && echo "--hyperlinked-source") # Implicit rules@@ -90,7 +97,7 @@ haddock: doc/index.html clean-haddock:- rm -f doc/*.{html,css,js,png,gif,json} README.html+ rm -f doc/*.{html,css,js,png,gif,json} doc/src/* README.html upload-haddock: @echo "use \`cabal upload -d' instead"@@ -99,9 +106,14 @@ @echo "(on Arch Linux, use: cabal haddock --for-hackage --haddock-options=--optghc=-dynamic)" doc/index.html: $(LIB_HSS)- ./mk/haddock-i base template-haskell | xargs \- haddock --html -odoc $(LIB_HSS) $(HADDOCKFLAGS) --title=$(PKGNAME) $(HADDOCK_PKG_NAME)+ ./mk/haddock-i $(LIB_DEPS) | xargs \+ $(HADDOCK) --html -odoc $(LIB_HSS) \+ --title=$(PKGNAME) \+ $(HADDOCK_PKG_NAME) \+ $(HADDOCK_HLNK_SRC) \+ $(HADDOCKFLAGS) + # lists all Haskell source files list-all-hss: @find $(ALL_HSS)@@ -109,6 +121,12 @@ # lists library Haskell source files list-lib-hss: @find $(LIB_HSS)++bootstrap-haskell-mk:+ @[ -d "$(DEST)" ] || (echo -e "error: no destination found\nusage: \`make bootstrap-haskell-mk DEST=path/to/prj'"; exit 1)+ mkdir -p mk+ cp mk/{haskell.mk,ghcdeps,haddock-i} $(DEST)/mk+ touch $(DEST)/mk/depend.mk show-pkgname: @echo $(PKGNAME)
+ mk/install-on view
@@ -0,0 +1,30 @@+#!/bin/bash+#+# mk/install-on: install or updates the mk folder on a Haskell project+#+# usage: ./mk/install-on path/to/project+#+# This assumes a few things:+#+# * tests are stored in a "test/" folder+# * sources are stored in a "src/" folder+set -e++errxit() {+ echo "$@" > /dev/stderr+ exit 1+}++src=`dirname $0`/..+dst="$1"++[ -n "$dst" ] || errxit "destination folder not provided"++mkdir -p $dst/mk+mkdir -p $dst/test++cp $src/mk/ghcdeps $dst/mk/ghcdeps+cp $src/mk/haddock-i $dst/mk/haddock-i+cp $src/mk/haskell.mk $dst/mk/haskell.mk+cp $src/mk/install-on $dst/mk/install-on+cp $src/test/sdist $dst/test/sdist
src/Test/LeanCheck/Instances/Time.hs view
@@ -11,21 +11,7 @@ import Data.Time import Test.LeanCheck---- This could be made more efficient.--- Nevertheless, it is probably efficient enough for millions of tests.-binarySearchIndexes :: (Num a, Integral a) => a -> a -> [a]-binarySearchIndexes min max- | min > max = []- | max == min = [max]- | otherwise = let mid = (max - min) `div` 2 + min in- mid : (binarySearchIndexes (mid + 1) max +| binarySearchIndexes min (mid - 1))--binarySearchIndexesThen :: (Num a, Integral a) => a -> a -> [a]-binarySearchIndexesThen min max = binarySearchIndexes min max ++ ([(min-1),(min-2)..] +| [(max+1)..])--secondsInADay :: Num a => a-secondsInADay = 24*60*60-1+import Test.LeanCheck.Tiers -- | This listable enumeration starts with January 2019 then switches back and -- forth between past and future.@@ -44,7 +30,12 @@ -- > , ... -- > ] instance Listable Day where- list = map ModifiedJulianDay $ binarySearchIndexesThen 0 116969+ tiers = mapMaybeT (\(y,(m,d)) -> fromGregorianValid y m d) (yearss >< (monthss >< dayss))+ where+ thisYear = 2019 -- year of release+ yearss = toTiers $ [thisYear,(thisYear-1)..] +| [(thisYear+1)..]+ monthss = toTiers $ [1..12]+ dayss = toTiers $ [1..31] instance Listable DiffTime where tiers = mapT (\(x,y) -> fromInteger x / fromInteger y) . reset
− stack-lts-11.yaml
@@ -1,12 +0,0 @@-# stack.yaml for leancheck-instances-resolver: lts-11.22--packages:-- .--extra-deps:-- leancheck-0.8.0--flags: {}--extra-package-dbs: []
stack.yaml view
@@ -1,11 +1,7 @@-# stack file for leancheck-instances-resolver: lts-12.14+resolver: lts-15.5 # or ghc-8.8.3 packages: - . -extra-deps: []--flags: {}--extra-package-dbs: []+extra-deps:+- leancheck-0.9.2
+ test/diff/tiers-Day.out view
@@ -0,0 +1,184 @@+map length (tiers :: [[ Day ]]) = [1,3,6,10,15,21,28,36,45,...]++length (list :: [ Day ]) = Infinity++allUnique (list :: [ Day ]) = True++ratioRepetitions (list :: [ Day ]) = 0 % 1++tiers :: [Day] =+ [ [2019-01-01]+ , [ 2019-01-02+ , 2019-02-01+ , 2020-01-01+ ]+ , [ 2019-01-03+ , 2019-02-02+ , 2019-03-01+ , 2020-01-02+ , 2020-02-01+ , 2018-01-01+ ]+ , [ 2019-01-04+ , 2019-02-03+ , 2019-03-02+ , 2019-04-01+ , 2020-01-03+ , 2020-02-02+ , 2020-03-01+ , 2018-01-02+ , 2018-02-01+ , 2021-01-01+ ]+ , [ 2019-01-05+ , 2019-02-04+ , 2019-03-03+ , 2019-04-02+ , 2019-05-01+ , 2020-01-04+ , 2020-02-03+ , 2020-03-02+ , 2020-04-01+ , 2018-01-03+ , 2018-02-02+ , 2018-03-01+ , 2021-01-02+ , 2021-02-01+ , 2017-01-01+ ]+ , [ 2019-01-06+ , 2019-02-05+ , 2019-03-04+ , 2019-04-03+ , 2019-05-02+ , 2019-06-01+ , 2020-01-05+ , 2020-02-04+ , 2020-03-03+ , 2020-04-02+ , 2020-05-01+ , 2018-01-04+ , 2018-02-03+ , 2018-03-02+ , 2018-04-01+ , 2021-01-03+ , 2021-02-02+ , 2021-03-01+ , 2017-01-02+ , 2017-02-01+ , 2022-01-01+ ]+ , [ 2019-01-07+ , 2019-02-06+ , 2019-03-05+ , 2019-04-04+ , 2019-05-03+ , 2019-06-02+ , 2019-07-01+ , 2020-01-06+ , 2020-02-05+ , 2020-03-04+ , 2020-04-03+ , 2020-05-02+ , 2020-06-01+ , 2018-01-05+ , 2018-02-04+ , 2018-03-03+ , 2018-04-02+ , 2018-05-01+ , 2021-01-04+ , 2021-02-03+ , 2021-03-02+ , 2021-04-01+ , 2017-01-03+ , 2017-02-02+ , 2017-03-01+ , 2022-01-02+ , 2022-02-01+ , 2016-01-01+ ]+ , [ 2019-01-08+ , 2019-02-07+ , 2019-03-06+ , 2019-04-05+ , 2019-05-04+ , 2019-06-03+ , 2019-07-02+ , 2019-08-01+ , 2020-01-07+ , 2020-02-06+ , 2020-03-05+ , 2020-04-04+ , 2020-05-03+ , 2020-06-02+ , 2020-07-01+ , 2018-01-06+ , 2018-02-05+ , 2018-03-04+ , 2018-04-03+ , 2018-05-02+ , 2018-06-01+ , 2021-01-05+ , 2021-02-04+ , 2021-03-03+ , 2021-04-02+ , 2021-05-01+ , 2017-01-04+ , 2017-02-03+ , 2017-03-02+ , 2017-04-01+ , 2022-01-03+ , 2022-02-02+ , 2022-03-01+ , 2016-01-02+ , 2016-02-01+ , 2023-01-01+ ]+ , [ 2019-01-09+ , 2019-02-08+ , 2019-03-07+ , 2019-04-06+ , 2019-05-05+ , 2019-06-04+ , 2019-07-03+ , 2019-08-02+ , 2019-09-01+ , 2020-01-08+ , 2020-02-07+ , 2020-03-06+ , 2020-04-05+ , 2020-05-04+ , 2020-06-03+ , 2020-07-02+ , 2020-08-01+ , 2018-01-07+ , 2018-02-06+ , 2018-03-05+ , 2018-04-04+ , 2018-05-03+ , 2018-06-02+ , 2018-07-01+ , 2021-01-06+ , 2021-02-05+ , 2021-03-04+ , 2021-04-03+ , 2021-05-02+ , 2021-06-01+ , 2017-01-05+ , 2017-02-04+ , 2017-03-03+ , 2017-04-02+ , 2017-05-01+ , 2022-01-04+ , 2022-02-03+ , 2022-03-02+ , 2022-04-01+ , 2016-01-03+ , 2016-02-02+ , 2016-03-01+ , 2023-01-02+ , 2023-02-01+ , 2015-01-01+ ]+ , ...+ ]
+ test/diff/tiers-DiffTime.out view
@@ -0,0 +1,39 @@+map length (tiers :: [[ DiffTime ]]) = [1,0,2,0,2,0,4,0,2,0,6,0,...]++length (list :: [ DiffTime ]) = Infinity++allUnique (list :: [ DiffTime ]) = True++ratioRepetitions (list :: [ DiffTime ]) = 0 % 1++tiers :: [DiffTime] =+ [ [1s]+ , []+ , [ 0.5s+ , 2s+ ]+ , []+ , [ 0.333333333333s+ , 3s+ ]+ , []+ , [ 0.25s+ , 0.666666666666s+ , 1.5s+ , 4s+ ]+ , []+ , [ 0.2s+ , 5s+ ]+ , []+ , [ 0.166666666666s+ , 0.4s+ , 0.75s+ , 1.333333333333s+ , 2.5s+ , 6s+ ]+ , []+ , ...+ ]
test/diff/tiers-UTCTime.out view
@@ -1,4 +1,4 @@-map length (tiers :: [[ UTCTime ]]) = [0,1,1,3,3,5,5,9,9,11,11,17,...]+map length (tiers :: [[ UTCTime ]]) = [0,1,3,8,16,29,...] length (list :: [ UTCTime ]) = Infinity @@ -9,88 +9,65 @@ tiers :: [UTCTime] = [ [] , [2019-01-01 00:00:01 UTC]- , [2099-01-24 00:00:01 UTC]+ , [ 2019-01-02 00:00:01 UTC+ , 2019-02-01 00:00:01 UTC+ , 2020-01-01 00:00:01 UTC+ ] , [ 2019-01-01 00:00:00.5 UTC , 2019-01-01 00:00:02 UTC- , 1938-12-09 00:00:01 UTC+ , 2019-01-03 00:00:01 UTC+ , 2019-02-02 00:00:01 UTC+ , 2019-03-01 00:00:01 UTC+ , 2020-01-02 00:00:01 UTC+ , 2020-02-01 00:00:01 UTC+ , 2018-01-01 00:00:01 UTC ]- , [ 2099-01-24 00:00:00.5 UTC- , 2099-01-24 00:00:02 UTC- , 2139-02-05 00:00:01 UTC+ , [ 2019-01-02 00:00:00.5 UTC+ , 2019-01-02 00:00:02 UTC+ , 2019-02-01 00:00:00.5 UTC+ , 2019-02-01 00:00:02 UTC+ , 2020-01-01 00:00:00.5 UTC+ , 2020-01-01 00:00:02 UTC+ , 2019-01-04 00:00:01 UTC+ , 2019-02-03 00:00:01 UTC+ , 2019-03-02 00:00:01 UTC+ , 2019-04-01 00:00:01 UTC+ , 2020-01-03 00:00:01 UTC+ , 2020-02-02 00:00:01 UTC+ , 2020-03-01 00:00:01 UTC+ , 2018-01-02 00:00:01 UTC+ , 2018-02-01 00:00:01 UTC+ , 2021-01-01 00:00:01 UTC ] , [ 2019-01-01 00:00:00.333333333333 UTC , 2019-01-01 00:00:03 UTC- , 1938-12-09 00:00:00.5 UTC- , 1938-12-09 00:00:02 UTC- , 1978-12-20 00:00:01 UTC- ]- , [ 2099-01-24 00:00:00.333333333333 UTC- , 2099-01-24 00:00:03 UTC- , 2139-02-05 00:00:00.5 UTC- , 2139-02-05 00:00:02 UTC- , 2059-01-12 00:00:01 UTC- ]- , [ 2019-01-01 00:00:00.25 UTC- , 2019-01-01 00:00:00.666666666666 UTC- , 2019-01-01 00:00:01.5 UTC- , 2019-01-01 00:00:04 UTC- , 1938-12-09 00:00:00.333333333333 UTC- , 1938-12-09 00:00:03 UTC- , 1978-12-20 00:00:00.5 UTC- , 1978-12-20 00:00:02 UTC- , 1898-11-27 00:00:01 UTC- ]- , [ 2099-01-24 00:00:00.25 UTC- , 2099-01-24 00:00:00.666666666666 UTC- , 2099-01-24 00:00:01.5 UTC- , 2099-01-24 00:00:04 UTC- , 2139-02-05 00:00:00.333333333333 UTC- , 2139-02-05 00:00:03 UTC- , 2059-01-12 00:00:00.5 UTC- , 2059-01-12 00:00:02 UTC- , 2159-02-11 00:00:01 UTC- ]- , [ 2019-01-01 00:00:00.2 UTC- , 2019-01-01 00:00:05 UTC- , 1938-12-09 00:00:00.25 UTC- , 1938-12-09 00:00:00.666666666666 UTC- , 1938-12-09 00:00:01.5 UTC- , 1938-12-09 00:00:04 UTC- , 1978-12-20 00:00:00.333333333333 UTC- , 1978-12-20 00:00:03 UTC- , 1898-11-27 00:00:00.5 UTC- , 1898-11-27 00:00:02 UTC- , 1998-12-26 00:00:01 UTC- ]- , [ 2099-01-24 00:00:00.2 UTC- , 2099-01-24 00:00:05 UTC- , 2139-02-05 00:00:00.25 UTC- , 2139-02-05 00:00:00.666666666666 UTC- , 2139-02-05 00:00:01.5 UTC- , 2139-02-05 00:00:04 UTC- , 2059-01-12 00:00:00.333333333333 UTC- , 2059-01-12 00:00:03 UTC- , 2159-02-11 00:00:00.5 UTC- , 2159-02-11 00:00:02 UTC- , 2079-01-18 00:00:01 UTC- ]- , [ 2019-01-01 00:00:00.166666666666 UTC- , 2019-01-01 00:00:00.4 UTC- , 2019-01-01 00:00:00.75 UTC- , 2019-01-01 00:00:01.333333333333 UTC- , 2019-01-01 00:00:02.5 UTC- , 2019-01-01 00:00:06 UTC- , 1938-12-09 00:00:00.2 UTC- , 1938-12-09 00:00:05 UTC- , 1978-12-20 00:00:00.25 UTC- , 1978-12-20 00:00:00.666666666666 UTC- , 1978-12-20 00:00:01.5 UTC- , 1978-12-20 00:00:04 UTC- , 1898-11-27 00:00:00.333333333333 UTC- , 1898-11-27 00:00:03 UTC- , 1998-12-26 00:00:00.5 UTC- , 1998-12-26 00:00:02 UTC- , 1918-12-03 00:00:01 UTC+ , 2019-01-03 00:00:00.5 UTC+ , 2019-01-03 00:00:02 UTC+ , 2019-02-02 00:00:00.5 UTC+ , 2019-02-02 00:00:02 UTC+ , 2019-03-01 00:00:00.5 UTC+ , 2019-03-01 00:00:02 UTC+ , 2020-01-02 00:00:00.5 UTC+ , 2020-01-02 00:00:02 UTC+ , 2020-02-01 00:00:00.5 UTC+ , 2020-02-01 00:00:02 UTC+ , 2018-01-01 00:00:00.5 UTC+ , 2018-01-01 00:00:02 UTC+ , 2019-01-05 00:00:01 UTC+ , 2019-02-04 00:00:01 UTC+ , 2019-03-03 00:00:01 UTC+ , 2019-04-02 00:00:01 UTC+ , 2019-05-01 00:00:01 UTC+ , 2020-01-04 00:00:01 UTC+ , 2020-02-03 00:00:01 UTC+ , 2020-03-02 00:00:01 UTC+ , 2020-04-01 00:00:01 UTC+ , 2018-01-03 00:00:01 UTC+ , 2018-02-02 00:00:01 UTC+ , 2018-03-01 00:00:01 UTC+ , 2021-01-02 00:00:01 UTC+ , 2021-02-01 00:00:01 UTC+ , 2017-01-01 00:00:01 UTC ] , ... ]
test/sdist view
@@ -2,32 +2,39 @@ # # test/sdist: tests the package generated by "cabal sdist". #-# Copyright (c) 2015-2018 Rudy Matela.+# Copyright (c) 2015-2020 Rudy Matela. # Distributed under the 3-Clause BSD licence.++set -xe+ export LC_ALL=C # consistent sort+ pkgver=` cat *.cabal | grep "^version:" | sed -e "s/version: *//"` pkgname=`cat *.cabal | grep "^name:" | sed -e "s/name: *//"`-pkg=$pkgname-$pkgver-set -x-cabal sdist &&-cd dist &&-tar -tf $pkg.tar.gz | sort --ignore-case > ls-cabal-i &&-tar -tf $pkg.tar.gz | sort --ignore-case --unique > ls-cabal-iu &&-diff -rud ls-cabal-i ls-cabal-iu &&-rm -f ls-cabal ls-cabal-ignore-case &&-if [ -d ../.git ]+pkgbase=$pkgname-$pkgver++cabal sdist++# Try to find the package generated by cabal.+pkg=`find dist* -name $pkgbase.tar.gz`+[ -f "$pkg" ]+# If the script fails here, either:+# * no package was generated+# * there are packages in both dist and dist-newstyle folders.++tmp=`mktemp -d /tmp/test-sdist-XXXXXXXXXX`++# Test if our file is compatible with case-insensitive filesystems.+tar -tf $pkg | sort --ignore-case > $tmp/ls-cabal-i+tar -tf $pkg | sort --ignore-case --unique > $tmp/ls-cabal-iu+diff -rud $tmp/ls-cabal-i $tmp/ls-cabal-iu++if [ -d .git ] then- # on git repo, test if files are the same- git -C .. ls-files | sort > ls-git &&- tar -tf $pkg.tar.gz | grep -v "/$" | sed -e "s,$pkg/,," | sort > ls-cabal &&- diff -rud ls-git ls-cabal &&- rm -f ls-git ls-cabal-else- # outside of git repo, test build- rm -rf $pkg/ &&- tar -xzf $pkg.tar.gz &&- cd $pkg/ &&- cabal configure --enable-tests --enable-benchmarks &&- cabal build &&- cabal test+ # Test if files included by cabal are the same as files tracked in git.+ git ls-files | sort > $tmp/ls-git+ tar -tf $pkg | grep -v "/$" | sed -e "s,$pkgbase/,," | sort > $tmp/ls-cabal+ diff -rud $tmp/ls-git $tmp/ls-cabal fi++rm -r $tmp