-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutil_test.go
59 lines (51 loc) · 1.15 KB
/
util_test.go
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2013 The GoGL2 Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE.mkd file.
package main
import (
"testing"
)
type testEnumPrefix struct {
In string
Out string
}
type testCamelCase struct {
In string
Out string
}
var allTestsEnumPrefix = []testEnumPrefix{
{"", ""},
{"_", "_"},
{"GL_", ""},
{"GL_bla", "bla"},
{"GL123", "GL123"},
{"GL_0123", "GL_0123"},
{"GL", "GL"},
}
var allTestsCamelCase = []testCamelCase{
{"", ""},
{"_", ""},
{"ARB_multisample", "ARBMultisample"},
{"vertex_array_object", "VertexArrayObject"},
{"a_b_c_", "ABC"},
{"ABC", "ABC"},
{"1_2_", "12"},
}
func TestCamelCase(t *testing.T) {
for i := range allTestsCamelCase {
te := &allTestsCamelCase[i]
cc := CamelCase(te.In)
if cc != te.Out {
t.Errorf("CamelCase() failed: %s -> %s (%s != %s)", te.In, te.Out, cc, te.Out)
}
}
}
func TestEnumPrefix(t *testing.T) {
for i := range allTestsEnumPrefix {
te := &allTestsEnumPrefix[i]
tr := TrimGLEnumPrefix(te.In)
if tr != te.Out {
t.Errorf("TrimGLEnumPrefix() failed: %s -> %s (%s != %s)", te.In, te.Out, tr, te.Out)
}
}
}