From 0d8c080f350e9d12e0bb81ee14b83a6046d1c0ad Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 6 Oct 2015 13:22:37 -0400 Subject: [PATCH] Add a little API for diffs. --- prototype/DoubtTests/DiffTests.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/prototype/DoubtTests/DiffTests.swift b/prototype/DoubtTests/DiffTests.swift index 3c74b012e..cff5fa1dd 100644 --- a/prototype/DoubtTests/DiffTests.swift +++ b/prototype/DoubtTests/DiffTests.swift @@ -33,6 +33,18 @@ final class DiffTests: XCTestCase { } } +private func insert(term: Term) -> Diff { + return Diff.Pure(.Insert(term)) +} + +private func delete(term: Term) -> Diff { + return Diff.Pure(.Delete(term)) +} + +private func copy(term: Term) -> Diff { + return Diff.Roll(term.out.map(copy)) +} + private typealias Term = Fix private typealias Diff = Free>