-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add SSN generator Fixes #40 * Add Person Contact generator * Add struct generator * Add Map generator * Format source code * Add CountryAbbr generator to Address * Add Gamer generator with Tag method * Add Language struct generator * Add LanguageAbbr and ProgrammingLanguage to Language generator * Add Beer struct generator * Add Car struct generator * Add Fruit struct generator * Add StatusCode generator to Internet and improved UserAgent generator with more random one * Add App struct generator * Add Pet struct generator * Add Emoji struct generator * Apply fmt
- Loading branch information
Showing
28 changed files
with
5,352 additions
and
33 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
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,20 @@ | ||
package faker | ||
|
||
var ( | ||
appNames = []string{"App Your Service", "Appcentric", "Appcare", "Develapp", "Fingertip Freedom", "Winning Widgets", "Tap Into Apps", "Download Developers", "Download Digital", "Tool Kit Digital", "Tech Happy", "Appy Digital", "Handheld Help", "In Your Palm", "For Your Palm", "Fit For Fingertips", "Fingertrip", "Tap To Begin", "Tap Into Digital", "Download Dev", "Touchpoint", "Trained For Tech", "Digitize Design", "About Apps", "A Is For App", "Handheld Digital", "Apprecicreate", "Apptitude", "Appreciate Apps", "Appster", "Digiapp", "Good Apptitude", "App Association", "Appetite", "Take-With-You Tech", "App Tech", "Appetite", "Strong Appetite", "App Natural", "Develop Digital", "Digital Daredevil", "If You Build It", "Pocket Pro", "Iconic Inc.", "Icon Inc.", "Fingertip Tech", "Dare To Design", "Pocket Pros", "Digit Widget", "Build Better", "Dual Develop", "Amazing Apps", "Action Apps", "Application Station", "App Innovation", "Fun Apps", "Fantappstic", "App Command", "Strike Apps", "App Force", "Creative Applications", "App Fly", "Sure Apps", "App Door", "App Tray", "App Sure", "Rocket Apps", "App Place", "App Cafe", "Trippy Apps", "Appkey", "App Home", "Hot Apps", "App Focus", "App Possible", "App Leader", "Whip App", "App Works", "Good Apps", "Easy Apps", "App Source", "App Stage", "App Inspire", "Fire Apps", "App Flower", "App Dog", "Advance Apps", "Chatter Apps", "App Dream", "Bold Apps", "Boss Apps", "App Joy", "App Bullet", "App Cracker", "True Apps", "Feather Apps", "Real Apps", "App Whimsy", "Jewel Apps", "Image Apps", "Rifle Apps", "Next App", "Mobile Vibes", "Candy App", "Setup App", "Personality App", "Essential Web", "VitalApp", "Interact Mobile", "HelloWeb", "Network Moment", "Major Connection", "Billing Mobile", "SmartApp", "NoteWork", "Web Influence", "PowerPhone", "Chief Network", "Connection App", "WebTools", "Gamepad", "Mobile Stick", "Know The App", "WebChecker", "PassApp", "RobotSoft", "SmartCloud", "MobileHelp", "WebDesk", "EasyClick", "WeBox", "AppCan", "Smartum", "Smartio", "Smarter Web", "GrandMobile", "Technet", "RoboVoice", "TabletSoft", "E-APPy", "SkyApp", "WebMap", "BoostApp", "UserMobile", "CheapMobile", "WireSmart", "SwipeApp", "LiveBox", "WebGroup", "LinkApp", "OneClick", "MeetAll", "MomyApp", "Moboapp Developers", "Uniworld Games", "Raptor Games", "Gamers Republic", "Atomik Games", "Javatron Games", "Ultrasonic Apps", "Graviton Games", "Virtualsphere Mobile App Developers", "Javanation", "Telesoft Mobile App Developers", "Phantom Labs", "Rededge Creations", "Virtualyard Tech", "Coderant It Solutions", "Loopsoft Developers", "Clever Co App Developers", "Primeroyal App Creations", "Cyberville Tech", "Angularis Mobile App Developers", "Oceanfloat Technology", "Intelli-Ware Creations", "Aster Mobile App Developers", "Venus Hub", "Pilot Softwares", "Dominio Software Consult", "Customs Software Developers", "Cellarstars Mobile Developers", "Helevate Games", "Tetrabyte", "Monolith Games", "Selvo Games", "Metreality Games", "Hovertec Games", "Helicion Games", "Play Monkey Studios", "Digisphere Developers", "Revolt Games", "Sabre Games", "Savagechimp Games", "Spidermokey Concept", "Gravitones Games", "Clique18 Concepts", "Blackguard Gamea", "WireSmart", "SwipeApp", "LiveBox", "WebGroup", "LinkApp", "OneClick", "MeetAll", "MomyApp"} | ||
) | ||
|
||
// App is a faker struct for App | ||
type App struct { | ||
Faker *Faker | ||
} | ||
|
||
// Name returns a fake app name for App | ||
func (a App) Name() string { | ||
return a.Faker.RandomStringElement(appNames) | ||
} | ||
|
||
// Version returns a fake app version for App | ||
func (a App) Version() string { | ||
return a.Faker.Numerify("v#.#.#") | ||
} |
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,15 @@ | ||
package faker | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestAppName(t *testing.T) { | ||
a := New().App() | ||
NotExpect(t, "", a.Name()) | ||
} | ||
|
||
func TestAppVersion(t *testing.T) { | ||
a := New().App() | ||
NotExpect(t, "", a.Version()) | ||
} |
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,50 @@ | ||
package faker | ||
|
||
import "strconv" | ||
|
||
var ( | ||
beerNames = []string{"Dale’s Pale Ale", "Breckenridge Vanilla Porter", "Brooklyn Brewery Lager", "Surly Brewing Darkness", "New Belgium Fat Tire", "Gigantic IPA", "NoDa Hop Drop n Roll", "Sam Adams Boston Lager", "Green Flash Palate Wrecker", "Dogfish Head 90 Minute IPA", "Pipeworks Citra", "Widmer Brothers Hefeweizen", "The Bruery Saison Rue", "Foothills Brewing Sexual Chocolate", "Avery Uncle Jacob’s Stout", "The Alchemist Focal Banger", "Hill Farmstead Abner", "Westbrook Gose", "Firestone Walker Union Jack IPA", "Highland Cold Mountain Winter Ale", "Sierra Nevada Pale Ale", "Allagash White", "Anchor Steam Beer", "Alpine Duet IPA", "Russian River Supplication", "Craftsman Cabernale", "Bell’s Two Hearted", "Deschutes Black Butte Porter", "Half Acre Daisy Cutter", "Smuttynose Finest Kind IPA", "Hair of the Dog Adam", "AleSmith Horny Devil", "21st Amendment Bitter American", "Stone IPA", "Tröegs Nugget Nectar", "Ballast Point Sculpin", "Upslope Brown Ale", "Rogue Shakespeare Oatmeal Stout", "Saint Arnold Fancy Lawnmower", "DC Brau On the Wings Of Armageddon", "Haymarket Angry Birds Rye IPA", "Capital Autumnal Fire Doppelbock", "Fullsteam Carver", "Green Flash Hop Head Red", "Russian River Blind Pig IPA", "Revolution Anti-Hero IPA", "Bell’s Hop Slam", "Great Lakes Edmund Fitzgerald Porter", "Jolly Pumpkin La Roja", "Toppling Goliath PseudoSue", "Lagunitas Brown Shugga", "Avery Rumpkin", "Firestone Walker Velvet Merkin", "Boulevard Tank 7", "Founders Red’s Rye", "Schlafly Pumpkin Ale", "Perennial Artisan Ales Abraxas Imperial Stout", "Three Floyds Zombie Dust", "Wicked Weed Serenity", "Stone Enjoy By… IPA", "The Bruery Sans Pagaie", "Firestone Walker Wookey Jack", "Cascade Brewing Apricot Ale", "Odell 90 Shilling Ale", "Left Hand Milk Stout Nitro", "Kern River Brewing Citra DIPA", "New Holland Dragon’s Milk", "Jester King Boxer’s Revenge", "Funky Buddha Maple Bacon Coffee Porter", "New Glarus Brewing Serendipity", "Westbrook Mexican Cake", "Alpine Great", "Terrapin Wake n Bake", "Wild Heaven Eschaton", "Ten Fidy", "New Belgium Lips of Faith La Folie", "Jai Alai IPA", "Founders Breakfast Stout", "Allagash Curieux", "Lagunitas IPA", "Great Divide Yeti", "Hill Farmstead Everett Porter", "Samuel Adams Utopias", "Troegs Mad Elf", "Dark Horse Plead the 5th", "Clown Shoes Undead Party Crasher", "Brewery Ommegang Three Philosophers", "North Coast Old Rasputin", "Avery Mephistopheles Stout", "Goose Island Bourbon County Stout", "Sierra Nevada Bigfoot Barleywine-Style Ale", "Firestone Walker Parabola", "Victory Prima Pils", "Lost Abbey Duck Duck Gooze", "Cigar City Hanaphu Imperial Stout", "Founders KBS (Kentucky Breakfast Stout)", "The Alchemist Heady Topper", "Russian River Pliny the Elder", "Floyds Dark Lord"} | ||
beerStyles = []string{"Altbier", "Amber ale", "Barley wine", "Berliner Weisse", "Bière de Garde", "Bitter", "Blonde Ale", "Bock", "Brown ale", "California Common/Steam Beer", "Cream Ale", "Dortmunder Export", "Doppelbock", "Dunkel", "Dunkelweizen", "Eisbock", "Flanders red ale", "Golden/Summer ale", "Gose", "Gueuze", "Hefeweizen", "Helles", "India pale ale", "Kölsch", "Lambic", "Light ale", "Maibock/Helles bock", "Malt liquor", "Mild", "Oktoberfestbier/Märzenbier", "Old ale", "Oud bruin", "Pale ale", "Pilsener/Pilsner/Pils", "Porter", "Red ale", "Roggenbier", "Saison", "Scotch ale", "Stout", "Schwarzbier", "Vienna lager", "Witbier", "Weissbier", "Weizenbock", "Fruit beer", "Herb and spiced beer", "Honey beer", "Rye Beer", "Smoked beer", "Vegetable beer", "Wild beer", "Wood-aged beer"} | ||
beerHops = []string{"Admiral Hops", "Agnus Hops", "Ahtanum Hops", "AlphAroma Hops", "Amarillo Hops", "Amethyst Hops", "Apollo Hops", "Aramis Hops", "Atlas Hops", "Aurora Hops", "Beata Hops", "Belma Hops", "Bitter Gold Hops", "Boadicea Hops", "Bobek Hops", "Bouclier Hops", "Bramling Cross Hops", "Bravo Hops", "Brewers Gold Hops", "British Kent Goldings Hops", "Bullion Hops", "Calicross Hops", "California Cluster Hops", "Calypso Hops", "Cascade Hops", "Cashmere Hops", "Cekin Hops", "Celeia Hops", "Centennial Hops", "Challenger Hops", "Chelan Hops", "Chinook Hops", "Cicero Hops", "Citra Hops", "Cluster Hops", "Cobb’s Golding Hops", "Columbia Hops", "Columbus Hops", "Comet Hops", "Crystal Hops", "Dana Hops", "Delta Hops", "Dr. Rudi Hops", "Early Green Hops", "El Dorado Hops", "Ella Hops", "Endeavour Hops", "Equinox Hops", "Eroica Hops", "Falconer's Flight Hops", "First Gold Hops", "Flyer Hops", "Fuggle Hops", "Galaxy Hops", "Galena Hops", "Glacier Hops", "Golding Hops", "Green Bullet Hops", "Hallertau Hops", "HBC 342 Experimental Hops", "HBC 472 Experimental Hops", "Helga Hops", "Herald Hops", "Herkules Hops", "Hersbrucker Hops", "Horizon Hops", "Huell Melon Hops", "Idaho 7 Hops", "Idaho Gem™ Hops", "Jester Hops", "Junga Hops", "Kazbek Hops", "Kohatu Hops", "Liberty Hops", "Lubelski Hops", "Magnum Hops", "Mandarina Bavaria Hops", "Mathon Hops", "Marynka Hops", "Medusa™ Hops", "Meridian Hops", "Merkur Hops", "Millennium Hops", "Mittelfruh Hops", "Mosaic Hops", "Motueka Hops", "Mt. Hood Hops", "Mt. Rainier Hops", "Multihead Hops", "Nelson Sauvin Hops", "Neo1 Hops", "Newport Hops", "Northdown Hops", "Northern Brewer Hops", "Nugget Hops", "Opal Hops", "Orbit Hops", "Orion Hops", "Outeniqua Hops", "Pacific Gem Hops", "Pacific Jade Hops", "Pacific Sunrise Hops", "Pacifica Hops", "Palisade Hops", "Perle Hops", "Phoenix Hops", "Pilgrim Hops", "Pilot Hops", "Pioneer Hops", "Polaris Hops", "Premiant Hops", "Pride of Ringwood Hops", "Progress Hops", "Rakau Hops", "Riwaka Hops", "Saaz Hops", "Sabro Hops / Ron Mexico", "Santiam Hops", "Saphir Hops", "Satus Hops", "Select Hops", "Serebrianka Hops", "Simcoe Hops", "Sladek Hops", "Smaragd Hops", "Sonnet Hops", "Sorachi Ace Hops", "Southern Brewer Hops", "Southern Cross Hops", "Southern Promise Hops", "Southern Star Hops", "Sovereign Hops", "Spault Hops", "Spaulter Select Hops", "Sterling Hops", "Strata Hops", "Strickelbract Hops", "Strisselspault Hops", "Styrian Gold Hops", "Styrian Golding Hops", "Summer Hops", "Summit Hops", "Super Galena Hops", "Super Pride Hops", "Sussex Hops", "Sybilla Hops", "Sylva Hops", "Tahoma Hops", "Tardif de Burgogne Hops", "Target Hops", "Taurus Hops", "Teamaker Hops", "Tettnanger Hops", "Tillicum Hops", "Topaz Hops", "Tradition Hops", "Triple Pearl Hops", "Triskel Hops", "Ultra Hops", "Universal Hops", "Vanguard Hops", "Victoria Hops", "Vic Secret Hops", "Viking Hops", "Vital Hops", "Vojvodina Hops", "Wai-iti Hops", "Waimea Hops", "Wakatu Hops", "Warrior Hops", "Whitbread Goldings Hops", "Willamette Hops", "Yakima Cluster Hops", "Yakima Gold Hops", "Zappa Hops", "Zenith Hops", "Zythos Hops"} | ||
beerMalts = []string{"Pale Malt", "Wheat Malt", "Rye Malt", "Vienna Malt", "Munich Malt", "Carapils", "Caramel/Crystal 10", "Caramel/Crystal 40", "Caramel/Crystal 60", "Caramel/Crystal 120", "Victory Malt", "Special Roast", "Chocolate Malt", "Roasted Barley", "Black Barley", "Black Patent", "German Pale", "Weizen", "Wiener", "Munchener", "Crystal", "Carafa Special", "German Acidulated", "German Melanoidin", "Belgian Pilsner", "Aromatic", "Belgian Special", "Biscuit Malt", "CaraVienne", "CaraMunich", "Rauchmalt 2", "Honey Malt", "Peated Malt"} | ||
) | ||
|
||
// Beer is a faker struct for Beer | ||
type Beer struct { | ||
Faker *Faker | ||
} | ||
|
||
// Name will return a random beer name | ||
func (b Beer) Name() string { | ||
return b.Faker.RandomStringElement(beerNames) | ||
} | ||
|
||
// Style will return a random beer style | ||
func (b Beer) Style() string { | ||
return b.Faker.RandomStringElement(beerStyles) | ||
} | ||
|
||
// Hop will return a random beer hop | ||
func (b Beer) Hop() string { | ||
return b.Faker.RandomStringElement(beerHops) | ||
} | ||
|
||
// Malt will return a random beer malt | ||
func (b Beer) Malt() string { | ||
return b.Faker.RandomStringElement(beerMalts) | ||
} | ||
|
||
// Alcohol will return a random beer alcohol level between 2.0 and 10.0 | ||
func (b Beer) Alcohol() string { | ||
return strconv.FormatFloat(b.Faker.RandomFloat(2, 2.0, 10.0), 'f', 1, 64) + "%" | ||
} | ||
|
||
// Ibu will return a random beer ibu value between 10 and 100 | ||
func (b Beer) Ibu() string { | ||
return strconv.Itoa(b.Faker.IntBetween(10, 100)) + " IBU" | ||
} | ||
|
||
// Blg will return a random beer blg between 5.0 and 20.0 | ||
func (b Beer) Blg() string { | ||
return strconv.FormatFloat(b.Faker.RandomFloat(2, 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,40 @@ | ||
package faker | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestBeerName(t *testing.T) { | ||
v := New().Beer().Name() | ||
NotExpect(t, "", v) | ||
} | ||
|
||
func TestBeerStyle(t *testing.T) { | ||
v := New().Beer().Style() | ||
NotExpect(t, "", v) | ||
} | ||
|
||
func TestBeerHop(t *testing.T) { | ||
v := New().Beer().Hop() | ||
NotExpect(t, "", v) | ||
} | ||
|
||
func TestBeerMalt(t *testing.T) { | ||
v := New().Beer().Malt() | ||
NotExpect(t, "", v) | ||
} | ||
|
||
func TestBeerAlcohol(t *testing.T) { | ||
v := New().Beer().Alcohol() | ||
NotExpect(t, "", v) | ||
} | ||
|
||
func TestBeerIbu(t *testing.T) { | ||
v := New().Beer().Ibu() | ||
NotExpect(t, "", v) | ||
} | ||
|
||
func TestBeerBlg(t *testing.T) { | ||
v := New().Beer().Blg() | ||
NotExpect(t, "", v) | ||
} |
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,39 @@ | ||
package faker | ||
|
||
var ( | ||
carMakers = []string{"Acura", "Alfa Romeo", "Audi", "BMW", "Bentley", "Buick", "Cadillac", "Chevrolet", "Chrysler", "Dodge", "Fiat", "Ford", "GMC", "Genesis", "Honda", "Hyundai", "Infiniti", "Jaguar", "Jeep", "Kia", "Land Rover", "Lexus", "Lincoln", "Maserati", "Mazda", "Mercedes-Benz", "Mini", "Mitsubishi", "Nissan", "Polestar", "Porsche", "Ram", "Saab", "Smart", "Subaru", "Tesla", "Toyota", "Volkswagen", "Volvo"} | ||
carModels = []string{"Q3", "Malibu", "Escalade ESV", "Corvette", "RLX", "Silverado 2500 HD Crew Cab", "3 Series", "Pacifica", "Colorado Crew Cab", "X3", "TLX", "Silverado 3500 HD Crew Cab", "7 Series", "Fusion", "Envision", "SQ5", "R8", "Traverse", "MDX", "QX80", "Encore", "Sierra 2500 HD Crew Cab", "Insight", "XT6", "XT5", "XT4", "Enclave", "Q5", "Santa Fe", "EcoSport", "Escape", "Mustang", "Sonata", "Edge", "Camaro", "Kona Electric", "Equinox", "Sierra 3500 HD Crew Cab", "Gladiator", "X7", "CT6-V", "A7", "Blazer", "F150 SuperCrew Cab", "Suburban", "Civic", "Compass", "Escalade", "Voyager", "Accord Hybrid", "Terrain", "Spark", "Sierra 1500 Crew Cab", "NEXO", "Veloster", "Silverado 1500 Crew Cab", "G70", "CT5", "Odyssey", "Elantra GT", "RDX", "Yukon XL", "Ranger SuperCab", "Expedition MAX", "Kona", "QX50", "Durango", "Yukon", "Palisade", "Ridgeline", "Cherokee", "Bolt EV", "Expedition", "Elantra", "Passport", "Charger", "Accord", "QX60", "Venue", "Pilot", "Grand Cherokee", "Tahoe", "Acadia", "Impala", "CR-V", "X5", "Q60", "Ranger SuperCrew", "Trax", "Ioniq Plug-in Hybrid", "E-PACE", "Tucson", "Explorer", "HR-V", "I-PACE", "Q50", "G80", "F-PACE", "Renegade", "Accent"} | ||
carCategories = []string{"SUV", "Sedan", "Coupe", "Convertible", "Hatchback", "Pickup", "Van", "Minivan", "Wagon"} | ||
carFuelTypes = []string{"Bio Gas", "Diesel", "Eletric", "Ethanol", "Hybrid", "Petrol"} | ||
carTransmissionGears = []string{"Automatic", "CVT", "Eletronic", "Manual", "Semi-auto", "Tiptronic"} | ||
) | ||
|
||
// Car is a faker struct for Car | ||
type Car struct { | ||
Faker *Faker | ||
} | ||
|
||
// Maker will return a random car maker | ||
func (c Car) Maker() string { | ||
return c.Faker.RandomStringElement(carMakers) | ||
} | ||
|
||
// Model will return a random car model | ||
func (c Car) Model() string { | ||
return c.Faker.RandomStringElement(carModels) | ||
} | ||
|
||
// Category will return a random car category | ||
func (c Car) Category() string { | ||
return c.Faker.RandomStringElement(carCategories) | ||
} | ||
|
||
// FuelType will return a random car fuel type | ||
func (c Car) FuelType() string { | ||
return c.Faker.RandomStringElement(carFuelTypes) | ||
} | ||
|
||
// TransmissionGear will return a random car transmission gear | ||
func (c Car) TransmissionGear() string { | ||
return c.Faker.RandomStringElement(carTransmissionGears) | ||
} |
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,30 @@ | ||
package faker | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestCarMaker(t *testing.T) { | ||
v := New().Car().Maker() | ||
NotExpect(t, "", v) | ||
} | ||
|
||
func TestCarModel(t *testing.T) { | ||
v := New().Car().Model() | ||
NotExpect(t, "", v) | ||
} | ||
|
||
func TestCarCategory(t *testing.T) { | ||
v := New().Car().Category() | ||
NotExpect(t, "", v) | ||
} | ||
|
||
func TestCarFuelType(t *testing.T) { | ||
v := New().Car().FuelType() | ||
NotExpect(t, "", v) | ||
} | ||
|
||
func TestCarTransmissionGear(t *testing.T) { | ||
v := New().Car().TransmissionGear() | ||
NotExpect(t, "", v) | ||
} |
Oops, something went wrong.