a2m

package
v0.0.0-...-58d1483 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2017 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const DIGEST_SIZE = 32
View Source
const MESSAGE_SIZE = 121

Variables

This section is empty.

Functions

This section is empty.

Types

type A2MInterface

type A2MInterface interface {
	StartA2M()
	Append(logname string, input []byte) ([]byte, error)
	Advance(logname string, n int, newdigest []byte, input []byte) ([]byte, error)
	Lookup(logname string, n int) ([]byte, error)
	End(logname string) ([]byte, error)
	Truncate(logname string, n int) error
	VerifyAttestation(attestation []byte) (int, error)
	VerifySkippedAttestation(attestation []byte) (int, error)
	GetMessage(attestation []byte) ([]byte, error)
	DestroyA2M()
}

//go:generate moq -out am2_impl.go . A2MInterface

func CreateNewA2M

func CreateNewA2M() A2MInterface

create new mock A2M interface

type A2MInterfaceMock

type A2MInterfaceMock struct {
	// AdvanceFunc mocks the Advance method.
	AdvanceFunc func(logname string, n int, newdigest []byte, input []byte) ([]byte, error)

	// AppendFunc mocks the Append method.
	AppendFunc func(logname string, input []byte) ([]byte, error)

	// DestroyA2MFunc mocks the DestroyA2M method.
	DestroyA2MFunc func()

	// EndFunc mocks the End method.
	EndFunc func(logname string) ([]byte, error)

	// GetMessageFunc mocks the GetMessage method.
	GetMessageFunc func(attestation []byte) ([]byte, error)

	// LookupFunc mocks the Lookup method.
	LookupFunc func(logname string, n int) ([]byte, error)

	// StartA2MFunc mocks the StartA2M method.
	StartA2MFunc func()

	// TruncateFunc mocks the Truncate method.
	TruncateFunc func(logname string, n int) error

	// VerifyAttestationFunc mocks the VerifyAttestation method.
	VerifyAttestationFunc func(attestation []byte) (int, error)

	// VerifySkippedAttestationFunc mocks the VerifySkippedAttestation method.
	VerifySkippedAttestationFunc func(attestation []byte) (int, error)
	// contains filtered or unexported fields
}

A2MInterfaceMock is a mock implementation of A2MInterface.

    func TestSomethingThatUsesA2MInterface(t *testing.T) {

        // make and configure a mocked A2MInterface
        mockedA2MInterface := &A2MInterfaceMock{
            AdvanceFunc: func(logname string, n int, newdigest []byte, input []byte) ([]byte, error) {
	               panic("TODO: mock out the Advance method")
            },
            AppendFunc: func(logname string, input []byte) ([]byte, error) {
	               panic("TODO: mock out the Append method")
            },
            DestroyA2MFunc: func()  {
	               panic("TODO: mock out the DestroyA2M method")
            },
            EndFunc: func(logname string) ([]byte, error) {
	               panic("TODO: mock out the End method")
            },
            GetMessageFunc: func(attestation []byte) ([]byte, error) {
	               panic("TODO: mock out the GetMessage method")
            },
            LookupFunc: func(logname string, n int) ([]byte, error) {
	               panic("TODO: mock out the Lookup method")
            },
            StartA2MFunc: func()  {
	               panic("TODO: mock out the StartA2M method")
            },
            TruncateFunc: func(logname string, n int) error {
	               panic("TODO: mock out the Truncate method")
            },
            VerifyAttestationFunc: func(attestation []byte) (int, error) {
	               panic("TODO: mock out the VerifyAttestation method")
            },
            VerifySkippedAttestationFunc: func(attestation []byte) (int, error) {
	               panic("TODO: mock out the VerifySkippedAttestation method")
            },
        }

        // TODO: use mockedA2MInterface in code that requires A2MInterface
        //       and then make assertions.

    }

func (*A2MInterfaceMock) Advance

func (mock *A2MInterfaceMock) Advance(logname string, n int, newdigest []byte, input []byte) ([]byte, error)

Advance calls AdvanceFunc.

func (*A2MInterfaceMock) AdvanceCalls

func (mock *A2MInterfaceMock) AdvanceCalls() []struct {
	Logname   string
	N         int
	Newdigest []byte
	Input     []byte
}

AdvanceCalls gets all the calls that were made to Advance. Check the length with:

len(mockedA2MInterface.AdvanceCalls())

func (*A2MInterfaceMock) Append

func (mock *A2MInterfaceMock) Append(logname string, input []byte) ([]byte, error)

Append calls AppendFunc.

func (*A2MInterfaceMock) AppendCalls

func (mock *A2MInterfaceMock) AppendCalls() []struct {
	Logname string
	Input   []byte
}

AppendCalls gets all the calls that were made to Append. Check the length with:

len(mockedA2MInterface.AppendCalls())

func (*A2MInterfaceMock) DestroyA2M

func (mock *A2MInterfaceMock) DestroyA2M()

DestroyA2M calls DestroyA2MFunc.

func (*A2MInterfaceMock) DestroyA2MCalls

func (mock *A2MInterfaceMock) DestroyA2MCalls() []struct {
}

DestroyA2MCalls gets all the calls that were made to DestroyA2M. Check the length with:

len(mockedA2MInterface.DestroyA2MCalls())

func (*A2MInterfaceMock) End

func (mock *A2MInterfaceMock) End(logname string) ([]byte, error)

End calls EndFunc.

func (*A2MInterfaceMock) EndCalls

func (mock *A2MInterfaceMock) EndCalls() []struct {
	Logname string
}

EndCalls gets all the calls that were made to End. Check the length with:

len(mockedA2MInterface.EndCalls())

func (*A2MInterfaceMock) GetMessage

func (mock *A2MInterfaceMock) GetMessage(attestation []byte) ([]byte, error)

GetMessage calls GetMessageFunc.

func (*A2MInterfaceMock) GetMessageCalls

func (mock *A2MInterfaceMock) GetMessageCalls() []struct {
	Attestation []byte
}

GetMessageCalls gets all the calls that were made to GetMessage. Check the length with:

len(mockedA2MInterface.GetMessageCalls())

func (*A2MInterfaceMock) Lookup

func (mock *A2MInterfaceMock) Lookup(logname string, n int) ([]byte, error)

Lookup calls LookupFunc.

func (*A2MInterfaceMock) LookupCalls

func (mock *A2MInterfaceMock) LookupCalls() []struct {
	Logname string
	N       int
}

LookupCalls gets all the calls that were made to Lookup. Check the length with:

len(mockedA2MInterface.LookupCalls())

func (*A2MInterfaceMock) StartA2M

func (mock *A2MInterfaceMock) StartA2M()

StartA2M calls StartA2MFunc.

func (*A2MInterfaceMock) StartA2MCalls

func (mock *A2MInterfaceMock) StartA2MCalls() []struct {
}

StartA2MCalls gets all the calls that were made to StartA2M. Check the length with:

len(mockedA2MInterface.StartA2MCalls())

func (*A2MInterfaceMock) Truncate

func (mock *A2MInterfaceMock) Truncate(logname string, n int) error

Truncate calls TruncateFunc.

func (*A2MInterfaceMock) TruncateCalls

func (mock *A2MInterfaceMock) TruncateCalls() []struct {
	Logname string
	N       int
}

TruncateCalls gets all the calls that were made to Truncate. Check the length with:

len(mockedA2MInterface.TruncateCalls())

func (*A2MInterfaceMock) VerifyAttestation

func (mock *A2MInterfaceMock) VerifyAttestation(attestation []byte) (int, error)

VerifyAttestation calls VerifyAttestationFunc.

func (*A2MInterfaceMock) VerifyAttestationCalls

func (mock *A2MInterfaceMock) VerifyAttestationCalls() []struct {
	Attestation []byte
}

VerifyAttestationCalls gets all the calls that were made to VerifyAttestation. Check the length with:

len(mockedA2MInterface.VerifyAttestationCalls())

func (*A2MInterfaceMock) VerifySkippedAttestation

func (mock *A2MInterfaceMock) VerifySkippedAttestation(attestation []byte) (int, error)

VerifySkippedAttestation calls VerifySkippedAttestationFunc.

func (*A2MInterfaceMock) VerifySkippedAttestationCalls

func (mock *A2MInterfaceMock) VerifySkippedAttestationCalls() []struct {
	Attestation []byte
}

VerifySkippedAttestationCalls gets all the calls that were made to VerifySkippedAttestation. Check the length with:

len(mockedA2MInterface.VerifySkippedAttestationCalls())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL