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.

37 lines
863 B

  1. package idvalidator
  2. import "testing"
  3. // go test -v -cover -coverprofile=cover.out
  4. // go tool cover -func=cover.out
  5. // go tool cover -html=cover.out
  6. func TestFeature(t *testing.T) {
  7. // isValid1 := IsValid(FakeId())
  8. // if !isValid1 {
  9. // t.Errorf("`isValid1` must be true.")
  10. // }
  11. isValid2 := IsValid(FakeRequireId(true, "江苏省", "200001", 1))
  12. if !isValid2 {
  13. t.Errorf("`isValid2` must be true.")
  14. }
  15. _, err1 := GetInfo(FakeRequireId(true, "江苏省", "200001", 1))
  16. if err1 != nil {
  17. t.Errorf("`err1` must be nil.")
  18. }
  19. _, err2 := GetInfo(FakeRequireId(true, "江苏省", "200001", 1))
  20. if err2 != nil {
  21. t.Errorf("`err2` must be nil.")
  22. }
  23. upgradedId, err3 := UpgradeId("610104620927690")
  24. if err3 != nil {
  25. t.Errorf("`err3` must be nil.")
  26. }
  27. if len(upgradedId) != 18 {
  28. t.Errorf("`upgradedId` length must be 18.:%d", len(upgradedId))
  29. }
  30. }