-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathargs_test.go
46 lines (43 loc) · 1.37 KB
/
args_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
package redists
import (
"testing"
"time"
)
func TestFilter_Arg(t *testing.T) {
if got, want := FilterEqual("l", "v").Arg(), "l=v"; got != want {
t.Errorf("FilterEqual() = %v, want %v", got, want)
}
if got, want := FilterEqual("l").Arg(), "l="; got != want {
t.Errorf("FilterEqual() = %v, want %v", got, want)
}
if got, want := FilterEqual("l", "v1", "v2").Arg(), "l=(v1,v2)"; got != want {
t.Errorf("FilterEqual() = %v, want %v", got, want)
}
if got, want := FilterNotEqual("l", "v").Arg(), "l!=v"; got != want {
t.Errorf("FilterNotEqual() = %v, want %v", got, want)
}
if got, want := FilterNotEqual("l").Arg(), "l!="; got != want {
t.Errorf("FilterNotEqual() = %v, want %v", got, want)
}
if got, want := FilterNotEqual("l", "v1", "v2").Arg(), "l!=(v1,v2)"; got != want {
t.Errorf("FilterNotEqual() = %v, want %v", got, want)
}
}
func Test_timestampArg(t *testing.T) {
var ts Timestamp = time.UnixMilli(100)
if got, want := timestampArg(ts), int64(100); got != want {
t.Errorf("Arg() = %v, want %v", got, want)
}
ts = TSMin()
if got, want := timestampArg(ts), "-"; got != want {
t.Errorf("Arg() = %v, want %v", got, want)
}
ts = TSMax()
if got, want := timestampArg(ts), "+"; got != want {
t.Errorf("Arg() = %v, want %v", got, want)
}
ts = TSAuto()
if got, want := timestampArg(ts), "*"; got != want {
t.Errorf("Arg() = %v, want %v", got, want)
}
}