Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Commit

Permalink
[CDEC-437] Move Arbitrary instances from wallet to wallet-test
Browse files Browse the repository at this point in the history
  • Loading branch information
intricate committed Jul 19, 2018
1 parent e22d4c1 commit c322da8
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 14 deletions.
36 changes: 35 additions & 1 deletion pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18134,6 +18134,7 @@ license = stdenv.lib.licenses.mit;
, cardano-sl-update
, cardano-sl-util
, cardano-sl-util-test
, cardano-sl-wallet-test
, containers
, cpphs
, cryptonite
Expand Down Expand Up @@ -18207,7 +18208,6 @@ cardano-sl
cardano-sl-block
cardano-sl-client
cardano-sl-core
cardano-sl-core-test
cardano-sl-crypto
cardano-sl-db
cardano-sl-delegation
Expand Down Expand Up @@ -18291,6 +18291,7 @@ cardano-sl-txp
cardano-sl-update
cardano-sl-util
cardano-sl-util-test
cardano-sl-wallet-test
containers
data-default
deepseq
Expand Down Expand Up @@ -18352,6 +18353,7 @@ license = stdenv.lib.licenses.mit;
, cardano-sl-util
, cardano-sl-util-test
, cardano-sl-wallet
, cardano-sl-wallet-test
, cassava
, conduit
, connection
Expand Down Expand Up @@ -18460,6 +18462,7 @@ cardano-sl-txp
cardano-sl-update
cardano-sl-util
cardano-sl-wallet
cardano-sl-wallet-test
conduit
connection
containers
Expand Down Expand Up @@ -18635,6 +18638,37 @@ homepage = "https://github.com/input-output-hk/cardano-sl/#readme";
description = "The Wallet Backend for a Cardano node";
license = stdenv.lib.licenses.mit;

}) {};
"cardano-sl-wallet-test" = callPackage
({
mkDerivation
, base
, bytestring
, cardano-sl-core-test
, cardano-sl-wallet
, QuickCheck
, serokell-util
, stdenv
, universum
}:
mkDerivation {

pname = "cardano-sl-wallet-test";
version = "1.3.0";
src = ./../wallet/test;
libraryHaskellDepends = [
base
bytestring
cardano-sl-core-test
cardano-sl-wallet
QuickCheck
serokell-util
universum
];
doHaddock = false;
description = "Cardano SL - wallet (Arbitrary instances)";
license = stdenv.lib.licenses.mit;

}) {};
"carray" = callPackage
({
Expand Down
1 change: 1 addition & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ packages:
- node
- tools
- wallet
- wallet/test
- wallet-new # The new (unreleased) version of the wallet
- node-ipc
- acid-state-exts
Expand Down
1 change: 1 addition & 0 deletions wallet-new/cardano-sl-wallet-new.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ library
, cardano-sl-update
, cardano-sl-util
, cardano-sl-wallet
, cardano-sl-wallet-test
, conduit
, connection
, containers
Expand Down
12 changes: 6 additions & 6 deletions wallet-new/src/Cardano/Wallet/API/V1/Swagger/Example.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ module Cardano.Wallet.API.V1.Swagger.Example where

import Universum

import Test.QuickCheck (Arbitrary (..), Gen, listOf1, oneof)

import Cardano.Wallet.API.Response
import Cardano.Wallet.API.V1.Types
import Cardano.Wallet.Orphans.Arbitrary ()
import Data.Default (Default (def))
import qualified Data.Map.Strict as Map
import Node (NodeId (..))
import Pos.Arbitrary.Wallet.Web.ClientTypes ()
import Test.QuickCheck (Arbitrary (..), Gen, listOf1, oneof)

import Pos.Client.Txp.Util (InputSelectionPolicy (..))
import qualified Pos.Core.Common as Core
import qualified Pos.Crypto.Signing as Core
import Pos.Util.Mnemonic (Mnemonic)
import Pos.Wallet.Web.ClientTypes (CUpdateInfo)
import Pos.Wallet.Web.Methods.Misc (WalletStateSnapshot (..))

import qualified Data.Map.Strict as Map
import qualified Pos.Core.Common as Core
import qualified Pos.Crypto.Signing as Core
import Test.Pos.Wallet.Arbitrary.Web.ClientTypes ()


class Arbitrary a => Example a where
Expand Down
9 changes: 5 additions & 4 deletions wallet/cardano-sl-wallet.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ Flag for-installer

library
hs-source-dirs: src test
exposed-modules: Pos.Arbitrary.Wallet.Web.ClientTypes
Pos.Wallet
exposed-modules: Pos.Wallet
Pos.Wallet.Redirect
Pos.Wallet.WalletMode

Expand Down Expand Up @@ -120,7 +119,6 @@ library
, cardano-sl-block
, cardano-sl-client
, cardano-sl-core
, cardano-sl-core-test
, cardano-sl-crypto
, cardano-sl-delegation
, cardano-sl-generator
Expand Down Expand Up @@ -165,7 +163,6 @@ library
, stm
, swagger2
, text
, text
, formatting
, time
, time-units
Expand Down Expand Up @@ -221,6 +218,9 @@ test-suite cardano-wallet-test
-- Standard module with some magic
Spec

-- Arbitrary Instances
Test.Pos.Wallet.Arbitrary.Web.ClientTypes

-- Basic QC checks
Test.Pos.Util.MnemonicSpec

Expand Down Expand Up @@ -265,6 +265,7 @@ test-suite cardano-wallet-test
, cardano-sl-util
, cardano-sl-util-test
, cardano-sl-wallet
, cardano-sl-wallet-test
, containers
, data-default
, deepseq
Expand Down
20 changes: 20 additions & 0 deletions wallet/test/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2018 IOHK

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 2 additions & 0 deletions wallet/test/Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{-# OPTIONS_GHC -fno-warn-orphans #-}

{-# LANGUAGE RecordWildCards #-}

-- | Arbitrary instances for client types

module Pos.Arbitrary.Wallet.Web.ClientTypes
module Test.Pos.Wallet.Arbitrary.Web.ClientTypes
(
) where

Expand Down
3 changes: 1 addition & 2 deletions wallet/test/Test/Pos/Wallet/Web/Tracking/SyncSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ import Test.QuickCheck (Arbitrary (..), Property, choose, oneof,
sublistOf, suchThat, vectorOf, (===))
import Test.QuickCheck.Monadic (pick)

import Pos.Arbitrary.Wallet.Web.ClientTypes ()
import Pos.Block.Logic (rollbackBlocks)
import Pos.Core (Address, BlockCount (..), blkSecurityParam)
import Pos.Core.Chrono (nonEmptyOldestFirst, toNewestFirst)
import Pos.Crypto (emptyPassphrase)
import Pos.Launcher (HasConfigurations)

import qualified Pos.Wallet.Web.State as WS
import Pos.Wallet.Web.State.Storage (WalletStorage (..))
import Pos.Wallet.Web.Tracking.Decrypt (eskToWalletDecrCredentials)
Expand All @@ -43,6 +41,7 @@ import Test.Pos.Block.Logic.Util (EnableTxPayload (..),
import Test.Pos.Configuration (withDefConfigurations)
import Test.Pos.Crypto.Dummy (dummyProtocolMagic)
import Test.Pos.Util.QuickCheck.Property (assertProperty)
import Test.Pos.Wallet.Arbitrary.Web.ClientTypes ()
import Test.Pos.Wallet.Web.Mode (walletPropertySpec)
import Test.Pos.Wallet.Web.Util (importSomeWallets, wpGenBlocks)

Expand Down
29 changes: 29 additions & 0 deletions wallet/test/cardano-sl-wallet-test.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: cardano-sl-wallet-test
version: 1.3.0
synopsis: Cardano SL - wallet (Arbitrary instances)
description: QuickCheck Arbitrary instances for the Cardano SL wallet
functionality.
license: MIT
license-file: LICENSE
author: IOHK
maintainer: IOHK <support@iohk.io>
copyright: 2018 IOHK
category: Currency
build-type: Simple
cabal-version: >=1.10

library
exposed-modules: Test.Pos.Wallet.Arbitrary.Web.ClientTypes

build-depends: QuickCheck
, base
, bytestring
, cardano-sl-core-test
, cardano-sl-wallet
, serokell-util >= 0.1.3.4
, universum

default-language: Haskell2010

ghc-options: -Wall
-O2

0 comments on commit c322da8

Please sign in to comment.