15#include "gtest/gtest.h"
25 class CR_Test :
public ::testing::Test
39 class UR_Test :
public ::testing::Test
45 mMeta = {
"These",
"are",
"test",
"strings",
"foo",
"bar",
"baz" };
46 std::sort(mMeta.begin(), mMeta.end(), std::less<String>());
54 class MR_Test :
public ::testing::Test
60 mMeta = {
"test",
"strings",
"foo" };
61 std::sort(mMeta.begin(), mMeta.end(), std::less<String>());
64 auto crx = std::dynamic_pointer_cast<CRange>(cr);
66 auto urx = std::dynamic_pointer_cast<URange<String>>(ur);
79 class YR_Test :
public ::testing::Test
85 mMeta = {
"test",
"strings",
"foo" };
86 std::sort(mMeta.begin(), mMeta.end(), std::less<String>());
104 auto crx = std::dynamic_pointer_cast<CRange>(cr);
121 auto endxi = cr->end();
137 auto crx = std::dynamic_pointer_cast<CRange>(cr);
139 auto end =
crx->end();
146 auto pr =
beg.prange(end);
147 auto prx = std::dynamic_pointer_cast<PRange<CRange>>(
pr);
152 for(
auto i =
prx->begin();
i !=
prx->end(); ++
i){
161 auto urx = std::dynamic_pointer_cast<URange<String>>(ur);
174 EXPECT_EQ(ur->end().pos(), mMeta.size());
177 auto endxi = ur->end();
186 for(
const auto& x: *
urx){
193 auto urx = std::dynamic_pointer_cast<URange<String>>(ur);
195 auto end =
urx->end();
201 end -= mMeta.size() -
endPos + 1;
202 auto pr =
beg.prange(end);
203 auto prx = std::dynamic_pointer_cast<PRange<URange<String>>>(
pr);
208 for(
auto i =
prx->begin();
i !=
prx->end(); ++
i){
216 auto mrx = std::dynamic_pointer_cast<MRange<CRange,URange<String>>>(mr);
219 EXPECT_EQ(mr->size(), mMeta.size()*mSize);
238 auto endxi = mr->end();
272 auto mrx = std::dynamic_pointer_cast<MRange<CRange,URange<String>,
CRange>>(mr2);
275 EXPECT_EQ(mr2->size(), mMeta.size()*mSize*mSize);
288 EXPECT_EQ(mr2->end().pos(), mr2->size());
290 const SizeT s1 = mMeta.size();
291 const SizeT s2 = mSize;
296 auto endxi = mr2->end();
332 EXPECT_EQ(yr->size(), mMeta.size()*mSize);
344 auto endxi = yr->end();
358 EXPECT_EQ(yr2->size(), mMeta.size()*mSize*mSize);
364 EXPECT_EQ(yr2->end().pos(), yr2->size());
366 const SizeT s1 = mMeta.size();
367 const SizeT s2 = mSize;
372 auto endxi = yr2->end();
385 auto yrx = std::dynamic_pointer_cast<YRange>(yr);
387 auto yi =
yrx->begin();
397 for(
SizeT i = 0;
i != yr->size(); ++
i){
406 for(
SizeT j = 0;
j != yr->size(); ++
j){
416 yi +=
yi.lmax().val() + 10;
420 yi -=
yi.lmax().val() + 20;
427 auto yrx = std::dynamic_pointer_cast<YRange>(yr2);
429 auto yi =
yrx->begin();
437 const SizeT s1 = mMeta.size();
438 const SizeT s2 = mSize;
441 for(
SizeT i = 0;
i != yr2->size(); ++
i){
450 for(
SizeT j = 0;
j != yr2->size(); ++
j){
460 yi +=
yi.lmax().val() + 10;
464 yi -=
yi.lmax().val() + 20;
471 const SizeT s1 = mMeta.size();
472 const SizeT s2 = mSize;
473 auto crx = std::dynamic_pointer_cast<CRange>(cr);
474 auto urx = std::dynamic_pointer_cast<URange<String>>(ur);
485 for(
auto ci = cr->begin();
ci != cr->end(); ++
ci){
486 for(
auto ui = ur->begin();
ui != ur->end(); ++
ui){
489 for(
auto ci2 = cr->begin();
ci2 != cr->end(); ++
ci2){
499 auto yrx = std::dynamic_pointer_cast<YRange>(yr);
514 auto prx = std::dynamic_pointer_cast<YRange>(
pr);
523 for(
auto i =
prx->begin();
i !=
prx->end(); ++
i){
542 auto prx2 = std::dynamic_pointer_cast<YRange>(
pr2);
551 for(
auto i =
prx2->begin();
i !=
prx2->end(); ++
i){
562 ::testing::InitGoogleTest(&
argc,
argv);
constexpr decltype(auto) mindex(const Sptr< Indices > &... is)
Sptr< RangeBase > RangePtr
std::vector< T, Allocator< T > > Vector
RangePtr mrange(const Sptr< Ranges > &... rs)
std::integral_constant< SizeT, N > CSizeT
Sptr< Range > rangeCast(const RangePtr r)
YIndex yindex(const DPack &pack)
String toString(const T &a)
RangePtr prange(const Sptr< RangeT > &range, const Vector< SizeT > &parts)
int main(int argc, char **argv)