예제 #1
0
func TestProducts(t *testing.T) {
	for _, lang := range faker.GetLangs() {
		faker.SetLang(lang)

		v := faker.Brand()
		if v == "" {
			t.Errorf("Brand failed with lang %s", lang)
		}

		v = faker.ProductName()
		if v == "" {
			t.Errorf("ProductName failed with lang %s", lang)
		}

		v = faker.Product()
		if v == "" {
			t.Errorf("Product failed with lang %s", lang)
		}

		v = faker.Model()
		if v == "" {
			t.Errorf("Model failed with lang %s", lang)
		}
	}
}
예제 #2
0
func TestGeo(t *testing.T) {
	for _, lang := range faker.GetLangs() {
		faker.SetLang(lang)

		f := faker.Latitute()
		if f == 0 {
			t.Errorf("Latitude failed with lang %s", lang)
		}

		i := faker.LatitudeDegress()
		if i < -180 || i > 180 {
			t.Errorf("LatitudeDegress failed with lang %s", lang)
		}

		i = faker.LatitudeMinutes()
		if i < 0 || i >= 60 {
			t.Errorf("LatitudeMinutes failed with lang %s", lang)
		}

		i = faker.LatitudeSeconds()
		if i < 0 || i >= 60 {
			t.Errorf("LatitudeSeconds failed with lang %s", lang)
		}

		s := faker.LatitudeDirection()
		if s != "N" && s != "S" {
			t.Errorf("LatitudeDirection failed with lang %s", lang)
		}

		f = faker.Longitude()
		if f == 0 {
			t.Errorf("Longitude failed with lang %s", lang)
		}

		i = faker.LongitudeDegrees()
		if i < -180 || i > 180 {
			t.Errorf("LongitudeDegrees failed with lang %s", lang)
		}

		i = faker.LongitudeMinutes()
		if i < 0 || i >= 60 {
			t.Errorf("LongitudeMinutes failed with lang %s", lang)
		}

		i = faker.LongitudeSeconds()
		if i < 0 || i >= 60 {
			t.Errorf("LongitudeSeconds failed with lang %s", lang)
		}

		s = faker.LongitudeDirection()
		if s != "W" && s != "E" {
			t.Errorf("LongitudeDirection failed with lang %s", lang)
		}
	}
}
예제 #3
0
func TestAddresses(t *testing.T) {
	for _, lang := range faker.GetLangs() {
		faker.SetLang(lang)

		v := faker.Continent()
		if v == "" {
			t.Errorf("Continent failed with lang %s", lang)
		}

		v = faker.Country()
		if v == "" {
			t.Errorf("Country failed with lang %s", lang)
		}

		v = faker.City()
		if v == "" {
			t.Errorf("City failed with lang %s", lang)
		}

		v = faker.State()
		if v == "" {
			t.Errorf("State failed with lang %s", lang)
		}

		v = faker.StateAbbrev()
		if v == "" && lang == "en" {
			t.Errorf("StateAbbrev failed with lang %s", lang)
		}

		v = faker.Street()
		if v == "" {
			t.Errorf("Street failed with lang %s", lang)
		}

		v = faker.StreetAddress()
		if v == "" {
			t.Errorf("StreetAddress failed with lang %s", lang)
		}

		v = faker.Zip()
		if v == "" {
			t.Errorf("Zip failed with lang %s", lang)
		}

		v = faker.Phone()
		if v == "" {
			t.Errorf("Phone failed with lang %s", lang)
		}
	}
}
예제 #4
0
func TestCurrencies(t *testing.T) {
	for _, lang := range faker.GetLangs() {
		faker.SetLang(lang)

		v := faker.Currency()
		if v == "" {
			t.Errorf("Currency failed with lang %s", lang)
		}

		v = faker.CurrencyCode()
		if v == "" {
			t.Errorf("CurrencyCode failed with lang %s", lang)
		}
	}
}
예제 #5
0
func TestInternet(t *testing.T) {
	for _, lang := range faker.GetLangs() {
		faker.SetLang(lang)

		v := faker.UserName()
		if v == "" {
			t.Errorf("UserName failed with lang %s", lang)
		}

		v = faker.TopLevelDomain()
		if v == "" {
			t.Errorf("TopLevelDomain failed with lang %s", lang)
		}

		v = faker.DomainName()
		if v == "" {
			t.Errorf("DomainName failed with lang %s", lang)
		}

		v = faker.EmailAddress()
		if v == "" {
			t.Errorf("EmailAddress failed with lang %s", lang)
		}

		v = faker.EmailSubject()
		if v == "" {
			t.Errorf("EmailSubject failed with lang %s", lang)
		}

		v = faker.EmailBody()
		if v == "" {
			t.Errorf("EmailBody failed with lang %s", lang)
		}

		v = faker.DomainZone()
		if v == "" {
			t.Errorf("DomainZone failed with lang %s", lang)
		}

		v = faker.IPv4()
		if v == "" {
			t.Errorf("IPv4 failed with lang %s", lang)
		}
	}
}
예제 #6
0
func TestPersonal(t *testing.T) {
	for _, lang := range faker.GetLangs() {
		faker.SetLang(lang)

		v := faker.Gender()
		if v == "" {
			t.Errorf("Gender failed with lang %s", lang)
		}

		v = faker.GenderAbbrev()
		if v == "" {
			t.Errorf("GenderAbbrev failed with lang %s", lang)
		}

		v = faker.Language()
		if v == "" {
			t.Errorf("Language failed with lang %s", lang)
		}
	}
}
예제 #7
0
func TestJobs(t *testing.T) {
	for _, lang := range faker.GetLangs() {
		faker.SetLang(lang)

		v := faker.Company()
		if v == "" {
			t.Errorf("Company failed with lang %s", lang)
		}

		v = faker.JobTitle()
		if v == "" {
			t.Errorf("JobTitle failed with lang %s", lang)
		}

		v = faker.Industry()
		if v == "" {
			t.Errorf("Industry failed with lang %s", lang)
		}
	}
}
예제 #8
0
func TestCreditCards(t *testing.T) {
	for _, lang := range faker.GetLangs() {
		faker.SetLang(lang)

		v := faker.CreditCardType()
		if v == "" {
			t.Errorf("CreditCardType failed with lang %s", lang)
		}

		v = faker.CreditCardNum("")
		if v == "" {
			t.Errorf("CreditCardNum failed with lang %s", lang)
		}

		v = faker.CreditCardNum("visa")
		if v == "" {
			t.Errorf("CreditCardNum failed with lang %s", lang)
		}
	}
}
예제 #9
0
func TestDates(t *testing.T) {
	for _, lang := range faker.GetLangs() {
		faker.SetLang(lang)

		v := faker.WeekDay()
		if v == "" {
			t.Errorf("WeekDay failed with lang %s", lang)
		}

		v = faker.WeekDayShort()
		if v == "" {
			t.Errorf("WeekDayShort failed with lang %s", lang)
		}

		n := faker.WeekdayNum()
		if n < 0 || n > 7 {
			t.Errorf("WeekdayNum failed with lang %s", lang)
		}

		v = faker.Month()
		if v == "" {
			t.Errorf("Month failed with lang %s", lang)
		}

		v = faker.MonthShort()
		if v == "" {
			t.Errorf("MonthShort failed with lang %s", lang)
		}

		n = faker.MonthNum()
		if n < 0 || n > 31 {
			t.Errorf("MonthNum failed with lang %s", lang)
		}

		n = faker.Year(1950, 2020)
		if n < 1950 || n > 2020 {
			t.Errorf("Year failed with lang %s", lang)
		}
	}
}
예제 #10
0
func TestGeneral(t *testing.T) {
	for _, lang := range faker.GetLangs() {
		faker.SetLang(lang)

		v := faker.Password(4, 10, true, true, true)
		if v == "" {
			t.Errorf("Password failed with lang %s", lang)
		}

		v = faker.SimplePassword()
		if v == "" {
			t.Errorf("SimplePassword failed with lang %s", lang)
		}

		v = faker.Color()
		if v == "" {
			t.Errorf("Color failed with lang %s", lang)
		}

		v = faker.HexColor()
		if v == "" {
			t.Errorf("HexColor failed with lang %s", lang)
		}

		v = faker.HexColorShort()
		if v == "" {
			t.Errorf("HexColorShort failed with lang %s", lang)
		}

		v = faker.DigitsN(2)
		if v == "" {
			t.Errorf("DigitsN failed with lang %s", lang)
		}

		v = faker.Digits()
		if v == "" {
			t.Errorf("Digits failed with lang %s", lang)
		}
	}
}
예제 #11
0
func TestLoremIpsum(t *testing.T) {
	for _, lang := range faker.GetLangs() {
		faker.SetLang(lang)

		v := faker.Character()
		if v == "" {
			t.Errorf("Character failed with lang %s", lang)
		}

		v = faker.CharactersN(2)
		if v == "" {
			t.Errorf("CharactersN failed with lang %s", lang)
		}

		v = faker.Characters()
		if v == "" {
			t.Errorf("Characters failed with lang %s", lang)
		}

		v = faker.Word()
		if v == "" {
			t.Errorf("Word failed with lang %s", lang)
		}

		v = faker.WordsN(2)
		if v == "" {
			t.Errorf("WordsN failed with lang %s", lang)
		}

		v = faker.Words()
		if v == "" {
			t.Errorf("Words failed with lang %s", lang)
		}

		v = faker.Title()
		if v == "" {
			t.Errorf("Title failed with lang %s", lang)
		}

		v = faker.Sentence()
		if v == "" {
			t.Errorf("Sentence failed with lang %s", lang)
		}

		v = faker.SentencesN(2)
		if v == "" {
			t.Errorf("SentencesN failed with lang %s", lang)
		}

		v = faker.Sentences()
		if v == "" {
			t.Errorf("Sentences failed with lang %s", lang)
		}

		v = faker.Paragraph()
		if v == "" {
			t.Errorf("Paragraph failed with lang %s", lang)
		}

		v = faker.ParagraphsN(2)
		if v == "" {
			t.Errorf("ParagraphsN failed with lang %s", lang)
		}

		v = faker.Paragraphs()
		if v == "" {
			t.Errorf("Paragraphs failed with lang %s", lang)
		}
	}
}