-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathtype_test.go
More file actions
45 lines (40 loc) · 988 Bytes
/
type_test.go
File metadata and controls
45 lines (40 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* Go IPP - IPP core protocol implementation in pure Go
*
* Copyright (C) 2020 and up by Alexander Pevzner (pzz@apevzner.com)
* See LICENSE for license terms and conditions
*
* Tests for enumeration of value types
*/
package goipp
import "testing"
// TestTypeString tests Type.String function
func TestTypeString(t *testing.T) {
type testData struct {
ty Type // Input Type
s string // Expected output string
}
tests := []testData{
{TypeInvalid, "Invalid"},
{TypeVoid, "Void"},
{TypeBoolean, "Boolean"},
{TypeString, "String"},
{TypeDateTime, "DateTime"},
{TypeResolution, "Resolution"},
{TypeRange, "Range"},
{TypeTextWithLang, "TextWithLang"},
{TypeBinary, "Binary"},
{TypeCollection, "Collection"},
{0x1234, "0x1234"},
}
for _, test := range tests {
s := test.ty.String()
if s != test.s {
t.Errorf("testing Type.String:\n"+
"input: %d\n"+
"expected: %s\n"+
"present: %s\n",
int(test.ty), test.s, s,
)
}
}
}