gitee.com/gricks/utils@v1.0.8/idcard_test.go (about)

     1  package utils
     2  
     3  import (
     4  	"testing"
     5  
     6  	. "github.com/smartystreets/goconvey/convey"
     7  )
     8  
     9  var idCardTest = []string{
    10  	"35070118550215464X",
    11  	"33041118360426312X",
    12  	"210322188803154101",
    13  	"532131187907073370",
    14  	"410601195110293456",
    15  	"371321189602211484",
    16  	"612724192806010376",
    17  	"140827201006287416",
    18  	"410622187205252077",
    19  	"232304196307115480",
    20  	"513436201412275265",
    21  }
    22  
    23  func TestVerifyIDCard(t *testing.T) {
    24  	Convey("verifyIDCardCode", t, func() {
    25  		for _, v := range idCardTest {
    26  			So(verifyIDCardCode([]byte(v)), ShouldBeTrue)
    27  		}
    28  	})
    29  
    30  	Convey("verifyIDCardBirthday", t, func() {
    31  		for _, v := range idCardTest {
    32  			So(verifyIDCardBirthday([]byte(v)), ShouldBeTrue)
    33  		}
    34  	})
    35  
    36  	Convey("VerifyIDCard", t, func() {
    37  		for _, v := range idCardTest {
    38  			So(VerifyIDCard(v), ShouldBeTrue)
    39  		}
    40  	})
    41  }