MCPcopy Create free account
hub / github.com/chain/txvm / checkLogTypes

Function checkLogTypes

protocol/txbuilder/txbuilder_test.go:460–483  ·  view source on GitHub ↗
(t *testing.T, log []txvm.Tuple,
	inputCount, outputCount, retireCount, issueCount, finalizeCount int)

Source from the content-addressed store, hash-verified

458}
459
460func checkLogTypes(t *testing.T, log []txvm.Tuple,
461 inputCount, outputCount, retireCount, issueCount, finalizeCount int) {
462 counts := make(map[byte]int)
463 for _, l := range log {
464 typeCode := l[0].(txvm.Bytes)[0]
465 counts[typeCode]++
466 }
467 ops := []struct {
468 code byte
469 count int
470 }{
471 {code: txvm.InputCode, count: inputCount},
472 {code: txvm.OutputCode, count: outputCount},
473 {code: txvm.RetireCode, count: retireCount},
474 {code: txvm.IssueCode, count: issueCount},
475 {code: txvm.FinalizeCode, count: finalizeCount},
476 }
477
478 for _, o := range ops {
479 if counts[o.code] != o.count {
480 t.Errorf("got %d instance(s) of '%c' in tx log, want %d", counts[o.code], o.code, o.count)
481 }
482 }
483}

Callers 1

TestTxBuilderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected