Skip to content

Conditional endorsement series triple test failing #195

Open
@deeglaze

Description

@deeglaze
   example_test.go:636: error unmarshalling field "Triples": error unmarshalling field "CondEndorseSeries": error at index 0: error at index 0: cbor: cannot unmarshal array into Go struct field comid.Measurement.2 of type comid.ICryptoKeyValue

The comid/example_test.go test with many cases is written strangely to ignore problems. With the following patch to fail with failure and indicate the individual test case, we see the above error message.

diff --git a/comid/example_test.go b/comid/example_test.go
index 30e050e..371d39e 100644
--- a/comid/example_test.go
+++ b/comid/example_test.go
@@ -590,7 +590,7 @@ var (
        testComidCondEndorseSeries []byte
 )
 
-func TestExample_decode_CBOR(_ *testing.T) {
+func TestExample_decode_CBOR(t *testing.T) {
        tvs := []struct {
                descr string
                inp   []byte
@@ -629,13 +629,12 @@ func TestExample_decode_CBOR(_ *testing.T) {
                },
        }
        for _, tv := range tvs {
-               comid := Comid{}
-               err := comid.FromCBOR(tv.inp)
-               if err != nil {
-                       fmt.Printf("FAIL: %v", err)
-               } else {
-                       fmt.Println("OK")
-               }
-               // Output: OK
+               t.Run(tv.descr, func(t *testing.T) {
+                       comid := Comid{}
+                       err := comid.FromCBOR(tv.inp)
+                       if err != nil {
+                               t.Fatal(err)
+                       }
+               })
        }
 }

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions