@@ -29,6 +29,43 @@ func assertEqual(t *testing.T, a, b Cid) {
29
29
}
30
30
}
31
31
32
+ func TestTable (t * testing.T ) {
33
+ // test some known codecs, hard-wired here to make them a fixture that would
34
+ // need to be updated if they change elsewhere
35
+ for k , v := range map [uint64 ]string {
36
+ Raw : "raw" ,
37
+ DagProtobuf : "dag-pb" ,
38
+ DagCBOR : "dag-cbor" ,
39
+ DagJSON : "dag-json" ,
40
+ Libp2pKey : "libp2p-key" ,
41
+ GitRaw : "git-raw" ,
42
+ EthBlock : "eth-block" ,
43
+ EthBlockList : "eth-block-list" ,
44
+ EthTxTrie : "eth-tx-trie" ,
45
+ EthTx : "eth-tx" ,
46
+ EthTxReceiptTrie : "eth-tx-receipt-trie" ,
47
+ EthTxReceipt : "eth-tx-receipt" ,
48
+ EthStateTrie : "eth-state-trie" ,
49
+ EthAccountSnapshot : "eth-account-snapshot" ,
50
+ EthStorageTrie : "eth-storage-trie" ,
51
+ BitcoinBlock : "bitcoin-block" ,
52
+ BitcoinTx : "bitcoin-tx" ,
53
+ ZcashBlock : "zcash-block" ,
54
+ ZcashTx : "zcash-tx" ,
55
+ DecredBlock : "decred-block" ,
56
+ DecredTx : "decred-tx" ,
57
+ DashBlock : "dash-block" ,
58
+ DashTx : "dash-tx" ,
59
+ FilCommitmentUnsealed : "fil-commitment-unsealed" ,
60
+ FilCommitmentSealed : "fil-commitment-sealed" ,
61
+ DagJOSE : "dag-jose" ,
62
+ } {
63
+ if Codecs [v ] != k {
64
+ t .Errorf ("Table mismatch: 0x%x %s" , k , v )
65
+ }
66
+ }
67
+ }
68
+
32
69
func TestPrefixSum (t * testing.T ) {
33
70
// Test creating CIDs both manually and with Prefix.
34
71
// Tests: https://github.com/ipfs/go-cid/issues/83
0 commit comments