MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / TestEncodeDeterministic

Function TestEncodeDeterministic

internal/artifact/encode_test.go:93–107  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

91}
92
93func TestEncodeDeterministic(t *testing.T) {
94 for _, a := range []Artifact{samplePlaybook(), sampleConvention()} {
95 first, err := Encode(a)
96 if err != nil {
97 t.Fatalf("Encode 1: %v", err)
98 }
99 second, err := Encode(a)
100 if err != nil {
101 t.Fatalf("Encode 2: %v", err)
102 }
103 if !bytes.Equal(first, second) {
104 t.Errorf("Encode not deterministic for %s:\n%s\nvs\n%s", a.Kind, first, second)
105 }
106 }
107}
108
109func TestEncodeUnknownKind(t *testing.T) {
110 _, err := Encode(Artifact{Kind: "nonsense"})

Callers

nothing calls this directly

Calls 3

samplePlaybookFunction · 0.85
sampleConventionFunction · 0.85
EncodeFunction · 0.85

Tested by

no test coverage detected