summaryrefslogtreecommitdiff
path: root/unittests/ADT
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-06-16 21:03:24 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-06-16 21:03:24 +0000
commit7c7aba6e5fef47a01a136be655b0a92cfd7090f6 (patch)
tree99ec531924f6078534b100ab9d7696abce848099 /unittests/ADT
parent7ab83427af0f77b59941ceba41d509d7d097b065 (diff)
Notes
Diffstat (limited to 'unittests/ADT')
-rw-r--r--unittests/ADT/SCCIteratorTest.cpp6
-rw-r--r--unittests/ADT/SmallVectorTest.cpp20
-rw-r--r--unittests/ADT/StringRefTest.cpp3
3 files changed, 16 insertions, 13 deletions
diff --git a/unittests/ADT/SCCIteratorTest.cpp b/unittests/ADT/SCCIteratorTest.cpp
index ca6d84ed2f329..57a999bea9d56 100644
--- a/unittests/ADT/SCCIteratorTest.cpp
+++ b/unittests/ADT/SCCIteratorTest.cpp
@@ -63,8 +63,9 @@ TEST(SCCIteratorTest, AllSmallGraphs) {
// Check that every node in the SCC is reachable from every other node in
// the SCC.
for (unsigned i = 0; i != NUM_NODES; ++i)
- if (NodesInThisSCC.count(i))
+ if (NodesInThisSCC.count(i)) {
EXPECT_TRUE(NodesInThisSCC.isSubsetOf(G.NodesReachableFrom(i)));
+ }
// OK, now that we now that every node in the SCC is reachable from every
// other, this means that the set of nodes reachable from any node in the
@@ -78,8 +79,9 @@ TEST(SCCIteratorTest, AllSmallGraphs) {
NodesReachableFromSCC.Meet(NodesInThisSCC.Complement());
for (unsigned j = 0; j != NUM_NODES; ++j)
- if (ReachableButNotInSCC.count(j))
+ if (ReachableButNotInSCC.count(j)) {
EXPECT_TRUE(G.NodesReachableFrom(j).Meet(NodesInThisSCC).isEmpty());
+ }
// The result must be the same for all other nodes in this SCC, so
// there is no point in checking them.
diff --git a/unittests/ADT/SmallVectorTest.cpp b/unittests/ADT/SmallVectorTest.cpp
index 5903ce8c08eb8..9c501bbdf1a3c 100644
--- a/unittests/ADT/SmallVectorTest.cpp
+++ b/unittests/ADT/SmallVectorTest.cpp
@@ -440,19 +440,19 @@ TYPED_TEST(SmallVectorTest, AppendNonIterTest) {
this->assertValuesInOrder(this->theVector, 3u, 1, 7, 7);
}
+struct output_iterator {
+ typedef std::output_iterator_tag iterator_category;
+ typedef int value_type;
+ typedef int difference_type;
+ typedef value_type *pointer;
+ typedef value_type &reference;
+ operator int() { return 2; }
+ operator Constructable() { return 7; }
+};
+
TYPED_TEST(SmallVectorTest, AppendRepeatedNonForwardIterator) {
SCOPED_TRACE("AppendRepeatedTest");
- struct output_iterator {
- typedef std::output_iterator_tag iterator_category;
- typedef int value_type;
- typedef int difference_type;
- typedef value_type *pointer;
- typedef value_type &reference;
- operator int() { return 2; }
- operator Constructable() { return 7; }
- };
-
this->theVector.push_back(Constructable(1));
this->theVector.append(output_iterator(), output_iterator());
this->assertValuesInOrder(this->theVector, 3u, 1, 7, 7);
diff --git a/unittests/ADT/StringRefTest.cpp b/unittests/ADT/StringRefTest.cpp
index e308f2d7c64b0..0684afe678f6d 100644
--- a/unittests/ADT/StringRefTest.cpp
+++ b/unittests/ADT/StringRefTest.cpp
@@ -882,8 +882,9 @@ TEST(StringRefTest, getAsDouble) {
double Result;
StringRef S(Entry.Str);
EXPECT_EQ(Entry.ShouldFail, S.getAsDouble(Result, Entry.AllowInexact));
- if (!Entry.ShouldFail)
+ if (!Entry.ShouldFail) {
EXPECT_EQ(Result, Entry.D);
+ }
}
}