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 77// ===----------------------------------------------------------------------===//
88
99#include " llvm/Object/SymbolicFile.h"
10+ #include " llvm/ADT/STLExtras.h"
1011#include " llvm/Support/raw_ostream.h"
1112#include " llvm/TargetParser/Host.h"
13+
1214#include " gtest/gtest.h"
1315#include < sstream>
1416
@@ -38,3 +40,24 @@ TEST(Object, DataRefImplOstream) {
3840
3941 EXPECT_EQ (Expected, s);
4042}
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