tapir/primitives/core/transcript_test.go

31 lines
886 B
Go
Raw Normal View History

2019-09-14 23:44:19 +00:00
package core
import (
"testing"
)
func TestNewTranscript(t *testing.T) {
// Some very basic integrity checking
transcript := NewTranscript("label")
transcript.AddToTranscript("action", []byte("test data"))
2021-06-09 17:36:34 +00:00
firstAudit := transcript.OutputTranscriptToAudit()
secondAudit := transcript.OutputTranscriptToAudit()
if firstAudit != secondAudit {
2019-09-14 23:44:19 +00:00
t.Fatalf("Multiple Audit Calls should not impact underlying Transcript")
}
t.Logf("%v", transcript.OutputTranscriptToAudit())
t.Logf("%v", transcript.CommitToTranscript("first commit"))
t.Logf("%v", transcript.OutputTranscriptToAudit())
t.Logf("%v", transcript.CommitToTranscript("second commit"))
t.Logf("%v", transcript.OutputTranscriptToAudit())
transcript.AddToTranscript("action", []byte("test data"))
t.Logf("%v", transcript.CommitToTranscript("third commit"))
t.Logf("%v", transcript.OutputTranscriptToAudit())
}