crdt-8.0: test/Cv/RGA.hs
{-# OPTIONS_GHC -Wno-missing-signatures #-}
{-# LANGUAGE TypeApplications #-}
module Cv.RGA where
import Test.QuickCheck ((===))
import CRDT.Cv.RGA (RgaString, edit, fromString, pack, toString,
unpack)
import CRDT.LamportClock.Simulation (runLamportClockSim,
runProcessSim)
import Laws (cvrdtLaws)
import Util (expectRight)
prop_fromString_toString s pid = expectRight $ do
s' <- runLamportClockSim . runProcessSim pid $ fromString s
pure $ toString s' === s
test_Cv = cvrdtLaws @RgaString
prop_edit v1 s2 pid = expectRight . runLamportClockSim $ do
v2 <- runProcessSim pid $ edit s2 v1
pure $ toString v2 === s2
prop_pack_unpack rga = unpack (pack rga) == (rga :: RgaString)