Documentation ¶
Index ¶
- Constants
- Variables
- func BindingsByName(bindings []types.BoundContract, name string) []types.BoundContract
- func Compare[T cmp.Ordered](a, b T, op primitives.ComparisonOperator) bool
- func RunCodecInterfaceFuzzTests(f *testing.F, tester CodecInterfaceTester)
- func RunCodecInterfaceTests(t *testing.T, tester CodecInterfaceTester)
- func RunCodecWithStrictArgsInterfaceTest(t *testing.T, tester CodecInterfaceTester)
- func RunContractReaderInterfaceTests[T TestingT[T]](t T, tester ChainComponentsInterfaceTester[T], mockRun bool)
- func SubmitTransactionToCW[T TestingT[T]](t T, tester ChainComponentsInterfaceTester[T], method string, args any, ...) string
- func WaitForTransactionStatus[T TestingT[T]](t T, tester ChainComponentsInterfaceTester[T], txID string, ...) error
- type BasicTester
- type BatchCallEntry
- type ChainComponentsInterfaceTester
- type CodecInterfaceTester
- type ContractBatchEntry
- type EncodeRequest
- type ExpectedGetLatestValueArgs
- type FilterEventParams
- type InnerDynamicTestStruct
- type InnerStaticTestStruct
- type LatestParams
- type MidLevelDynamicTestStruct
- type MidLevelStaticTestStruct
- type PrimitiveArgs
- type ReadEntry
- type TestStruct
- type TestStructMissingField
- type TestStructWithExtraField
- type TestingT
Constants ¶
View Source
const ( AnyValueToReadWithoutAnArgument = uint64(3) AnyDifferentValueToReadWithoutAnArgument = uint64(1990) MethodTakingLatestParamsReturningTestStruct = "GetLatestValues" MethodReturningUint64 = "GetPrimitiveValue" MethodReturningAlterableUint64 = "GetAlterablePrimitiveValue" MethodReturningUint64Slice = "GetSliceValue" MethodReturningSeenStruct = "GetSeenStruct" MethodSettingStruct = "addTestStruct" MethodSettingUint64 = "setAlterablePrimitiveValue" MethodTriggeringEvent = "triggerEvent" EventName = "SomeEvent" EventNameField = EventName + ".Field" ProtoTest = "ProtoTest" ProtoTestIntComparator = ProtoTest + ".IntComparator" ProtoTestStringComparator = ProtoTest + ".StringComparator" EventWithFilterName = "SomeEventToFilter" AnyContractName = "TestContract" AnySecondContractName = "Not" + AnyContractName )
View Source
const ( TestItemType = "TestItem" TestItemSliceType = "TestItemSliceType" TestItemArray1Type = "TestItemArray1Type" TestItemArray2Type = "TestItemArray2Type" TestItemWithConfigExtra = "TestItemWithConfigExtra" NilType = "NilType" )
View Source
const AnyExtraValue = 3
Variables ¶
View Source
var AnySliceToReadWithoutAnArgument = []uint64{3, 4}
Functions ¶
func BindingsByName ¶ added in v0.3.0
func BindingsByName(bindings []types.BoundContract, name string) []types.BoundContract
func Compare ¶ added in v0.3.0
func Compare[T cmp.Ordered](a, b T, op primitives.ComparisonOperator) bool
func RunCodecInterfaceFuzzTests ¶
func RunCodecInterfaceFuzzTests(f *testing.F, tester CodecInterfaceTester)
func RunCodecInterfaceTests ¶
func RunCodecInterfaceTests(t *testing.T, tester CodecInterfaceTester)
func RunCodecWithStrictArgsInterfaceTest ¶
func RunCodecWithStrictArgsInterfaceTest(t *testing.T, tester CodecInterfaceTester)
RunCodecWithStrictArgsInterfaceTest is meant to be used by codecs that don't pad They can assure that the right argument size is verified. Padding makes that harder/impossible to verify for come codecs. However, the extra verification is nice to have when possible.
func RunContractReaderInterfaceTests ¶ added in v0.2.2
func RunContractReaderInterfaceTests[T TestingT[T]](t T, tester ChainComponentsInterfaceTester[T], mockRun bool)
func SubmitTransactionToCW ¶ added in v0.2.2
func SubmitTransactionToCW[T TestingT[T]](t T, tester ChainComponentsInterfaceTester[T], method string, args any, contract types.BoundContract, status types.TransactionStatus) string
SubmitTransactionToCW submits a transaction to the ChainWriter and waits for it to reach the given status.
func WaitForTransactionStatus ¶ added in v0.2.2
func WaitForTransactionStatus[T TestingT[T]](t T, tester ChainComponentsInterfaceTester[T], txID string, status types.TransactionStatus, mockRun bool) error
WaitForTransactionStatus waits for a transaction to reach the given status.
Types ¶
type BasicTester ¶
type BatchCallEntry ¶
type BatchCallEntry map[types.BoundContract]ContractBatchEntry
type ChainComponentsInterfaceTester ¶ added in v0.2.2
type ChainComponentsInterfaceTester[T TestingT[T]] interface { BasicTester[T] GetContractReader(t T) types.ContractReader GetChainWriter(t T) types.ChainWriter GetBindings(t T) []types.BoundContract // DirtyContracts signals to the underlying tester than the test contracts are dirty, i.e. the state has been changed such that // new, fresh contracts should be deployed. This usually happens after a value is written to the contract via // the ChainWriter. DirtyContracts() MaxWaitTimeForEvents() time.Duration // GenerateBlocksTillConfidenceLevel is only used by the internal common tests, all other tests can/should // rely on the ChainWriter waiting for actual blocks to be mined. GenerateBlocksTillConfidenceLevel(t T, contractName, readName string, confidenceLevel primitives.ConfidenceLevel) }
type CodecInterfaceTester ¶
type CodecInterfaceTester interface { BasicTester[*testing.T] EncodeFields(t *testing.T, request *EncodeRequest) []byte GetCodec(t *testing.T) types.Codec // IncludeArrayEncodingSizeEnforcement is here in case there's no way to have fixed arrays in the encoded values IncludeArrayEncodingSizeEnforcement() bool }
type ContractBatchEntry ¶
type ContractBatchEntry []ReadEntry
type EncodeRequest ¶
type EncodeRequest struct { TestStructs []TestStruct ExtraField bool MissingField bool TestOn string }
type ExpectedGetLatestValueArgs ¶
type ExpectedGetLatestValueArgs struct {
ContractName, ReadName string
ConfidenceLevel primitives.ConfidenceLevel
Params, ReturnVal any
}
func (ExpectedGetLatestValueArgs) String ¶
func (e ExpectedGetLatestValueArgs) String() string
type FilterEventParams ¶
type FilterEventParams struct {
Field int32
}
type InnerDynamicTestStruct ¶ added in v0.3.0
type InnerStaticTestStruct ¶ added in v0.3.0
type LatestParams ¶
type LatestParams struct { // I should be > 0 I int }
type MidLevelDynamicTestStruct ¶ added in v0.3.0
type MidLevelDynamicTestStruct struct { FixedBytes [2]byte Inner InnerDynamicTestStruct }
type MidLevelStaticTestStruct ¶ added in v0.3.0
type MidLevelStaticTestStruct struct { FixedBytes [2]byte Inner InnerStaticTestStruct }
type PrimitiveArgs ¶ added in v0.2.2
type PrimitiveArgs struct {
Value uint64
}
type TestStruct ¶
type TestStruct struct { Field *int32 OracleID commontypes.OracleID OracleIDs [32]commontypes.OracleID Account []byte Accounts [][]byte DifferentField string BigField *big.Int NestedDynamicStruct MidLevelDynamicTestStruct NestedStaticStruct MidLevelStaticTestStruct }
func CreateTestStruct ¶
func CreateTestStruct[T any](i int, tester BasicTester[T]) TestStruct
type TestStructMissingField ¶
type TestStructMissingField struct { DifferentField string OracleID commontypes.OracleID OracleIDs [32]commontypes.OracleID Account []byte Accounts [][]byte BigField *big.Int NestedDynamicStruct MidLevelDynamicTestStruct NestedStaticStruct MidLevelStaticTestStruct }
type TestStructWithExtraField ¶
type TestStructWithExtraField struct { TestStruct ExtraField int }
Click to show internal directories.
Click to hide internal directories.