aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/icrowley/fake/addresses.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-08-16 18:21:36 +0200
committerMichael Muré <batolettre@gmail.com>2018-08-16 18:22:00 +0200
commit1e43a6a7e35b32a95b0c533d8b2d31f242e72463 (patch)
treea52a07b97ca5daae0ca3576e3f3fe0e565818493 /vendor/github.com/icrowley/fake/addresses.go
parentf510e43418aef31e8521d346abdcda6c38f34eaf (diff)
downloadgit-bug-1e43a6a7e35b32a95b0c533d8b2d31f242e72463.tar.gz
add a new main to generate random bugs
Diffstat (limited to 'vendor/github.com/icrowley/fake/addresses.go')
-rw-r--r--vendor/github.com/icrowley/fake/addresses.go69
1 files changed, 69 insertions, 0 deletions
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)
+}