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