@@ -1469,6 +1469,82 @@ var _ = Describe("Commands", func() {
14691469 Expect (get .Val ()).To (Equal ("\xf0 " ))
14701470 })
14711471
1472+ It ("should BitOpDiff" , Label ("NonRedisEnterprise" ), func () {
1473+ SkipBeforeRedisVersion (8.2 , "BITOP DIFF is available since Redis 8.2" )
1474+ set := client .Set (ctx , "key1" , "\xff " , 0 )
1475+ Expect (set .Err ()).NotTo (HaveOccurred ())
1476+ Expect (set .Val ()).To (Equal ("OK" ))
1477+
1478+ set = client .Set (ctx , "key2" , "\x0f " , 0 )
1479+ Expect (set .Err ()).NotTo (HaveOccurred ())
1480+ Expect (set .Val ()).To (Equal ("OK" ))
1481+
1482+ bitOpDiff := client .BitOpDiff (ctx , "dest" , "key1" , "key2" )
1483+ Expect (bitOpDiff .Err ()).NotTo (HaveOccurred ())
1484+ Expect (bitOpDiff .Val ()).To (Equal (int64 (1 )))
1485+
1486+ get := client .Get (ctx , "dest" )
1487+ Expect (get .Err ()).NotTo (HaveOccurred ())
1488+ Expect (get .Val ()).To (Equal ("\xf0 " ))
1489+ })
1490+
1491+ It ("should BitOpDiff1" , Label ("NonRedisEnterprise" ), func () {
1492+ SkipBeforeRedisVersion (8.2 , "BITOP DIFF is available since Redis 8.2" )
1493+ set := client .Set (ctx , "key1" , "\xff " , 0 )
1494+ Expect (set .Err ()).NotTo (HaveOccurred ())
1495+ Expect (set .Val ()).To (Equal ("OK" ))
1496+
1497+ set = client .Set (ctx , "key2" , "\x0f " , 0 )
1498+ Expect (set .Err ()).NotTo (HaveOccurred ())
1499+ Expect (set .Val ()).To (Equal ("OK" ))
1500+
1501+ bitOpDiff1 := client .BitOpDiff1 (ctx , "dest" , "key1" , "key2" )
1502+ Expect (bitOpDiff1 .Err ()).NotTo (HaveOccurred ())
1503+ Expect (bitOpDiff1 .Val ()).To (Equal (int64 (1 )))
1504+
1505+ get := client .Get (ctx , "dest" )
1506+ Expect (get .Err ()).NotTo (HaveOccurred ())
1507+ Expect (get .Val ()).To (Equal ("\x00 " ))
1508+ })
1509+
1510+ It ("should BitOpAndOr" , Label ("NonRedisEnterprise" ), func () {
1511+ SkipBeforeRedisVersion (8.2 , "BITOP ANDOR is available since Redis 8.2" )
1512+ set := client .Set (ctx , "key1" , "\xff " , 0 )
1513+ Expect (set .Err ()).NotTo (HaveOccurred ())
1514+ Expect (set .Val ()).To (Equal ("OK" ))
1515+
1516+ set = client .Set (ctx , "key2" , "\x0f " , 0 )
1517+ Expect (set .Err ()).NotTo (HaveOccurred ())
1518+ Expect (set .Val ()).To (Equal ("OK" ))
1519+
1520+ bitOpAndOr := client .BitOpAndOr (ctx , "dest" , "key1" , "key2" )
1521+ Expect (bitOpAndOr .Err ()).NotTo (HaveOccurred ())
1522+ Expect (bitOpAndOr .Val ()).To (Equal (int64 (1 )))
1523+
1524+ get := client .Get (ctx , "dest" )
1525+ Expect (get .Err ()).NotTo (HaveOccurred ())
1526+ Expect (get .Val ()).To (Equal ("\x0f " ))
1527+ })
1528+
1529+ It ("should BitOpOne" , Label ("NonRedisEnterprise" ), func () {
1530+ SkipBeforeRedisVersion (8.2 , "BITOP ONE is available since Redis 8.2" )
1531+ set := client .Set (ctx , "key1" , "\xff " , 0 )
1532+ Expect (set .Err ()).NotTo (HaveOccurred ())
1533+ Expect (set .Val ()).To (Equal ("OK" ))
1534+
1535+ set = client .Set (ctx , "key2" , "\x0f " , 0 )
1536+ Expect (set .Err ()).NotTo (HaveOccurred ())
1537+ Expect (set .Val ()).To (Equal ("OK" ))
1538+
1539+ bitOpOne := client .BitOpOne (ctx , "dest" , "key1" , "key2" )
1540+ Expect (bitOpOne .Err ()).NotTo (HaveOccurred ())
1541+ Expect (bitOpOne .Val ()).To (Equal (int64 (1 )))
1542+
1543+ get := client .Get (ctx , "dest" )
1544+ Expect (get .Err ()).NotTo (HaveOccurred ())
1545+ Expect (get .Val ()).To (Equal ("\xf0 " ))
1546+ })
1547+
14721548 It ("should BitOpNot" , Label ("NonRedisEnterprise" ), func () {
14731549 set := client .Set (ctx , "key1" , "\x00 " , 0 )
14741550 Expect (set .Err ()).NotTo (HaveOccurred ())
0 commit comments