Ejemplo n.º 1
0
func TestZipCodeReturns5DigitFormat(t *testing.T) {
	addr := Address{&Namer{}, test.ConstantRand(0)}

	zipCode := addr.ZipCode()
	if zipCode != "00000" {
		t.Fatal("Expected to return 5 digit zip code, but returned ", zipCode)
	}
}
Ejemplo n.º 2
0
func TestPrefixFirstNameLastNameWhenRandom0(t *testing.T) {
	namer := Namer{test.ConstantRand(0)}

	expectedName := fmt.Sprintf("%s %s %s", namePrefixes[0], firstNames[0], lastNames[0])
	if name := namer.Name(); name != expectedName {
		t.Fatal(name, "should have been", expectedName)
	}
}
Ejemplo n.º 3
0
func TestFirstNameLastNameWhenRandom2(t *testing.T) {
	namer := Namer{test.ConstantRand(2)}

	expectedName := fmt.Sprintf("%s %s", firstNames[2], lastNames[2])
	if name := namer.Name(); name != expectedName {
		t.Fatal(name, "should have been", expectedName)
	}
}
Ejemplo n.º 4
0
func TestCityLastNameWithSuffixOnly(t *testing.T) {
	rand := test.ConstantRand(3)
	namer := &Namer{rand}
	addr := Address{namer, rand}

	city := addr.City()
	expectedCity := fmt.Sprint(namer.LastName(), citySuffixes[3])
	if city != expectedCity {
		t.Fatal("Expected ", expectedCity, " but was ", city)
	}
}
Ejemplo n.º 5
0
func TestCityNameWithPrefixOnly(t *testing.T) {
	rand := test.ConstantRand(1)
	namer := &Namer{rand}
	addr := Address{namer, rand}

	city := addr.City()
	expectedCity := fmt.Sprint(cityPrefixes[1], " ", namer.FirstName())
	if city != expectedCity {
		t.Fatal("Expected ", expectedCity, " but was ", city)
	}
}
Ejemplo n.º 6
0
func TestCityNameLongForm(t *testing.T) {
	rand := test.ConstantRand(0)
	namer := &Namer{rand}
	addr := Address{namer, rand}

	city := addr.City()
	expectedCity := fmt.Sprint(cityPrefixes[0], " ", namer.FirstName(), citySuffixes[0])
	if city != expectedCity {
		t.Fatal("Expected ", expectedCity, " but was ", city)
	}
}