From fc8bd265b36408d9bf1db140f3ea7e4fc32ebafa Mon Sep 17 00:00:00 2001 From: paolino Date: Tue, 14 Mar 2023 11:52:54 +0000 Subject: [PATCH] Add tests for TxOut serialization. --- lib/wallet/cardano-wallet.cabal | 1 + .../DB/Store/DeltaUTxO/TxOutBinarySpec.hs | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 lib/wallet/test/unit/Cardano/Wallet/DB/Store/DeltaUTxO/TxOutBinarySpec.hs diff --git a/lib/wallet/cardano-wallet.cabal b/lib/wallet/cardano-wallet.cabal index 55f17d40437..347c69b1458 100644 --- a/lib/wallet/cardano-wallet.cabal +++ b/lib/wallet/cardano-wallet.cabal @@ -857,6 +857,7 @@ test-suite unit Cardano.Wallet.DB.Sqlite.TypesSpec Cardano.Wallet.DB.StateMachine Cardano.Wallet.DB.Store.DeltaUTxO.ModelSpec + Cardano.Wallet.DB.Store.DeltaUTxO.TxOutBinarySpec Cardano.Wallet.DB.Store.Meta.ModelSpec Cardano.Wallet.DB.Store.Meta.StoreSpec Cardano.Wallet.DB.Store.Submissions.StoreSpec diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/DeltaUTxO/TxOutBinarySpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/DeltaUTxO/TxOutBinarySpec.hs new file mode 100644 index 00000000000..5b8729171e5 --- /dev/null +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/DeltaUTxO/TxOutBinarySpec.hs @@ -0,0 +1,23 @@ +{-# LANGUAGE ScopedTypeVariables #-} +module Cardano.Wallet.DB.Store.DeltaUTxO.TxOutBinarySpec + ( spec + ) +where + +import Prelude + +import Cardano.Wallet.DB.Arbitrary + () +import Cardano.Wallet.DB.Store.DeltaUTxO.TxOutBinary + ( deserializeTxOut, serializeTxOut ) +import Test.Hspec + ( Spec, describe, it ) +import Test.QuickCheck + ( Testable (property), (===) ) + +spec :: Spec +spec = do + describe "TxOutBinary" $ do + it "can serialize and deserialize TxOut" $ + property $ \txOut -> + deserializeTxOut (serializeTxOut txOut) === Right txOut