Skip to content

Commit

Permalink
source_locaton: extend a couple tests to get 100% coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
djmott committed Jul 11, 2016
1 parent d314216 commit 1fb3b81
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions tests/test_source_location.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,27 @@ TEST(test_source_location, assignment) {
ASSERT_STREQ(a.file(), b.file());
}

TEST(test_source_location, comparison) {

TEST(test_source_location, self_assignment) {
auto a = here();
auto b = here();
ASSERT_FALSE(a == b);
ASSERT_TRUE( a < b);
auto &b = a;
b = a;
ASSERT_TRUE(a == b);
ASSERT_EQ(a.line(), b.line());
ASSERT_STREQ(a.file(), b.file());
}

TEST(test_source_location, comparison) {
{
auto a = here();
auto b = here();
ASSERT_FALSE(a == b);
ASSERT_TRUE(a < b);
b = a;
ASSERT_TRUE(a == b);
}
{
xtd::source_location a("a", 123);
xtd::source_location b("b", 123);
ASSERT_TRUE(a < b);
}
}

0 comments on commit 1fb3b81

Please sign in to comment.