From b2f3b566c0c0edd41b0314fcbf516a3d7876e14b Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sun, 29 Jan 2023 17:54:14 +0100 Subject: Fix concurrent edit, tests --- tests/test-diff.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'tests/test-diff.cpp') diff --git a/tests/test-diff.cpp b/tests/test-diff.cpp index 1625716..d09c58e 100644 --- a/tests/test-diff.cpp +++ b/tests/test-diff.cpp @@ -147,6 +147,38 @@ TEST_F(DiffTest, constructor) Diff d{"baaaab", "baab"}; EXPECT_EQ(d.get_xml(), "13"); } + { + Diff d{"baaaab", "baaaaaaab"}; + EXPECT_EQ(d.get_xml(), "11aaa"); + } +} + +TEST_F(DiffTest, empty) +{ + { + Diff d; + EXPECT_TRUE(d.empty()); + } + + { + Diff d{"13"}; + EXPECT_FALSE(d.empty()); + } + + { + Diff d{"11"}; + EXPECT_TRUE(d.empty()); + } + + { + Diff d{"11abc"}; + EXPECT_FALSE(d.empty()); + } + + { + Diff d{"00"}; + EXPECT_TRUE(d.empty()); + } } TEST_F(DiffTest, diff_create) -- cgit v1.2.3