Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit 658fef3

Browse files
committed
Add SetUtil tests
1 parent 3f4a0ad commit 658fef3

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

test/util/set_util_test.cpp

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Peloton
4+
//
5+
// set_util_test.cpp
6+
//
7+
// Identification: test/set_util_test.cpp
8+
//
9+
// Copyright (c) 2015-18, Carnegie Mellon University Database Group
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
#include "common/harness.h"
14+
#include "common/logger.h"
15+
16+
#include <set>
17+
18+
#include "util/set_util.h"
19+
20+
namespace peloton {
21+
namespace test {
22+
23+
//===--------------------------------------------------------------------===//
24+
// SetUtil Test
25+
//===--------------------------------------------------------------------===//
26+
27+
class SetUtilTests : public PelotonTest {};
28+
29+
TEST_F(SetUtilTests, DisjointTest) {
30+
// Check sorted sets
31+
std::set<int> setA{1, 2, 3, 4};
32+
std::set<int> setB{4, 5, 6, 7};
33+
EXPECT_FALSE(SetUtil::isDisjoint(setA, setB));
34+
35+
std::set<int> setC{9, 8, 10};
36+
EXPECT_TRUE(SetUtil::isDisjoint(setA, setC));
37+
38+
std::set<int> setD{4, 1, 3, 2};
39+
EXPECT_FALSE(SetUtil::isDisjoint(setB, setD));
40+
41+
std::set<int> setE;
42+
EXPECT_TRUE(SetUtil::isDisjoint(setD, setE));
43+
}
44+
45+
} // namespace test
46+
} // namespace peloton

0 commit comments

Comments
 (0)