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

Commit 512445b

Browse files
authored
Merge pull request #3120 from input-output-hk/mhuesch/CDEC-364
CDEC-364 | Create golden & roundtrip tests for all datatypes in `cardano-sl-core` with Bi instances
2 parents 17950a2 + 1686f62 commit 512445b

File tree

129 files changed

+6856
-285
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+6856
-285
lines changed

core/cardano-sl-core.cabal

+12-1
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,12 @@ test-suite test
264264
other-modules:
265265
Spec
266266
Test.Pos.Core.AddressSpec
267+
Test.Pos.Core.Bi
267268
Test.Pos.Core.CborSpec
268269
Test.Pos.Core.Chrono
269270
Test.Pos.Core.ChronoSpec
270271
Test.Pos.Core.CoinSpec
272+
Test.Pos.Core.Gen
271273
Test.Pos.Core.LimitsSpec
272274
Test.Pos.Core.SeedSpec
273275
Test.Pos.Core.SlottingSpec
@@ -276,7 +278,9 @@ test-suite test
276278
Test.Pos.Core.Arbitrary.Unsafe
277279

278280
build-depends: base
281+
, base16-bytestring
279282
, bytestring
283+
, cardano-crypto
280284
, cardano-sl-binary
281285
, cardano-sl-binary-test
282286
, cardano-sl-core
@@ -285,9 +289,13 @@ test-suite test
285289
, cardano-sl-util
286290
, cardano-sl-util-test
287291
, containers
292+
, cryptonite
288293
, formatting
289294
, generic-arbitrary
295+
, hedgehog
290296
, hspec
297+
, hedgehog
298+
, pvss
291299
, QuickCheck
292300
, quickcheck-instances
293301
, random
@@ -296,11 +304,14 @@ test-suite test
296304
, time-units
297305
, universum >= 0.1.11
298306
, unordered-containers
307+
, vector
299308

300-
ghc-options: -threaded
309+
ghc-options:
310+
-threaded
301311
-rtsopts
302312
-Wall
303313

314+
304315
-- linker speed up for linux
305316
if os(linux)
306317
ghc-options: -optl-fuse-ld=gold

core/test/Test/Pos/Core/Bi.hs

+1,735
Large diffs are not rendered by default.

core/test/Test/Pos/Core/Gen.hs

+315-250
Large diffs are not rendered by default.

core/test/cardano-sl-core-test.cabal

+9-2
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,26 @@ cabal-version: >=1.10
1414

1515
library
1616
exposed-modules:
17+
Test.Pos.Core.Bi
1718
Test.Pos.Core.Chrono
1819
Test.Pos.Core.Gen
1920
Test.Pos.Core.Arbitrary
2021
Test.Pos.Core.Arbitrary.Unsafe
2122

2223
build-depends: QuickCheck
2324
, base
25+
, base16-bytestring
2426
, bytestring
27+
, cardano-crypto
2528
, cardano-sl-binary
29+
, cardano-sl-binary-test
2630
, cardano-sl-core
2731
, cardano-sl-crypto
2832
, cardano-sl-crypto-test
2933
, cardano-sl-util
3034
, cardano-sl-util-test
3135
, containers
36+
, cardano-sl-util-test
3237
, cryptonite
3338
, cryptonite-openssl >= 0.5
3439
, data-default
@@ -42,6 +47,7 @@ library
4247
, random
4348
, serokell-util
4449
, tagged
50+
, text
4551
, time-units
4652
, universum
4753
, unordered-containers
@@ -77,5 +83,6 @@ library
7783
MonadFailDesugaring
7884
GADTs
7985

80-
ghc-options: -Wall
81-
-O2
86+
ghc-options:
87+
-O2
88+
-Wall
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
00: 820058404b6d7977346c445345355334
2+
10: 6653483665744e6f756958657a437945
3+
20: 6a4b63337447346a61306b466a4f3871
4+
30: 7a616932365a4d5055454a6645793135
5+
40: 6f78356b
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
00: 82025820538960a916726b09f05c9d4d
2+
10: 4a922b85b4e11acfcc1434673d95019b
3+
20: 7a9a52d2
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
00: 8201821902595820346c445345355334
2+
10: 6653483665744e6f756958657a437945
3+
20: 6a4b63337447346a
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
00: 8218f7d818582077346c445345355334
2+
10: 6653483665744e6f756958657a437945
3+
20: 6a4b6333744734
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
00: 8200581c5125b558daa14b5338e904cc
2+
10: 2a75a8b7b3a4738de9cb28a6819576db
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
00: a3581c4577144e4954c6ba257ff8b51d
2+
10: 5f6d9f3cf44a16084dbeb1413394b51b
3+
20: 0001c6bf52634000581c5125b558daa1
4+
30: 4b5338e904cc2a75a8b7b3a4738de9cb
5+
40: 28a6819576db1b000110d9316ec00058
6+
50: 1cbd3c9fb63a795fde3a199468e83f5f
7+
60: 51d20f19d082f2458dbb703aad1b0000
8+
70: b5e620f48000

core/test/golden/AddrType_PK

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
00

core/test/golden/AddrType_R

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
02

core/test/golden/AddrType_S

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
01

core/test/golden/AddrType_U

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1839

core/test/golden/Address

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
00: 82d818584683581cabeaaa8f95c4529b
2+
10: b494e648c2e8e3522713f466a9dec1f1
3+
20: decea1b7a101582258207447346a6130
4+
30: 6b466a4f38717a616932365a4d505545
5+
40: 4a66457931356f78356b001a03f38741

core/test/golden/ApplicationName

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
66476f6c64656e

core/test/golden/Attributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a0

core/test/golden/BlockBodyAttributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a0

core/test/golden/BlockCount

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1903e7
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a0

core/test/golden/BlockHeaderMain

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
000: 85005820125bbf1daefc2897d8db4899
2+
010: 9d09b4eae439f0dfed83bc43246ca039
3+
020: fa4b121384830158205e46ceb20538af
4+
030: eeb45cb8f7030512af34b4ff363a8c7e
5+
040: 94d441a257500ffab75820e32c9549bc
6+
050: 3acbe0e848b2d7ad26331b7d84975803
7+
060: 64cb2bc6c8bda9aa0975b88302582036
8+
070: e799e376b8a5bc0127b933dcef926c56
9+
080: d30f00b1d717c498b6f23d4f2c4e5558
10+
090: 209fbbb2f0eff7472fe19e462fd88c49
11+
0a0: 5ac90f9ad58c4dd6cb204515710b0fe1
12+
0b0: 325820b5f2d3cb5a94d3e7dc9d812ebf
13+
0c0: 56003e4f9fb02296034f5d5bcd073811
14+
0d0: ebe6b35820a9d2e0af73f175d0eab5d9
15+
0e0: 6c8b480edfa8226f4c2a9037d637f6aa
16+
0f0: 3cd9f3b57584820b182f5840644c586b
17+
100: 756573565a394a6648676a726374734c
18+
110: 4674324e766f76586e6368734f765830
19+
120: 3559364c6f686c544e74356d6b504668
20+
130: 556f587531455a534a5449798119270f
21+
140: 82005840c15b8d60075f29a8d15a2525
22+
150: 96f622a4b590402be5eb8b66f3acbc55
23+
160: c9d4bb6db32987df80f22954de7a5bb8
24+
170: c4974299bec72b68b24719b1d6db0d62
25+
180: d3628b0984830101018266476f6c6465
26+
190: 6e1863a058204ba92aa320c60acc9ad7
27+
1a0: b9a64f2eda55c4d2ec28e604faf18670
28+
1b0: 8b4f0c4e8edf

core/test/golden/BlockHeader_Genesis

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
00: 820085005820f7077d40c94a36e7df95
2+
10: b6f99a86f08bcf06ea3b24e68dd30393
3+
20: 33fa53141775582074840ea4e9e28b2f
4+
30: 906a1530270131bc5ab07106024d6f9c
5+
40: 8f4773e478c343a2820b810081a0

core/test/golden/BlockSignature

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
00: 8200584067d583469c7bb28c232d5cea
2+
10: 2d04f4d21c5d36ab25925c7e339c69f2
3+
20: 29b5c86ccaa76fa4f7641f36d0489c3e
4+
30: 691db8393b86ce1b13e19d5c12816a68
5+
40: 7daf0b0c

core/test/golden/BlockSignature_Heavy

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
000: 820282840558406269376936644c586b
2+
010: 756573565a394a6648676a726374734c
3+
020: 4674324e766f76586e6368734f765830
4+
030: 3559364c6f686c544e74356d6b504668
5+
040: 556f587531455a58404a30754b446269
6+
050: 376936644c586b756573565a394a6648
7+
060: 676a726374734c4674324e766f76586e
8+
070: 6368734f7658303559364c6f686c544e
9+
080: 74356d6b504668556f58400f1ada96b5
10+
090: cc534e2b1b98f8d19f4a429aa08141b0
11+
0a0: 0a1acd30dffaae9ef7e8ffd55692fe2f
12+
0b0: 13ecf3c791eddcb942d5554a7cb382f5
13+
0c0: ba09229846204dbdb8f20c5840729c20
14+
0d0: cb28fa68337332305a7fad5313c569d9
15+
0e0: bee5bff67c4366af7ca6ec285643b430
16+
0f0: 8f3cf8e7512d1b8ebde561add1466b10
17+
100: 30e3f1983989b3be8a10233c0a

core/test/golden/BlockSignature_Light

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
000: 82018284820718585840626937693664
2+
010: 4c586b756573565a394a6648676a7263
3+
020: 74734c4674324e766f76586e6368734f
4+
030: 7658303559364c6f686c544e74356d6b
5+
040: 504668556f587531455a58404a30754b
6+
050: 446269376936644c586b756573565a39
7+
060: 4a6648676a726374734c4674324e766f
8+
070: 76586e6368734f7658303559364c6f68
9+
080: 6c544e74356d6b504668556f5840e759
10+
090: 78870f7701b4af761b259f544a8ca6f9
11+
0a0: 36e26c931a2e0867a91037f02d00713d
12+
0b0: 2f63a4c8b69767eef9a37dce487c53c4
13+
0c0: 9bf3b5d0b2e847b66f8175ecc00e5840
14+
0d0: 729c20cb28fa68337332305a7fad5313
15+
0e0: c569d9bee5bff67c4366af7ca6ec2856
16+
0f0: 43b4308f3cf8e7512d1b8ebde561add1
17+
100: 466b1030e3f1983989b3be8a10233c0a

core/test/golden/BlockVersion

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
83010101

core/test/golden/BlockVersionData

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
00: 8e1903e71903e71903e71903e71903e7
2+
10: 1903e718631863186318631863831863
3+
20: 186318638200d81846821903e7184d18
4+
30: 63

core/test/golden/BlockVersionModifier

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
00: 8e811903e7811903e7811903e7811903
2+
10: e7811903e7811903e781186381186381
3+
20: 18638118638118638183186318631863
4+
30: 818200d81846821903e7184d811863

core/test/golden/ChainDifficulty

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8119270f

core/test/golden/Coeff

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1865

core/test/golden/Coin

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
192604

core/test/golden/CoinPortion

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1925e6

0 commit comments

Comments
 (0)