Debian Codegraph @

str_test.go

raw symbols SCIP
1 package vt10xscip-go gomod github.com/hinshun/vt10x . `github.com/hinshun/vt10x`/
2
3 import (
4 "testingscip-go gomod github.com/golang/go/src go1.14 testing/"
5 )
6
7 func TestSTRParsescip-go gomod github.com/hinshun/vt10x . `github.com/hinshun/vt10x`/TestSTRParse().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) {
8 var str strEscapescip-go gomod github.com/hinshun/vt10x . `github.com/hinshun/vt10x`/strEscape#
9 str.resetscip-go gomod github.com/hinshun/vt10x . `github.com/hinshun/vt10x`/strEscape#reset().()
10 str.bufscip-go gomod github.com/hinshun/vt10x . `github.com/hinshun/vt10x`/strEscape#buf. = []rune("0;some text")
11 str.parsescip-go gomod github.com/hinshun/vt10x . `github.com/hinshun/vt10x`/strEscape#parse().()
12 if str.argscip-go gomod github.com/hinshun/vt10x . `github.com/hinshun/vt10x`/strEscape#arg().(0, 17) != 0 || str.argStringscip-go gomod github.com/hinshun/vt10x . `github.com/hinshun/vt10x`/strEscape#argString().(1, "") != "some text" {
13 t.Fatalscip-go gomod github.com/golang/go/src go1.14 testing/common#Fatal().("STR parse mismatch")
14 }
15 }
16
17 func TestParseColorscip-go gomod github.com/hinshun/vt10x . `github.com/hinshun/vt10x`/TestParseColor().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) {
18 type testCase struct {
19 name string
20 input string
21 r, g, b int
22 }
23
24 for _, tc := range []testCase{
25 {
26 "rgb 4 bit zero",
27 "rgb:0/0/0",
28 0, 0, 0,
29 },
30 {
31 "rgb 4 bit max",
32 "rgb:f/f/f",
33 255, 255, 255,
34 },
35 {
36 "rgb 4 bit values",
37 "rgb:1/2/3",
38 17, 34, 51,
39 },
40 {
41 "rgb 8 bit zero",
42 "rgb:00/00/00",
43 0, 0, 0,
44 },
45 {
46 "rgb 8 bit max",
47 "rgb:ff/ff/ff",
48 255, 255, 255,
49 },
50 {
51 "rgb 8 bit values",
52 "rgb:11/22/33",
53 17, 34, 51,
54 },
55 {
56 "rgb 12 bit zero",
57 "rgb:000/000/000",
58 0, 0, 0,
59 },
60 {
61 "rgb 12 bit max",
62 "rgb:fff/fff/fff",
63 255, 255, 255,
64 },
65 {
66 "rgb 12 bit values",
67 "rgb:111/222/333",
68 17, 34, 51,
69 },
70 {
71 "rgb 16 bit zero",
72 "rgb:0000/0000/0000",
73 0, 0, 0,
74 },
75 {
76 "rgb 16 bit max",
77 "rgb:ffff/ffff/ffff",
78 255, 255, 255,
79 },
80 {
81 "rgb 16 bit values",
82 "rgb:1111/2222/3333",
83 17, 34, 51,
84 },
85 {
86 "rgb 16 bit values",
87 "rgb:1111/2222/3333",
88 17, 34, 51,
89 },
90 {
91 "hash 4 bit zero",
92 "#000",
93 0, 0, 0,
94 },
95 {
96 "hash 4 bit max",
97 "#fff",
98 240, 240, 240,
99 },
100 {
101 "hash 4 bit values",
102 "#123",
103 16, 32, 48,
104 },
105 {
106 "hash 8 bit zero",
107 "#000000",
108 0, 0, 0,
109 },
110 {
111 "hash 8 bit max",
112 "#ffffff",
113 255, 255, 255,
114 },
115 {
116 "hash 8 bit values",
117 "#112233",
118 17, 34, 51,
119 },
120 {
121 "hash 12 bit zero",
122 "#000000000",
123 0, 0, 0,
124 },
125 {
126 "hash 12 bit max",
127 "#fffffffff",
128 255, 255, 255,
129 },
130 {
131 "hash 12 bit values",
132 "#111222333",
133 17, 34, 51,
134 },
135 {
136 "hash 16 bit zero",
137 "#000000000000",
138 0, 0, 0,
139 },
140 {
141 "hash 16 bit max",
142 "#ffffffffffff",
143 255, 255, 255,
144 },
145 {
146 "hash 16 bit values",
147 "#111122223333",
148 17, 34, 51,
149 },
150 {
151 "rgb upper case",
152 "RGB:0/A/F",
153 0, 170, 255,
154 },
155 {
156 "hash upper case",
157 "#FFF",
158 240, 240, 240,
159 },
160 } {
161 t.Runscip-go gomod github.com/golang/go/src go1.14 testing/T#Run().(tc.name, func(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) {
162 r, g, b, err := parseColorscip-go gomod github.com/hinshun/vt10x . `github.com/hinshun/vt10x`/parseColor().(tc.input)
163 if err != nil {
164 t.Fatalfscip-go gomod github.com/golang/go/src go1.14 testing/common#Fatalf().("failed to parse color: %s", err)
165 }
166
167 if r != tc.r || g != tc.g || b != tc.b {
168 t.Fatalfscip-go gomod github.com/golang/go/src go1.14 testing/common#Fatalf().("expected (%d, %d, %d), got (%d, %d, %d)", tc.r, tc.g, tc.b, r, g, b)
169 }
170 })
171 }
172 }