1package conv 2 3import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 8 "github.com/go-openapi/strfmt" 9) 10 11func TestBase64Value(t *testing.T) { 12 assert.Equal(t, strfmt.Base64(nil), Base64Value(nil)) 13 base64 := strfmt.Base64([]byte{4, 2}) 14 assert.Equal(t, base64, Base64Value(&base64)) 15} 16 17func TestURIValue(t *testing.T) { 18 assert.Equal(t, strfmt.URI(""), URIValue(nil)) 19 value := strfmt.URI("foo") 20 assert.Equal(t, value, URIValue(&value)) 21} 22 23func TestEmailValue(t *testing.T) { 24 assert.Equal(t, strfmt.Email(""), EmailValue(nil)) 25 value := strfmt.Email("foo") 26 assert.Equal(t, value, EmailValue(&value)) 27} 28 29func TestHostnameValue(t *testing.T) { 30 assert.Equal(t, strfmt.Hostname(""), HostnameValue(nil)) 31 value := strfmt.Hostname("foo") 32 assert.Equal(t, value, HostnameValue(&value)) 33} 34 35func TestIPv4Value(t *testing.T) { 36 assert.Equal(t, strfmt.IPv4(""), IPv4Value(nil)) 37 value := strfmt.IPv4("foo") 38 assert.Equal(t, value, IPv4Value(&value)) 39} 40 41func TestIPv6Value(t *testing.T) { 42 assert.Equal(t, strfmt.IPv6(""), IPv6Value(nil)) 43 value := strfmt.IPv6("foo") 44 assert.Equal(t, value, IPv6Value(&value)) 45} 46 47func TestCIDRValue(t *testing.T) { 48 assert.Equal(t, strfmt.CIDR(""), CIDRValue(nil)) 49 value := strfmt.CIDR("foo") 50 assert.Equal(t, value, CIDRValue(&value)) 51} 52 53func TestMACValue(t *testing.T) { 54 assert.Equal(t, strfmt.MAC(""), MACValue(nil)) 55 value := strfmt.MAC("foo") 56 assert.Equal(t, value, MACValue(&value)) 57} 58 59func TestUUIDValue(t *testing.T) { 60 assert.Equal(t, strfmt.UUID(""), UUIDValue(nil)) 61 value := strfmt.UUID("foo") 62 assert.Equal(t, value, UUIDValue(&value)) 63} 64 65func TestUUID3Value(t *testing.T) { 66 assert.Equal(t, strfmt.UUID3(""), UUID3Value(nil)) 67 value := strfmt.UUID3("foo") 68 assert.Equal(t, value, UUID3Value(&value)) 69} 70 71func TestUUID4Value(t *testing.T) { 72 assert.Equal(t, strfmt.UUID4(""), UUID4Value(nil)) 73 value := strfmt.UUID4("foo") 74 assert.Equal(t, value, UUID4Value(&value)) 75} 76 77func TestUUID5Value(t *testing.T) { 78 assert.Equal(t, strfmt.UUID5(""), UUID5Value(nil)) 79 value := strfmt.UUID5("foo") 80 assert.Equal(t, value, UUID5Value(&value)) 81} 82 83func TestISBNValue(t *testing.T) { 84 assert.Equal(t, strfmt.ISBN(""), ISBNValue(nil)) 85 value := strfmt.ISBN("foo") 86 assert.Equal(t, value, ISBNValue(&value)) 87} 88 89func TestISBN10Value(t *testing.T) { 90 assert.Equal(t, strfmt.ISBN10(""), ISBN10Value(nil)) 91 value := strfmt.ISBN10("foo") 92 assert.Equal(t, value, ISBN10Value(&value)) 93} 94 95func TestISBN13Value(t *testing.T) { 96 assert.Equal(t, strfmt.ISBN13(""), ISBN13Value(nil)) 97 value := strfmt.ISBN13("foo") 98 assert.Equal(t, value, ISBN13Value(&value)) 99} 100 101func TestCreditCardValue(t *testing.T) { 102 assert.Equal(t, strfmt.CreditCard(""), CreditCardValue(nil)) 103 value := strfmt.CreditCard("foo") 104 assert.Equal(t, value, CreditCardValue(&value)) 105} 106 107func TestSSNValue(t *testing.T) { 108 assert.Equal(t, strfmt.SSN(""), SSNValue(nil)) 109 value := strfmt.SSN("foo") 110 assert.Equal(t, value, SSNValue(&value)) 111} 112 113func TestHexColorValue(t *testing.T) { 114 assert.Equal(t, strfmt.HexColor(""), HexColorValue(nil)) 115 value := strfmt.HexColor("foo") 116 assert.Equal(t, value, HexColorValue(&value)) 117} 118 119func TestRGBColorValue(t *testing.T) { 120 assert.Equal(t, strfmt.RGBColor(""), RGBColorValue(nil)) 121 value := strfmt.RGBColor("foo") 122 assert.Equal(t, value, RGBColorValue(&value)) 123} 124 125func TestPasswordValue(t *testing.T) { 126 assert.Equal(t, strfmt.Password(""), PasswordValue(nil)) 127 value := strfmt.Password("foo") 128 assert.Equal(t, value, PasswordValue(&value)) 129} 130