-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgodis_test.go
56 lines (48 loc) · 1.2 KB
/
godis_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
package godis
func setUp() *Godis {
return NewGodis()
}
type Case struct {
key string
value string
}
type Pattern struct {
regex string
result []string
}
var cases = []Case{
{"key1", "value1"},
{"key2", "value2"},
{"key 3", "value 3"}, // keys with spaces
{"மொழி", "தமிழ்"}, // unicode
{"key1", "new value 1"}, // overwrite a key
/*{"tested", true}, // boolean value
{"test_num", 7}, // int value
{"PI", 3.14}, // float value
*/
}
var integers = []Case{
{"int", "234"},
{"long", "223344231"},
{"negative", "-554"},
{"zero", "0"},
}
var floats = []Case{
{"flt64", "22423234.1223"},
{"flt32", "443.21"},
{"fltExp", "123.34e23"},
{"negative", "-123.34e23"},
{"zero", "0"},
}
// Search patterns and expected results
var patterns = []Pattern{
{"h?llo", []string{"hullo", "hyllo", "hvllo", "heeeello", "hello", "hallo"}},
{"hello", []string{"hello"}},
{"h[u-z]llo", []string{"hullo", "hvllo", "hyllo"}},
{"he*llo", []string{"hello", "heeeello"}},
{"h[ae]llo", []string{"hello", "hallo"}},
{"h[^e]llo", []string{"hullo", "hvllo", "hyllo", "hallo"}},
}
// var strings = []Case{
// {"மொழி", "தமிழ்"}, // value with string
// }