/* Ċ Ġ* Ġ ĠCopyright Ġ( C ) Ġ 2 0 2 2 ĠAb hi j ith ĠSh ivas w amy Ċ Ġ* ĠĠ ĠSee Ġthe Ġnotice . md Ġfile Ġdistributed Ġwith Ġthis Ġwork Ġfor Ġadditional Ċ Ġ* ĠĠ Ġinformation Ġregarding Ġcopyright Ġownership . Ċ Ġ* Ċ Ġ* ĠĠ ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* ĠĠ Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠĠ ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠĠ ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* ĠĠ Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠĠ ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠĠ ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* ĠĠ Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ* Ċ Ġ*/ Ċ Ċ package Ġio . github . cr ack the code ab hi . k red s . commands Ċ Ċ import Ġio . github . cr ack the code ab hi . k red s . connection . K red s Client Ċ import Ġio . kot est . core . spec . style . Fun Spec Ċ import Ġio . kot est . matchers . shouldBe Ċ Ċ class ĠZ Set Commands Test Ġ: ĠFun Spec ({ ĊĠĠĠ Ġlateinit Ġvar Ġclient : ĠK red s Client ĊĠĠĠ Ġval Ġclient Setup Ġ= ĠClient Setup (). then Ġ{ Ġclient Ġ= Ġit . client Ġ} ĊĠĠĠ Ġbefore Spec ( client Setup ) ĊĠĠĠ Ġafter Spec ( Client Tear Down ( client Setup )) ĊĠĠĠ Ġbefore Test ( Clear DB ( client Setup )) ĊĊĠĠĠ Ġtest (" Z Set ĠCommands Ġ>= ĠAPI Ġ 6 "). config ( enabled Or Reason If Ġ= Ġclient Setup . enable If ( REDIS _ 6 _ 0 _ 0 )) Ġ{ ĊĠĠĠĠĠĠĠ Ġclient . z add (" z set ", Ġscore Member Ġ= Ġ 1 Ġto Ġ" k red s ", Ġscore Members Ġ= ĠarrayOf ( 2 Ġto Ġ" redis ")) ĠshouldBe Ġ 2 ĊĠĠĠĠĠĠĠ Ġclient . z card (" z set ") ĠshouldBe Ġ 2 ĊĊĠĠĠĠĠĠĠ Ġclient . z add (" z set 1 ", Ġscore Member Ġ= Ġ 1 0 Ġto Ġ" A ", Ġscore Members Ġ= ĠarrayOf ( 2 0 Ġto Ġ" B ")) ĊĠĠĠĠĠĠĠ Ġclient . z count (" z set 1 ", Ġ 1 , Ġ 1 0 ) ĠshouldBe Ġ 1 ĊĊĠĠĠĠĠĠĠ Ġclient . z incr By (" z set ", Ġ 1 . 5 , Ġ" k red s ") ĠshouldBe Ġ" 2 . 5 " ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġtest (" Z Set ĠCommands Ġ>= ĠAPI Ġ 6 . 2 "). config ( enabled Or Reason If Ġ= Ġclient Setup . enable If ( REDIS _ 6 _ 2 _ 0 )) Ġ{ ĊĠĠĠĠĠĠĠ Ġclient . z add (" z set ", Ġscore Member Ġ= Ġ 1 Ġto Ġ" k red s ", Ġscore Members Ġ= ĠarrayOf ( 2 Ġto Ġ" redis ")) ĠshouldBe Ġ 2 ĊĠĠĠĠĠĠĠ Ġclient . z card (" z set ") ĠshouldBe Ġ 2 ĊĊĠĠĠĠĠĠĠ Ġclient . z add (" z set 1 ", Ġscore Member Ġ= Ġ 1 0 Ġto Ġ" A ", Ġscore Members Ġ= ĠarrayOf ( 2 0 Ġto Ġ" B ")) ĊĠĠĠĠĠĠĠ Ġclient . z count (" z set 1 ", Ġ 1 , Ġ 1 0 ) ĠshouldBe Ġ 1 ĊĠĠĠ Ġ} Ċ })