Documentation ¶
Overview ¶
Package test contains generic tests and benchmarks for wallet backend implementation. Furthermore, it exports random generators of Addresses and Accounts.
Index ¶
- func GenericAccountBenchmark(b *testing.B, s *Setup)
- func GenericAddressTest(t *testing.T, s *Setup)
- func GenericBackendBenchmark(b *testing.B, s *Setup)
- func GenericSignatureSizeTest(t *testing.T, s *Setup)
- func GenericSignatureTest(t *testing.T, s *Setup)
- func NewRandomAccount(rng *rand.Rand) wallet.Account
- func NewRandomAddress(rng *rand.Rand) wallet.Address
- func SetRandomizer(b Randomizer)
- func SetRandomizerTest(t *testing.T)
- type Randomizer
- type Setup
- type UnlockedAccount
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenericAccountBenchmark ¶
GenericAccountBenchmark runs a suite designed to benchmark the general speed of an implementation of an Account. This function should be called by every implementation of the Account interface.
func GenericAddressTest ¶
GenericAddressTest runs a test suite designed to test the general functionality of addresses. This function should be called by every implementation of the wallet interface.
func GenericBackendBenchmark ¶
GenericBackendBenchmark runs a suite designed to benchmark the general speed of an implementation of a Backend. This function should be called by every implementation of the Backend interface.
func GenericSignatureSizeTest ¶
GenericSignatureSizeTest tests that the size of the signatures produced by Account.Sign(…) does not vary between executions (tested with 2048 samples).
func GenericSignatureTest ¶
GenericSignatureTest runs a test suite designed to test the general functionality of an account. This function should be called by every implementation of the wallet interface.
func NewRandomAccount ¶
NewRandomAccount returns a new random account by calling the currently set wallet randomizer.
func NewRandomAddress ¶
NewRandomAddress returns a new random address by calling the currently set wallet randomizer.
func SetRandomizer ¶
func SetRandomizer(b Randomizer)
SetRandomizer sets the wallet randomizer. It may be set multiple times.
func SetRandomizerTest ¶
SetRandomizerTest is a generic test to test that the wallet randomizer is set correctly.
Types ¶
type Randomizer ¶
type Randomizer interface { NewRandomAddress(*rand.Rand) wallet.Address NewRandomAccount(*rand.Rand) wallet.Account }
Randomizer is the wallet testing backend. It currently supports the generation of random addresses.
type Setup ¶
type Setup struct { UnlockedAccount UnlockedAccount // provides an account that is ready to sign //Address tests AddressBytes []byte // a valid nonzero address not in the wallet Backend wallet.Backend // backend implementation // Signature tests DataToSign []byte }
Setup provides all objects needed for the generic tests
type UnlockedAccount ¶
UnlockedAccount provides an unlocked account.