This repository has been archived by the owner on Aug 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 631
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CO-354] Add golden/RT SafeCopy tests for Address and Address'
In order to ensure we have backwards compatibility with the old Address and Address' SafeCopy binary formats, we add some decode-only tests, which exercise the "migration" part of our new `SafeCopy AddrAttributes` instance. We also add golden tests which ensure the new CBOR format is maintained going forwards. We also add roundtrip testing for Address' (which exercises the new CBOR code). There was already a roundtrip test for Address, so we leave that.
- Loading branch information
Showing
25 changed files
with
272 additions
and
8 deletions.
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
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,123 @@ | ||
module Test.Pos.Types.Golden.SafeCopy where | ||
|
||
import Universum | ||
|
||
import Hedgehog (Property) | ||
import qualified Hedgehog as H | ||
|
||
import Pos.SafeCopy () | ||
|
||
import Test.Pos.Core.ExampleHelpers (exampleAddress, exampleAddress', exampleAddress'1, | ||
exampleAddress'2, exampleAddress'3, exampleAddress'4, | ||
exampleAddress'5, exampleAddress'6, exampleAddress'7, | ||
exampleAddress1, exampleAddress2, exampleAddress3, | ||
exampleAddress4, exampleAddress5, exampleAddress6, | ||
exampleAddress7) | ||
import Test.Pos.Util.Golden (discoverGolden, goldenTestSafeCopy, goldenTestSafeCopyDec) | ||
|
||
-------------------------------------------------------------------------------- | ||
-- Address | ||
-------------------------------------------------------------------------------- | ||
|
||
golden_Address0 :: Property | ||
golden_Address0 = | ||
goldenTestSafeCopyDec | ||
exampleAddress | ||
"test/golden/safecopy/Address0" | ||
|
||
golden_Address1 :: Property | ||
golden_Address1 = | ||
goldenTestSafeCopyDec | ||
exampleAddress1 | ||
"test/golden/safecopy/Address1" | ||
|
||
golden_Address2 :: Property | ||
golden_Address2 = | ||
goldenTestSafeCopyDec | ||
exampleAddress2 | ||
"test/golden/safecopy/Address2" | ||
|
||
golden_Address3 :: Property | ||
golden_Address3 = | ||
goldenTestSafeCopyDec | ||
exampleAddress3 | ||
"test/golden/safecopy/Address3" | ||
|
||
golden_Address4 :: Property | ||
golden_Address4 = | ||
goldenTestSafeCopyDec | ||
exampleAddress4 | ||
"test/golden/safecopy/Address4" | ||
|
||
golden_Address5 :: Property | ||
golden_Address5 = | ||
goldenTestSafeCopy | ||
exampleAddress5 | ||
"test/golden/safecopy/Address5" | ||
|
||
golden_Address6 :: Property | ||
golden_Address6 = | ||
goldenTestSafeCopy | ||
exampleAddress6 | ||
"test/golden/safecopy/Address6" | ||
|
||
golden_Address7 :: Property | ||
golden_Address7 = | ||
goldenTestSafeCopy | ||
exampleAddress7 | ||
"test/golden/safecopy/Address7" | ||
|
||
-------------------------------------------------------------------------------- | ||
-- Address' | ||
-------------------------------------------------------------------------------- | ||
|
||
golden_Address'0 :: Property | ||
golden_Address'0 = | ||
goldenTestSafeCopyDec | ||
exampleAddress' | ||
"test/golden/safecopy/Address'0" | ||
|
||
golden_Address'1 :: Property | ||
golden_Address'1 = | ||
goldenTestSafeCopyDec | ||
exampleAddress'1 | ||
"test/golden/safecopy/Address'1" | ||
|
||
golden_Address'2 :: Property | ||
golden_Address'2 = | ||
goldenTestSafeCopyDec | ||
exampleAddress'2 | ||
"test/golden/safecopy/Address'2" | ||
|
||
golden_Address'3 :: Property | ||
golden_Address'3 = | ||
goldenTestSafeCopyDec | ||
exampleAddress'3 | ||
"test/golden/safecopy/Address'3" | ||
|
||
golden_Address'4 :: Property | ||
golden_Address'4 = | ||
goldenTestSafeCopyDec | ||
exampleAddress'4 | ||
"test/golden/safecopy/Address'4" | ||
|
||
golden_Address'5 :: Property | ||
golden_Address'5 = | ||
goldenTestSafeCopy | ||
exampleAddress'5 | ||
"test/golden/safecopy/Address'5" | ||
|
||
golden_Address'6 :: Property | ||
golden_Address'6 = | ||
goldenTestSafeCopy | ||
exampleAddress'6 | ||
"test/golden/safecopy/Address'6" | ||
|
||
golden_Address'7 :: Property | ||
golden_Address'7 = | ||
goldenTestSafeCopy | ||
exampleAddress'7 | ||
"test/golden/safecopy/Address'7" | ||
|
||
tests :: IO Bool | ||
tests = H.checkSequential $$discoverGolden |
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Oops, something went wrong.