@@ -30,31 +30,72 @@ describe('BITOP', () => {
30
30
cluster : GLOBAL . CLUSTERS . OPEN
31
31
} ) ;
32
32
33
- testUtils . testWithClientIfVersionWithinRange ( [ [ 8 , 2 ] , 'LATEST' ] , 'bitOp DIFF' , async client => {
33
+ testUtils . testWithClientIfVersionWithinRange ( [ [ 8 , 2 ] , 'LATEST' ] , 'bitOp DIFF with non-existing keys ' , async client => {
34
34
assert . equal (
35
- await client . bitOp ( 'DIFF' , '{tag} destKey' , [ '{tag}key ' , '{tag} key2' ] ) ,
35
+ await client . bitOp ( 'DIFF' , 'destKey' , [ 'key1 ' , 'key2' ] ) ,
36
36
0
37
37
) ;
38
38
} , GLOBAL . SERVERS . OPEN ) ;
39
39
40
- testUtils . testWithClientIfVersionWithinRange ( [ [ 8 , 2 ] , 'LATEST' ] , 'bitOp DIFF1' , async client => {
40
+ testUtils . testWithClientIfVersionWithinRange ( [ [ 8 , 2 ] , 'LATEST' ] , 'bitOp AND with existing keys' , async client => {
41
+ await client . set ( 'key1' , 'value1' ) ;
42
+ await client . set ( 'key2' , 'value2' ) ;
43
+
44
+
45
+ assert . equal (
46
+ await client . bitOp ( 'AND' , 'destKey' , [ 'key1' , 'key2' ] ) ,
47
+ 6
48
+ ) ;
49
+ } , GLOBAL . SERVERS . OPEN ) ;
50
+
51
+ testUtils . testWithClientIfVersionWithinRange ( [ [ 8 , 2 ] , 'LATEST' ] , 'bitOp DIFF1 with non-existing keys' , async client => {
41
52
assert . equal (
42
- await client . bitOp ( 'DIFF1' , '{tag} destKey' , [ '{tag}key ' , '{tag} key2' ] ) ,
53
+ await client . bitOp ( 'DIFF1' , 'destKey' , [ 'key1 ' , 'key2' ] ) ,
43
54
0
44
55
) ;
45
56
} , GLOBAL . SERVERS . OPEN ) ;
46
57
47
- testUtils . testWithClientIfVersionWithinRange ( [ [ 8 , 2 ] , 'LATEST' ] , 'bitOp ANDOR' , async client => {
58
+ testUtils . testWithClientIfVersionWithinRange ( [ [ 8 , 2 ] , 'LATEST' ] , 'bitOp OR with existing keys' , async client => {
59
+ await client . set ( 'key1' , 'value1' ) ;
60
+ await client . set ( 'key2' , 'value2' ) ;
61
+
62
+ assert . equal (
63
+ await client . bitOp ( 'OR' , 'destKey' , [ 'key1' , 'key2' ] ) ,
64
+ 6
65
+ ) ;
66
+ } , GLOBAL . SERVERS . OPEN ) ;
67
+
68
+ testUtils . testWithClientIfVersionWithinRange ( [ [ 8 , 2 ] , 'LATEST' ] , 'bitOp ANDOR with non-existing keys' , async client => {
48
69
assert . equal (
49
- await client . bitOp ( 'ANDOR' , '{tag} destKey' , [ '{tag}key ' , '{tag} key2' , '{tag}key3 '] ) ,
70
+ await client . bitOp ( 'ANDOR' , 'destKey' , [ 'key1 ' , 'key2' ] ) ,
50
71
0
51
72
) ;
52
73
} , GLOBAL . SERVERS . OPEN ) ;
53
74
54
- testUtils . testWithClientIfVersionWithinRange ( [ [ 8 , 2 ] , 'LATEST' ] , 'bitOp ONE' , async client => {
75
+ testUtils . testWithClientIfVersionWithinRange ( [ [ 8 , 2 ] , 'LATEST' ] , 'bitOp XOR with existing keys' , async client => {
76
+ await client . set ( 'key1' , 'value1' ) ;
77
+ await client . set ( 'key2' , 'value2' ) ;
78
+
79
+ assert . equal (
80
+ await client . bitOp ( 'XOR' , 'destKey' , [ 'key1' , 'key2' ] ) ,
81
+ 6
82
+ ) ;
83
+ } , GLOBAL . SERVERS . OPEN ) ;
84
+
85
+ testUtils . testWithClientIfVersionWithinRange ( [ [ 8 , 2 ] , 'LATEST' ] , 'bitOp ONE with non-existing keys' , async client => {
55
86
assert . equal (
56
- await client . bitOp ( 'ONE' , '{tag} destKey' , [ '{tag}key ' , '{tag} key2' ] ) ,
87
+ await client . bitOp ( 'ONE' , 'destKey' , [ 'key1 ' , 'key2' ] ) ,
57
88
0
58
89
) ;
59
90
} , GLOBAL . SERVERS . OPEN ) ;
91
+
92
+ testUtils . testWithClientIfVersionWithinRange ( [ [ 8 , 2 ] , 'LATEST' ] , 'bitOp ONE with existing keys' , async client => {
93
+ await client . set ( 'key1' , 'value1' ) ;
94
+ await client . set ( 'key2' , 'value2' ) ;
95
+
96
+ assert . equal (
97
+ await client . bitOp ( 'ONE' , '{tag}destKey' , [ 'key1' , 'key2' ] ) ,
98
+ 6
99
+ ) ;
100
+ } , GLOBAL . SERVERS . OPEN ) ;
60
101
} ) ;
0 commit comments