1
1
mirror of https://github.com/github/semantic.git synced 2024-12-18 04:11:48 +03:00

Don’t convert to These.

This commit is contained in:
Rob Rix 2019-10-17 22:53:35 -04:00
parent 55ee8b4f7a
commit 15fdc198bb
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -1,6 +1,6 @@
module Diffing.Algorithm.SES.Spec (spec) where
import Data.These
import Data.Edit
import Diffing.Algorithm.SES
import Test.Hspec
import Test.Hspec.LeanCheck
@ -21,4 +21,4 @@ spec = do
\ as bs -> length (ses (==) ((,) 0 <$> as :: [(Int, Char)]) ((,) 1 <$> bs :: [(Int, Char)])) `shouldBe` length as + length bs
prop "is lossless w.r.t. both input elements & ordering" $
\ as bs -> foldr (\ each (as, bs) -> these (flip (,) bs. (:as)) ((,) as . (:bs)) (\ a b -> (a:as, b:bs)) (toThese each)) ([], []) (ses (==) as bs :: [Edit Char Char]) `shouldBe` (as, bs)
\ as bs -> foldr (\ each (as, bs) -> edit (flip (,) bs. (:as)) ((,) as . (:bs)) (\ a b -> (a:as, b:bs)) each) ([], []) (ses (==) as bs :: [Edit Char Char]) `shouldBe` (as, bs)