phone number
parent
5082385fb5
commit
b8ede4166a
|
@ -2,5 +2,12 @@ package arbitrary
|
||||||
|
|
||||||
// PhoneNumber returns an arbitrary phone‐number.
|
// PhoneNumber returns an arbitrary phone‐number.
|
||||||
func (arb T) PhoneNumber() string {
|
func (arb T) PhoneNumber() string {
|
||||||
return arb.phonenumber_canada()
|
|
||||||
|
var funcs []func()string = []func()string{
|
||||||
|
arb.phonenumber_canada,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn := funcs[arb.randomness.Intn(len(funcs))]
|
||||||
|
|
||||||
|
return fn()
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,33 +75,33 @@ func (arb T) phonenumber_canada() string {
|
||||||
areacode = areacodes[arb.randomness.Intn(len(areacodes))]
|
areacode = areacodes[arb.randomness.Intn(len(areacodes))]
|
||||||
}
|
}
|
||||||
|
|
||||||
var localpart1 string
|
var localpart1 int
|
||||||
{
|
{
|
||||||
localpart1 = fmt.Sprint(arb.randomness.Intn(1000))
|
localpart1 = arb.randomness.Intn(1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
var localpart2 string
|
var localpart2 int
|
||||||
{
|
{
|
||||||
localpart2 = fmt.Sprint(arb.randomness.Intn(10000))
|
localpart2 = arb.randomness.Intn(10000)
|
||||||
}
|
}
|
||||||
|
|
||||||
var format string
|
var format string
|
||||||
{
|
{
|
||||||
var formats []string = []string{
|
var formats []string = []string{
|
||||||
"%s-%s%s",
|
"%s-%03d%04d",
|
||||||
"%s-%s-%s",
|
"%s-%03d-%04d",
|
||||||
"%s %s %s",
|
"%s %03d %04d",
|
||||||
"%s %s%s",
|
"%s %03d%04d",
|
||||||
"(%s) %s%s",
|
"(%s) %03d%04d",
|
||||||
"(%s)%s%s",
|
"(%s)%03d%04d",
|
||||||
"(%s) %s-%s",
|
"(%s) %03d-%04d",
|
||||||
"(%s)%s-%s",
|
"(%s)%03d-%04d",
|
||||||
"(%s) %s %s",
|
"(%s) %03d %04d",
|
||||||
"(%s)%s %s",
|
"(%s)%03d %04d",
|
||||||
"%s/%s-%s",
|
"%s/%03d-%04d",
|
||||||
"+1%s%s%s",
|
"+1%s%03d%04d",
|
||||||
"+1-%s-%s-%s",
|
"+1-%s-%03d-%04d",
|
||||||
"+1 %s %s %s",
|
"+1 %s %03d %04d",
|
||||||
}
|
}
|
||||||
|
|
||||||
format = formats[arb.randomness.Intn(len(formats))]
|
format = formats[arb.randomness.Intn(len(formats))]
|
||||||
|
|
Loading…
Reference in New Issue