diff options
Diffstat (limited to 'tests/test-diff.cpp')
-rw-r--r-- | tests/test-diff.cpp | 32 |
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) |