packages feed

yaya-unsafe-test 0.1.1.2 → 0.2.0.2

raw patch · 3 files changed

+259/−65 lines, 3 filesdep ~basedep ~yayadep ~yaya-hedgehog

Dependency ranges changed: base, yaya, yaya-hedgehog, yaya-unsafe

Files

test/Test/Fold.hs view
@@ -1,38 +1,73 @@ {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE Unsafe #-}+{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} -module Test.Fold where+module Test.Fold (tests) where -import           Data.Proxy-import           Hedgehog-import qualified Hedgehog.Gen as Gen+import safe "base" Control.Category (Category (id))+import safe "base" Control.Monad ((=<<))+import safe "base" Data.Bool (Bool)+import safe "base" Data.Function (($))+import safe "base" Data.Int (Int)+import safe "base" Data.Proxy (Proxy (Proxy))+import safe "base" System.IO (IO)+import safe "hedgehog" Hedgehog+  ( Property,+    checkParallel,+    discover,+    forAll,+    property,+  )+import safe qualified "hedgehog" Hedgehog.Gen as Gen+import safe "yaya" Yaya.Fold (Mu, Nu)+import safe "yaya" Yaya.Fold.Common (size)+import safe "yaya" Yaya.Fold.Native (Cofix, Fix)+import safe "yaya-hedgehog" Yaya.Hedgehog.Expr+  ( Expr,+    genCofixExpr,+    genExpr,+    genFixExpr,+    genMuExpr,+    genNuExpr,+  )+import safe "yaya-hedgehog" Yaya.Hedgehog.Fold+  ( corecursiveIsUnsafe,+    law_anaRefl,+    law_cataCancel,+    law_cataCompose,+    law_cataRefl,+    recursiveIsUnsafe,+  )+import safe qualified "yaya-unsafe" Yaya.Unsafe.Fold.Instances () -import           Yaya.Fold-import           Yaya.Fold.Common-import           Yaya.Fold.Native-import           Yaya.Hedgehog.Expr-import           Yaya.Hedgehog.Fold-import qualified Yaya.Unsafe.Fold.Instances ()+-- TODO: For some reason HLint is complaining that TemplateHaskell is unused.+{-# HLINT ignore "Unused LANGUAGE pragma" #-} --- | NB: Only in yaya-unsafe instead of yaya because the `Eq (Fix f)` instance---       is needed. prop_fixAnaRefl :: Property prop_fixAnaRefl =   property $ law_anaRefl =<< forAll (Gen.sized genFixExpr) -prop_fixCataCancel :: Property-prop_fixCataCancel =-  property $ law_cataCancel size =<< forAll (genExpr (Gen.sized genFixExpr))+-- | NB: Only in yaya-unsafe instead of yaya because the `Eq (Cofix f)` instance+--       is needed.+prop_cofixAnaRefl :: Property+prop_cofixAnaRefl =+  property $ law_anaRefl =<< forAll (Gen.sized genCofixExpr) -prop_fixCataRefl :: Property-prop_fixCataRefl =-  property $ law_cataRefl =<< forAll (Gen.sized genFixExpr)+prop_cofixCataCancel :: Property+prop_cofixCataCancel =+  property $ law_cataCancel size =<< forAll (genExpr (Gen.sized genCofixExpr)) -prop_fixCataCompose :: Property-prop_fixCataCompose =-  property-  $ law_cataCompose (Proxy :: Proxy (Fix Expr)) size id-    =<< forAll (Gen.sized genFixExpr)+prop_cofixCataRefl :: Property+prop_cofixCataRefl =+  property $ law_cataRefl =<< forAll (Gen.sized genCofixExpr) +prop_cofixCataCompose :: Property+prop_cofixCataCompose =+  property $+    law_cataCompose (Proxy :: Proxy (Fix Expr)) size id+      =<< forAll (Gen.sized genCofixExpr)+ -- | NB: Only in yaya-unsafe instead of yaya because the `Eq (Nu f)` instance is --       needed. prop_nuAnaRefl :: Property@@ -49,9 +84,28 @@  prop_nuCataCompose :: Property prop_nuCataCompose =-  property-  $ law_cataCompose (Proxy :: Proxy (Nu Expr)) size id-    =<< forAll (Gen.sized genNuExpr)+  property $+    law_cataCompose (Proxy :: Proxy (Nu Expr)) size id+      =<< forAll (Gen.sized genNuExpr) +prop_muAnaRefl :: Property+prop_muAnaRefl =+  property $ law_anaRefl =<< forAll (Gen.sized genMuExpr)++-- * These tests try to verify non-termination behavior.++prop_muIsntCorecursive :: Property+prop_muIsntCorecursive = corecursiveIsUnsafe (Proxy :: Proxy Mu) (1 :: Int)++prop_nuIsntRecursive :: Property+prop_nuIsntRecursive = recursiveIsUnsafe (Proxy :: Proxy Nu) (1 :: Int)++-- TODO: Figure out why this hangs during compilation.+-- prop_fixIsntCorecursive :: Property+-- prop_fixIsntCorecursive = corecursiveIsUnsafe (Proxy :: Proxy Fix) (1 :: Int)++prop_cofixIsntRecursive :: Property+prop_cofixIsntRecursive = recursiveIsUnsafe (Proxy :: Proxy Cofix) (1 :: Int)+ tests :: IO Bool-tests = checkParallel $$(discover)+tests = checkParallel $$discover
test/test.hs view
@@ -1,15 +1,8 @@-import           Control.Monad-import           System.Exit (exitFailure)-import           System.IO (BufferMode(..), hSetBuffering, stdout, stderr)+{-# LANGUAGE Unsafe #-} -import qualified Test.Fold as Fold+import safe "base" System.IO (IO)+import safe "hedgehog" Hedgehog.Main (defaultMain)+import qualified "this" Test.Fold as Fold  main :: IO ()-main = do-  hSetBuffering stdout LineBuffering-  hSetBuffering stderr LineBuffering--  results <- sequence [ Fold.tests-                      ]--  unless (and results) exitFailure+main = defaultMain [Fold.tests]
yaya-unsafe-test.cabal view
@@ -1,30 +1,177 @@-name:                yaya-unsafe-test-version:             0.1.1.2-synopsis:            Test suites for `yaya-unsafe`.-description:         This package should not be depended on by anything.-homepage:            https://github.com/sellout/yaya#readme-author:              Greg Pfeil-maintainer:          greg@technomadic.org-copyright:           2017 Greg Pfeil-license:             AGPL-3-license-file:        LICENSE-category:            Recursion-build-type:          Simple-cabal-version:       >=1.10+cabal-version:  3.0 -test-suite yaya-unsafe-test-  type:                exitcode-stdio-1.0-  hs-source-dirs:      test-  main-is:             test.hs-  other-modules:       Test.Fold-  build-depends:       base >= 4.7 && < 5-                     , hedgehog-                     , yaya >= 0.1.0-                     , yaya-hedgehog >= 0.1.2-                     , yaya-unsafe >= 0.1.0-  ghc-options:         -threaded -rtsopts -with-rtsopts=-N -Wall-  default-language:    Haskell2010+name:        yaya-unsafe-test+version:     0.2.0.2+synopsis:    Test suites for `yaya-unsafe`.+description: This package should not be depended on by anything.+author:      Greg Pfeil <greg@technomadic.org>+maintainer:  Greg Pfeil <greg@technomadic.org>+copyright:   2017 Greg Pfeil+homepage:    https://github.com/sellout/yaya#readme+bug-reports: https://github.com/sellout/yaya/issues+category:    Recursion+build-type:  Simple+license:     AGPL-3.0-or-later+license-files:+  LICENSE+tested-with:+  GHC == {+--  GHCup   Nixpkgs+    8.6.1,+    8.8.1,  8.8.4,+    8.10.1,+    9.0.1,+    9.2.1,+    9.4.1,  9.4.8,+    9.6.1,+            9.8.1+  }  source-repository head-  type:     git+  type: git   location: https://github.com/sellout/yaya++-- This mimics the GHC2021 extension+-- (https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/control.html?highlight=doandifthenelse#extension-GHC2021),+-- but supporting compilers back to GHC 7.10. If the oldest supported compiler+-- is GHC 9.2, then this stanza can be removed and `import: GHC2021` can be+-- replaced by `default-language: GHC2021`.+common GHC2021+  default-language: Haskell2010+  default-extensions:+    BangPatterns+    BinaryLiterals+    ConstraintKinds+    DeriveDataTypeable+    DeriveGeneric+    -- DeriveLift -- uncomment if the oldest supported version is GHC 8.10.1++    DeriveTraversable+    DerivingStrategies+    DoAndIfThenElse+    EmptyCase+    ExistentialQuantification+    FlexibleContexts+    FlexibleInstances+    GADTSyntax+    GeneralizedNewtypeDeriving+    HexFloatLiterals+    -- ImportQualifiedPost -- uncomment if the oldest supported version is GHC 8.10.1++    InstanceSigs+    LambdaCase+    MagicHash+    MonadComprehensions+    MonomorphismRestriction+    MultiParamTypeClasses+    NamedFieldPuns+    NamedWildCards+    NumericUnderscores+    PolyKinds+    PostfixOperators+    RankNTypes+    ScopedTypeVariables+    StandaloneDeriving+    -- StandaloneKindSignatures -- uncomment if the oldest supported version is GHC 8.10.1++    TupleSections+    TypeApplications+    TypeOperators+    UnicodeSyntax+    NoExplicitNamespaces++common defaults+  import: GHC2021+  build-depends:+    base ^>= {4.12.0, 4.13.0, 4.14.0, 4.15.0, 4.16.0, 4.17.0, 4.18.0, 4.19.0},+  ghc-options:+    -Weverything+    -- Type inference good.+    -Wno-missing-local-signatures+    -- Warns even when `Unsafe` is explicit, not inferred. See+    -- https://gitlab.haskell.org/ghc/ghc/-/issues/16689+    -Wno-unsafe+    -- TODO: prune these warnings+    -Wno-all-missed-specialisations+    -fpackage-trust+    -trust base+  if impl(ghc < 8.8.1)+    ghc-options:+      -- This used to warn even when `Safe` was explicit.+      -Wno-safe+  if impl(ghc >= 8.10.1)+    ghc-options:+      -- If we didn’t allow inferred-safe imports, nothing would be `Safe`.+      -Wno-inferred-safe-imports+      -- We support GHC versions without qualified-post.+      -Wno-prepositive-qualified-module+      -- `-trust` triggers this warning when applied to transitive dependencies.+      -Wno-unused-packages+  if impl(ghc >= 9.2.1)+    ghc-options:+      -- We support GHC versions without kind signatures.+      -Wno-missing-kind-signatures+  if impl(ghc >= 9.8.1)+    ghc-options:+      -- We support GHC versions without kind signatures.+      -Wno-missing-poly-kind-signatures+      -- Inference good.+      -Wno-missing-role-annotations+  default-extensions:+    DefaultSignatures+    ExplicitNamespaces+    FunctionalDependencies+    LiberalTypeSynonyms+    -- replace with `LexicalNegation` if the oldest supported version is GHC 9.0.1++    NegativeLiterals+    PackageImports+    ParallelListComp+    -- QualifiedDo - uncomment if the oldest supported version is GHC 9.0.1++    RecursiveDo+    -- RequiredTypeArguments - uncomment if the oldest supported version is GHC 9.10.1++    RoleAnnotations+    StrictData+    TemplateHaskellQuotes+    TransformListComp+    NoGeneralizedNewtypeDeriving+    NoImplicitPrelude+    NoMonomorphismRestriction+    NoPatternGuards+    NoTypeApplications++test-suite yaya-unsafe-test+  import: defaults+  type: exitcode-stdio-1.0+  hs-source-dirs:+    test+  main-is: test.hs+  other-modules:+    Test.Fold+  build-depends:+    hedgehog,+    yaya >= 0.5.0,+    yaya-hedgehog >= 0.2.1,+    yaya-unsafe >= 0.3.0,+  ghc-options:+    -- NB: Need `-fno-omit-yields` so that `timeout` can interrupt native+    --     recursion in non-termination tests.+    -fno-omit-yields+    -rtsopts+    -threaded+    -trust adjunctions+    -trust array+    -trust base-orphans+    -trust binary+    -trust bytestring+    -trust containers+    -trust distributive+    -trust exceptions+    -trust ghc-prim+    -trust lens+    -trust profunctors+    -trust semigroupoids+    -trust stm+    -trust template-haskell+    -trust text+    -trust transformers-compat+    -with-rtsopts=-N+  if impl(ghc < 9.6)+    ghc-options:+      -trust foldable1-classes-compat