From 1e43a6a7e35b32a95b0c533d8b2d31f242e72463 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Thu, 16 Aug 2018 18:21:36 +0200 Subject: add a new main to generate random bugs --- vendor/github.com/icrowley/fake/addresses.go | 69 ++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 vendor/github.com/icrowley/fake/addresses.go (limited to 'vendor/github.com/icrowley/fake/addresses.go') diff --git a/vendor/github.com/icrowley/fake/addresses.go b/vendor/github.com/icrowley/fake/addresses.go new file mode 100644 index 00000000..4ef4011e --- /dev/null +++ b/vendor/github.com/icrowley/fake/addresses.go @@ -0,0 +1,69 @@ +package fake + +import "strconv" + +// Continent generates random continent +func Continent() string { + return lookup(lang, "continents", true) +} + +// Country generates random country +func Country() string { + return lookup(lang, "countries", true) +} + +// City generates random city +func City() string { + city := lookup(lang, "cities", true) + switch r.Intn(5) { + case 0: + return join(cityPrefix(), city) + case 1: + return join(city, citySuffix()) + default: + return city + } +} + +func cityPrefix() string { + return lookup(lang, "city_prefixes", false) +} + +func citySuffix() string { + return lookup(lang, "city_suffixes", false) +} + +// State generates random state +func State() string { + return lookup(lang, "states", false) +} + +// StateAbbrev generates random state abbreviation +func StateAbbrev() string { + return lookup(lang, "state_abbrevs", false) +} + +// Street generates random street name +func Street() string { + street := lookup(lang, "streets", true) + return join(street, streetSuffix()) +} + +// StreetAddress generates random street name along with building number +func StreetAddress() string { + return join(Street(), strconv.Itoa(r.Intn(100))) +} + +func streetSuffix() string { + return lookup(lang, "street_suffixes", true) +} + +// Zip generates random zip code using one of the formats specifies in zip_format file +func Zip() string { + return generate(lang, "zips", true) +} + +// Phone generates random phone number using one of the formats format specified in phone_format file +func Phone() string { + return generate(lang, "phones", true) +} -- cgit