summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2023-01-29 17:54:14 +0100
committerRoland Reichwein <mail@reichwein.it>2023-01-29 17:54:14 +0100
commitb2f3b566c0c0edd41b0314fcbf516a3d7876e14b (patch)
tree1cebf349b746ae606354733e9464581d530fb5e7 /tests
parent32b5b50dacb1bfc02a0baef0eda47df8d5f2be37 (diff)
Fix concurrent edit, tests
Diffstat (limited to 'tests')
-rw-r--r--tests/test-diff.cpp32
1 files changed, 32 insertions, 0 deletions
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(), "<diff><start>1</start><end>3</end><data/></diff>");
}
+ {
+ Diff d{"baaaab", "baaaaaaab"};
+ EXPECT_EQ(d.get_xml(), "<diff><start>1</start><end>1</end><data>aaa</data></diff>");
+ }
+}
+
+TEST_F(DiffTest, empty)
+{
+ {
+ Diff d;
+ EXPECT_TRUE(d.empty());
+ }
+
+ {
+ Diff d{"<diff><start>1</start><end>3</end><data/></diff>"};
+ EXPECT_FALSE(d.empty());
+ }
+
+ {
+ Diff d{"<diff><start>1</start><end>1</end><data/></diff>"};
+ EXPECT_TRUE(d.empty());
+ }
+
+ {
+ Diff d{"<diff><start>1</start><end>1</end><data>abc</data></diff>"};
+ EXPECT_FALSE(d.empty());
+ }
+
+ {
+ Diff d{"<diff><start>0</start><end>0</end><data/></diff>"};
+ EXPECT_TRUE(d.empty());
+ }
}
TEST_F(DiffTest, diff_create)