-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for roundtrip textual encoding of
Port
and Network
types.
- Loading branch information
1 parent
a3ed727
commit 368116a
Showing
3 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleInstances #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
{-# OPTIONS_GHC -fno-warn-orphans #-} | ||
|
||
module Cardano.Wallet.CLI.TypesSpec (spec) where | ||
|
||
import Prelude | ||
|
||
import Cardano.Wallet.CLI.Types | ||
( Network, Port (..) ) | ||
import Data.Proxy | ||
( Proxy (..) ) | ||
import Test.Hspec | ||
( Spec, describe ) | ||
import Test.QuickCheck | ||
( Arbitrary (..) ) | ||
import Test.QuickCheck.Arbitrary.Generic | ||
( genericArbitrary, genericShrink ) | ||
import Test.Text.Roundtrip | ||
( textRoundtrip ) | ||
|
||
spec :: Spec | ||
spec = do | ||
describe "Can perform roundtrip textual encoding & decoding" $ do | ||
textRoundtrip $ Proxy @Network | ||
textRoundtrip $ Proxy @(Port "test") | ||
|
||
instance Arbitrary Network where | ||
arbitrary = genericArbitrary | ||
shrink = genericShrink | ||
|
||
instance Arbitrary (Port "test") where | ||
arbitrary = genericArbitrary | ||
shrink = genericShrink |