File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 7
7
// ===----------------------------------------------------------------------===//
8
8
9
9
#include " llvm/Object/SymbolicFile.h"
10
+ #include " llvm/ADT/STLExtras.h"
10
11
#include " llvm/Support/raw_ostream.h"
11
12
#include " llvm/TargetParser/Host.h"
13
+
12
14
#include " gtest/gtest.h"
13
15
#include < sstream>
14
16
@@ -38,3 +40,24 @@ TEST(Object, DataRefImplOstream) {
38
40
39
41
EXPECT_EQ (Expected, s);
40
42
}
43
+
44
+ struct ProxyContent {
45
+ unsigned Index = 0 ;
46
+ ProxyContent (unsigned Index) : Index(Index) {};
47
+ void moveNext () { Index++; }
48
+
49
+ bool operator ==(const ProxyContent &Another) const {
50
+ return Index == Another.Index ;
51
+ }
52
+ };
53
+
54
+ TEST (Object, ContentIterator) {
55
+ using Iter = llvm::object::content_iterator<ProxyContent>;
56
+ auto Sequence = llvm::make_range (Iter (0u ), Iter (10u ));
57
+ auto EvenSequence = llvm::make_filter_range (
58
+ Sequence, [](auto &&PC) { return PC.Index % 2 == 0 ; });
59
+
60
+ for (auto &&[I, Value] : llvm::enumerate (EvenSequence)) {
61
+ EXPECT_EQ (I * 2u , Value.Index );
62
+ }
63
+ }
You can’t perform that action at this time.
0 commit comments