testaddress

package
v0.0.0-...-e69eef7 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: Apache-2.0 Imports: 2 Imported by: 5

Documentation

Overview

Package testaddress contains functionality to generate deterministic addresses for testing.

Index

Constants

This section is empty.

Variables

View Source
var ArbitraryGenerator = Generator{Country: "GBR", Cities: []string{"Cambridge", "London"}}

ArbitraryGenerator is a generator of addresses with predefined country and cities, to be used when the exact values do not matter.

Functions

This section is empty.

Types

type Generator

type Generator struct {
	Country string
	Cities  []string
	// contains filtered or unexported fields
}

Generator generates addresses for testing.

func (*Generator) Random

func (g *Generator) Random() *ir.Address

Random returns a deterministically different British address each time. The address will be in the following formats with equal probabilities:

n Test House
n Test Street
AB# #CD
City
Country

Where: n is a integer number that starts from 1 and increases by 1 for every address generated.

AB# #CD is a UK post code, where # is a digit that ranges between 0-9, increasing by 1 for every address generated and wrapping to 0. It is equivalent to the ones digit of n.

City is the nth city in the list of cities configured for the generator. After it reaches the end of the list, it will wrap back around to the beginning of the list.

Jump to

Keyboard shortcuts

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