Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
158 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package gofakeit | ||
|
||
import "strconv" | ||
|
||
// Faker::Beer.blg #=> "18.5°Blg" | ||
|
||
// BeerName will return a random beer name | ||
func BeerName() string { | ||
return getRandValue([]string{"beer", "name"}) | ||
} | ||
|
||
// BeerStyle will return a random beer style | ||
func BeerStyle() string { | ||
return getRandValue([]string{"beer", "style"}) | ||
} | ||
|
||
// BeerHop will return a random beer hop | ||
func BeerHop() string { | ||
return getRandValue([]string{"beer", "hop"}) | ||
} | ||
|
||
// BeerYeast will return a random beer yeast | ||
func BeerYeast() string { | ||
return getRandValue([]string{"beer", "yeast"}) | ||
} | ||
|
||
// BeerMalt will return a random beer malt | ||
func BeerMalt() string { | ||
return getRandValue([]string{"beer", "malt"}) | ||
} | ||
|
||
// BeerIbu will return a random beer ibu value between 10 and 100 | ||
func BeerIbu() string { | ||
return strconv.Itoa(randIntRange(10, 100)) + " IBU" | ||
} | ||
|
||
// BeerAlcohol will return a random beer alcohol level between 2.0 and 10.0 | ||
func BeerAlcohol() string { | ||
return strconv.FormatFloat(randFloatRange(2.0, 10.0), 'f', 1, 64) + "%" | ||
} | ||
|
||
// BeerBlg will return a random beer blg between 5.0 and 20.0 | ||
func BeerBlg() string { | ||
return strconv.FormatFloat(randFloatRange(5.0, 20.0), 'f', 1, 64) + "°Blg" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
package gofakeit | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
) | ||
|
||
func ExampleBeerName() { | ||
Seed(11) | ||
fmt.Println(BeerName()) | ||
// Output: Duvel | ||
} | ||
|
||
func BenchmarkBeerName(b *testing.B) { | ||
for i := 0; i < b.N; i++ { | ||
BeerName() | ||
} | ||
} | ||
|
||
func ExampleBeerStyle() { | ||
Seed(11) | ||
fmt.Println(BeerStyle()) | ||
// Output: European Amber Lager | ||
} | ||
|
||
func BenchmarkBeerStyle(b *testing.B) { | ||
for i := 0; i < b.N; i++ { | ||
BeerStyle() | ||
} | ||
} | ||
|
||
func ExampleBeerHop() { | ||
Seed(11) | ||
fmt.Println(BeerHop()) | ||
// Output: Glacier | ||
} | ||
|
||
func BenchmarkBeerHop(b *testing.B) { | ||
for i := 0; i < b.N; i++ { | ||
BeerHop() | ||
} | ||
} | ||
|
||
func ExampleBeerYeast() { | ||
Seed(11) | ||
fmt.Println(BeerYeast()) | ||
// Output: 1388 - Belgian Strong Ale | ||
} | ||
|
||
func BenchmarkBeerYeast(b *testing.B) { | ||
for i := 0; i < b.N; i++ { | ||
BeerYeast() | ||
} | ||
} | ||
|
||
func ExampleBeerMalt() { | ||
Seed(11) | ||
fmt.Println(BeerMalt()) | ||
// Output: Munich | ||
} | ||
|
||
func BenchmarkBeerMalt(b *testing.B) { | ||
for i := 0; i < b.N; i++ { | ||
BeerMalt() | ||
} | ||
} | ||
|
||
func ExampleBeerIbu() { | ||
Seed(11) | ||
fmt.Println(BeerIbu()) | ||
// Output: 29 IBU | ||
} | ||
|
||
func BenchmarkBeerIbu(b *testing.B) { | ||
for i := 0; i < b.N; i++ { | ||
BeerIbu() | ||
} | ||
} | ||
|
||
func ExampleBeerAlcohol() { | ||
Seed(11) | ||
fmt.Println(BeerAlcohol()) | ||
// Output: 2.7% | ||
} | ||
|
||
func BenchmarkBeerAlcohol(b *testing.B) { | ||
for i := 0; i < b.N; i++ { | ||
BeerAlcohol() | ||
} | ||
} | ||
|
||
func ExampleBeerBlg() { | ||
Seed(11) | ||
fmt.Println(BeerBlg()) | ||
// Output: 6.4°Blg | ||
} | ||
|
||
func BenchmarkBeerBlg(b *testing.B) { | ||
for i := 0; i < b.N; i++ { | ||
BeerBlg() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package gofakeit | ||
|
||
// DataBeer consists of various beer information | ||
var DataBeer = map[string][]string{ | ||
"name": {"Pliny The Elder", "Founders Kentucky Breakfast", "Trappistes Rochefort 10", "HopSlam Ale", "Stone Imperial Russian Stout", "St. Bernardus Abt 12", "Founders Breakfast Stout", "Weihenstephaner Hefeweissbier", "Péché Mortel", "Celebrator Doppelbock", "Duvel", "Dreadnaught IPA", "Nugget Nectar", "La Fin Du Monde", "Bourbon County Stout", "Old Rasputin Russian Imperial Stout", "Two Hearted Ale", "Ruination IPA", "Schneider Aventinus", "Double Bastard Ale", "90 Minute IPA", "Hop Rod Rye", "Trappistes Rochefort 8", "Chimay Grande Réserve", "Stone IPA", "Arrogant Bastard Ale", "Edmund Fitzgerald Porter", "Chocolate St", "Oak Aged Yeti Imperial Stout", "Ten FIDY", "Storm King Stout", "Shakespeare Oatmeal", "Alpha King Pale Ale", "Westmalle Trappist Tripel", "Samuel Smith’s Imperial IPA", "Yeti Imperial Stout", "Hennepin", "Samuel Smith’s Oatmeal Stout", "Brooklyn Black", "Oaked Arrogant Bastard Ale", "Sublimely Self-Righteous Ale", "Trois Pistoles", "Bell’s Expedition", "Sierra Nevada Celebration Ale", "Sierra Nevada Bigfoot Barleywine Style Ale", "Racer 5 India Pale Ale, Bear Republic Bre", "Orval Trappist Ale", "Hercules Double IPA", "Maharaj", "Maudite"}, | ||
"hop": {"Ahtanum", "Amarillo", "Bitter Gold", "Bravo", "Brewer’s Gold", "Bullion", "Cascade", "Cashmere", "Centennial", "Chelan", "Chinook", "Citra", "Cluster", "Columbia", "Columbus", "Comet", "Crystal", "Equinox", "Eroica", "Fuggle", "Galena", "Glacier", "Golding", "Hallertau", "Horizon", "Liberty", "Magnum", "Millennium", "Mosaic", "Mt. Hood", "Mt. Rainier", "Newport", "Northern Brewer", "Nugget", "Olympic", "Palisade", "Perle", "Saaz", "Santiam", "Simcoe", "Sorachi Ace", "Sterling", "Summit", "Tahoma", "Tettnang", "TriplePearl", "Ultra", "Vanguard", "Warrior", "Willamette", "Yakima Gol"}, | ||
"yeast": {"1007 - German Ale", "1010 - American Wheat", "1028 - London Ale", "1056 - American Ale", "1084 - Irish Ale", "1098 - British Ale", "1099 - Whitbread Ale", "1187 - Ringwood Ale", "1272 - American Ale II", "1275 - Thames Valley Ale", "1318 - London Ale III", "1332 - Northwest Ale", "1335 - British Ale II", "1450 - Dennys Favorite 50", "1469 - West Yorkshire Ale", "1728 - Scottish Ale", "1968 - London ESB Ale", "2565 - Kölsch", "1214 - Belgian Abbey", "1388 - Belgian Strong Ale", "1762 - Belgian Abbey II", "3056 - Bavarian Wheat Blend", "3068 - Weihenstephan Weizen", "3278 - Belgian Lambic Blend", "3333 - German Wheat", "3463 - Forbidden Fruit", "3522 - Belgian Ardennes", "3638 - Bavarian Wheat", "3711 - French Saison", "3724 - Belgian Saison", "3763 - Roeselare Ale Blend", "3787 - Trappist High Gravity", "3942 - Belgian Wheat", "3944 - Belgian Witbier", "2000 - Budvar Lager", "2001 - Urquell Lager", "2007 - Pilsen Lager", "2035 - American Lager", "2042 - Danish Lager", "2112 - California Lager", "2124 - Bohemian Lager", "2206 - Bavarian Lager", "2278 - Czech Pils", "2308 - Munich Lager", "2633 - Octoberfest Lager Blend", "5112 - Brettanomyces bruxellensis", "5335 - Lactobacillus", "5526 - Brettanomyces lambicus", "5733 - Pediococcus"}, | ||
"malt": {"Black malt", "Caramel", "Carapils", "Chocolate", "Munich", "Caramel", "Carapils", "Chocolate malt", "Munich", "Pale", "Roasted barley", "Rye malt", "Special roast", "Victory", "Vienna", "Wheat mal"}, | ||
"style": {"Light Lager", "Pilsner", "European Amber Lager", "Dark Lager", "Bock", "Light Hybrid Beer", "Amber Hybrid Beer", "English Pale Ale", "Scottish And Irish Ale", "Merican Ale", "English Brown Ale", "Porter", "Stout", "India Pale Ale", "German Wheat And Rye Beer", "Belgian And French Ale", "Sour Ale", "Belgian Strong Ale", "Strong Ale", "Fruit Beer", "Vegetable Beer", "Smoke-flavored", "Wood-aged Beer"}, | ||
} |