You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
goverify/gopreg_test.go

104 lines
2.4 KiB

package goverify
import (
"fmt"
"testing"
)
// TestChinaMobile 验证手机号码
func TestChinaMobile(t *testing.T) {
for i := 1; i <= 1; i++ {
for ii := 0; ii <= 9; ii++ {
for iii := 0; iii <= 9; iii++ {
one := i
two := ii
three := iii
number := fmt.Sprintf("%d%d%d00138000", one, two, three)
status, operator := ChinaMobile(number)
t.Logf("[%s]%s 状态:%v", operator, number, status)
}
}
}
}
func BenchmarkChinaMobile(b *testing.B) {
for i := 0; i < b.N; i++ {
}
}
// TestChinaMobileNumber 验证中国移动手机号码
func TestChinaMobileNumber(t *testing.T) {
for i := 1; i <= 1; i++ {
for ii := 0; ii <= 9; ii++ {
for iii := 0; iii <= 9; iii++ {
one := i
two := ii
three := iii
number := fmt.Sprintf("%d%d%d00138000", one, two, three)
t.Logf("[中国移动]%s 状态:%v", number, ChinaMobileNumber(number))
}
}
}
}
// TestChinaUnicomNumber 验证中国联通手机号码
func TestChinaUnicomNumber(t *testing.T) {
for i := 1; i <= 1; i++ {
for ii := 0; ii <= 9; ii++ {
for iii := 0; iii <= 9; iii++ {
one := i
two := ii
three := iii
number := fmt.Sprintf("%d%d%d00138000", one, two, three)
t.Logf("[中国联通]%s 状态:%v", number, ChinaUnicomNumber(number))
}
}
}
}
// TestChinaTelecomNumber 验证中国电信手机号码
func TestChinaTelecomNumber(t *testing.T) {
for i := 1; i <= 1; i++ {
for ii := 0; ii <= 9; ii++ {
for iii := 0; iii <= 9; iii++ {
one := i
two := ii
three := iii
number := fmt.Sprintf("%d%d%d00138000", one, two, three)
t.Logf("[中国电信]%s 状态:%v", number, ChinaTelecomNumber(number))
}
}
}
}
// TestChinaBroadnetNumber 验证中国广电手机号码
func TestChinaBroadnetNumber(t *testing.T) {
for i := 1; i <= 1; i++ {
for ii := 0; ii <= 9; ii++ {
for iii := 0; iii <= 9; iii++ {
one := i
two := ii
three := iii
number := fmt.Sprintf("%d%d%d00138000", one, two, three)
t.Logf("[中国广电]%s 状态:%v", number, ChinaBroadnetNumber(number))
}
}
}
}
// TestChinaVirtualNumber 验证虚拟运营商手机号码
func TestChinaVirtualNumber(t *testing.T) {
for i := 1; i <= 1; i++ {
for ii := 0; ii <= 9; ii++ {
for iii := 0; iii <= 9; iii++ {
one := i
two := ii
three := iii
number := fmt.Sprintf("%d%d%d00138000", one, two, three)
t.Logf("[虚拟运营商]%s 状态:%v", number, ChinaVirtualNumber(number))
}
}
}
}