Commit 89aabe3b authored by Anton Bukov's avatar Anton Bukov

Fix some issues

parent ecab6f46
......@@ -18,7 +18,7 @@ int src[] = {1,2,3,4,5,6,7,8};
auto dst = from(src).where( [](int a){return a%2 == 1;}) // 1,3,5,7
.select([](int a){return a*2;}) // 2,6,10,14
.where( [](int a){return a>2 && a<12;}) // 6,10
.toVector();
.toStdVector();
// dst type: std::vector<int>
// dst items: 6,10
......@@ -45,7 +45,7 @@ Man src[] =
auto dst = from(src).where( [](const Man & man){return man.age < 18;})
.orderBy([](const Man & man){return man.age;})
.select( [](const Man & man){return man.name;})
.toVector();
.toStdVector();
// dst type: std::vector<std::string>
// dst items: "Kevin", "Layer", "Agata"
......@@ -90,14 +90,20 @@ int DenisUniqueContactCount =
- cast&lt;T&gt;()
- take(int)
- takeWhile(int)
- takeWhile_i(int)
- skip(int)
- skipWhile(int)
- skipWhile_i(int)
- concat(range)
- where(lambda)
- where_i(lambda)
- select(lambda)
- select_i(lambda)
- selectMany(lambda)
- reverse()
- orderBy()
- orderBy(lambda)
- groupBy(lambda)
- distinct()
- distinct(lambda)
- for_each(lambda)
......@@ -114,14 +120,16 @@ int DenisUniqueContactCount =
- max()
- max(lambda)
- count()
- count(lambda)
- contains(value)
- elementAt(int)
- toSet()
- toList()
- toDeque()
- toVector()
- toContainer&lt;T&gt;()
- toStdSet()
- toStdList()
- toStdDeque()
- toStdVector()
#### Coming soon:
- groupBy(lambda)
#### Custom:
......@@ -138,10 +146,6 @@ int DenisUniqueContactCount =
- unbits&lt;T,BitOrder&gt;()
- unbits&lt;T,BitOrder,ByteOrder&gt;()
#### Coming soon:
- selectMany(lambda)
#### May be will be:
- gz()
......
This diff is collapsed.
This diff is collapsed.
......@@ -14,18 +14,18 @@ template<typename R, typename T, unsigned N, typename F>
void CheckRangeEqArray(R dst, T (&ans)[N], F f)
{
for (unsigned i = 0; i < N; i++)
EXPECT_EQ(f(ans[i]), f(dst.nextObject()));
EXPECT_EQ(f(ans[i]), f(dst.next()));
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
template<typename R, typename T, unsigned N>
void CheckRangeEqArray(R dst, T (&ans)[N])
{
for (unsigned i = 0; i < N; i++)
EXPECT_EQ(ans[i], dst.nextObject());
EXPECT_EQ(ans[i], dst.next());
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
template<typename T, unsigned N>
......@@ -44,7 +44,7 @@ template<typename R, typename T, unsigned N>
void CheckRangeEqSet(R dst, T (&ans)[N])
{
std::set<T> expected = ArrayToSet(ans);
std::set<typename R::value_type> actual = dst.toSet();
std::set<typename R::value_type> actual = dst.toStdSet();
EXPECT_EQ(expected.size(), actual.size());
......
......@@ -41,7 +41,7 @@ TEST(GroupByRange, IntsFront)
CheckRangeEqArray(dst.back(), ans_0);
CheckRangeEqArray(dst.popFront(), ans_0);
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(GroupByRange, IntsBack)
......@@ -73,7 +73,7 @@ TEST(GroupByRange, IntsBack)
CheckRangeEqArray(dst.back(), ans_1);
CheckRangeEqArray(dst.popBack(), ans_1);
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
//////////////////////////////////////////////////////////////////////////
......@@ -126,7 +126,7 @@ TEST(GroupByRange, CountChildrenByAge)
CheckRangeEqArray(dst.back(), ans_true);
CheckRangeEqArray(dst.popFront(), ans_true);
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
*/
......@@ -27,8 +27,8 @@ TEST(IterRange, ListInt)
int ans[] = {1,2,3,4,5};
CheckRangeEqArray(from(lst), ans);
CheckRangeEqArray(from<int>(lst.begin(), lst.end()), ans);
CheckRangeEqArray(from<int>(lst.cbegin(), lst.cend()), ans);
CheckRangeEqArray(from(lst.begin(), lst.end()), ans);
CheckRangeEqArray(from(lst.cbegin(), lst.cend()), ans);
}
TEST(IterRange, DequeInt)
......@@ -43,8 +43,8 @@ TEST(IterRange, DequeInt)
int ans[] = {1,2,3,4,5};
CheckRangeEqArray(from(dck), ans);
CheckRangeEqArray(from<int>(dck.begin(), dck.end()), ans);
CheckRangeEqArray(from<int>(dck.cbegin(), dck.cend()), ans);
CheckRangeEqArray(from(dck.begin(), dck.end()), ans);
CheckRangeEqArray(from(dck.cbegin(), dck.cend()), ans);
}
TEST(IterRange, VectorInt)
......@@ -59,8 +59,8 @@ TEST(IterRange, VectorInt)
int ans[] = {1,2,3,4,5};
CheckRangeEqArray(from(vec), ans);
CheckRangeEqArray(from<int>(vec.begin(), vec.end()), ans);
CheckRangeEqArray(from<int>(vec.cbegin(), vec.cend()), ans);
CheckRangeEqArray(from(vec.begin(), vec.end()), ans);
CheckRangeEqArray(from(vec.cbegin(), vec.cend()), ans);
}
TEST(IterRange, SetInt)
......@@ -69,22 +69,22 @@ TEST(IterRange, SetInt)
int ans[] = {1,2,3,4,5};
CheckRangeEqSet(from(set), ans);
CheckRangeEqSet(from<int>(set.begin(), set.end()), ans);
CheckRangeEqSet(from<int>(set.cbegin(), set.cend()), ans);
CheckRangeEqSet(from(set.begin(), set.end()), ans);
CheckRangeEqSet(from(set.cbegin(), set.cend()), ans);
}
TEST(IterRange, MapInt)
{
std::map<int, int> map = {{5,1},{4,2},{3,3},{2,4},{1,5}};
std::pair<int, int> ans[] = {{5,1},{4,2},{3,3},{2,4},{1,5}};
CheckRangeEqArray(from(map)
.orderBy([](std::pair<int,int> p){ return p.second; }), ans);
CheckRangeEqArray(from<std::pair<int,int> >(map.begin(), map.end())
.orderBy([](std::pair<int,int> p){ return p.second; }), ans);
CheckRangeEqArray(from<std::pair<int,int> >(map.cbegin(), map.cend())
.orderBy([](std::pair<int,int> p){ return p.second; }), ans);
}
//TEST(IterRange, MapInt)
//{
// std::map<int, int> map = {{5,1},{4,2},{3,3},{2,4},{1,5}};
// std::pair<int, int> ans[] = {{5,1},{4,2},{3,3},{2,4},{1,5}};
//
// CheckRangeEqArray(from(map)
// .orderBy([](std::pair<int,int> p){ return p.second; }), ans);
// CheckRangeEqArray(from(map.begin(), map.end())
// .orderBy([](std::pair<int,int> p){ return p.second; }), ans);
// CheckRangeEqArray(from(map.cbegin(), map.cend())
// .orderBy([](std::pair<int,int> p){ return p.second; }), ans);
//}
TEST(IterRange, StdArrayInt)
{
......@@ -92,8 +92,8 @@ TEST(IterRange, StdArrayInt)
int ans[] = {1,2,3,4,5};
CheckRangeEqArray(from(arr), ans);
CheckRangeEqArray(from<int>(arr.begin(), arr.end()), ans);
CheckRangeEqArray(from<int>(arr.cbegin(), arr.cend()), ans);
CheckRangeEqArray(from(arr.begin(), arr.end()), ans);
CheckRangeEqArray(from(arr.cbegin(), arr.cend()), ans);
}
TEST(IterRange, ArrayInt)
......@@ -104,8 +104,8 @@ TEST(IterRange, ArrayInt)
int ans[] = {1,2,3,4,5};
CheckRangeEqArray(from(arr), ans);
CheckRangeEqArray(from<int>(ptr, 5), ans);
CheckRangeEqArray(from<int>(ptr, ptr+5), ans);
CheckRangeEqArray(from(ptr, 5), ans);
CheckRangeEqArray(from(ptr, ptr + 5), ans);
}
//////////////////////////////////////////////////////////////////////////
......@@ -126,5 +126,5 @@ TEST(IterRange, EmptyVector)
auto rng = from(src);
EXPECT_THROW(rng.nextObject(), LinqEndException);
EXPECT_THROW(rng.next(), LinqEndException);
}
......@@ -25,10 +25,10 @@ TEST(Linq, WhereOdd)
for (int i = 1; i <= 5; i+=2)
{
EXPECT_EQ(i, rng.nextObject());
EXPECT_EQ(i, rng.next());
}
EXPECT_THROW(rng.nextObject(), LinqEndException);
EXPECT_THROW(rng.next(), LinqEndException);
}
TEST(Linq, WhereOdd_WhereLess)
......@@ -48,10 +48,10 @@ TEST(Linq, WhereOdd_WhereLess)
for (int i = 1; i <= 3; i+=2)
{
EXPECT_EQ(i, rng.nextObject());
EXPECT_EQ(i, rng.next());
}
EXPECT_THROW(rng.nextObject(), LinqEndException);
EXPECT_THROW(rng.next(), LinqEndException);
}
TEST(Linq, WhereLess_WhereOdd)
......@@ -68,7 +68,7 @@ TEST(Linq, WhereLess_WhereOdd)
auto rng = from(src).where([](int a){return a < 4;})
.where([](int a){return a%2 == 1;})
.toVector();
.toStdVector();
std::vector<int> ans;
ans.push_back(1);
......@@ -92,7 +92,7 @@ TEST(Linq, WhereLess_WhereOdd_OrderByDesc)
auto rng = from(src).where([](int a){return a < 6;})
.where([](int a){return a%2 == 1;})
.orderBy([](int a){return -a;})
.toVector();
.toStdVector();
std::vector<int> ans;
ans.push_back(5);
......@@ -115,7 +115,7 @@ TEST(Linq, WhereOdd_ToVector)
src.push_back(8);
auto dst = from(src).where([](int a){return a%2 == 1;})
.toVector();
.toStdVector();
std::vector<int> ans;
ans.push_back(1);
......@@ -141,7 +141,7 @@ TEST(Linq, WhereOdd_WhereLess_SelectMul2_ToVector)
auto dst = from(src).where([](int a){return a%2 == 1;})
.where([](int a){return a < 6;})
.select([](int a){return a*2;})
.toVector();
.toStdVector();
std::vector<int> ans;
ans.push_back(2);
......@@ -167,7 +167,7 @@ TEST(Linq, WhereOdd_WhereLess_SelectMul2_Reverse_ToVector)
.where([](int a){return a < 6;})
.select([](int a){return a*2;})
.reverse()
.toVector();
.toStdVector();
std::vector<int> ans;
ans.push_back(10);
......@@ -193,7 +193,7 @@ TEST(Linq, WhereOdd_Reverse_Reverse)
.reverse()
.where([](int a){return a < 4;})
.reverse()
.toVector();
.toStdVector();
std::vector<int> ans;
ans.push_back(1);
......@@ -208,14 +208,14 @@ TEST(Linq, Pointer_Front)
{
int src[] = {1,2,3,4,5};
auto dst = from<int>(static_cast<int *>(src), static_cast<int *>(src) + 5);
auto dst = from(static_cast<int *>(src), static_cast<int *>(src) + 5);
for(int i = 1; i <= 5; i++)
{
EXPECT_EQ(i, dst.nextObject());
EXPECT_EQ(i, dst.next());
}
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
......@@ -229,10 +229,10 @@ TEST(Linq, Array_Front)
for(int i = 1; i <= 5; i++)
{
EXPECT_EQ(i, dst.nextObject());
EXPECT_EQ(i, dst.next());
}
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
//////////////////////////////////////////////////////////////////////////
......@@ -253,12 +253,12 @@ TEST(Linq, Creations)
auto dst_vec = from(vec);
auto dst_arr = from(arr);
//auto dst_carr = from(carr);
auto dst_ptr = from<int>(ptr, ptr+5);
//auto dst_cptr = from<const int>(cptr, cptr+5);
auto dst_ptr_length = from<int>(ptr, 5);
//auto dst_cptr_length = from<const int>(cptr, 5);
auto dst_vec_iter = from<int>(vec.begin(), vec.end());
//auto dst_vec_citer = from<const int>(vec.cbegin(), vec.cend());
auto dst_ptr = from(ptr, ptr+5);
//auto dst_cptr = from(cptr, cptr+5);
auto dst_ptr_length = from(ptr, 5);
//auto dst_cptr_length = from(cptr, 5);
auto dst_vec_iter = from(vec.begin(), vec.end());
//auto dst_vec_citer = from(vec.cbegin(), vec.cend());
}
//////////////////////////////////////////////////////////////////////////
......@@ -301,8 +301,8 @@ TEST(Linq, MessagesCountUniqueContacts)
TEST(Linq, ForwardIterating)
{
std::stringstream stream("0123456789");
auto dst = from<char>(std::istream_iterator<char>(stream),
std::istream_iterator<char>())
auto dst = from(std::istream_iterator<char>(stream),
std::istream_iterator<char>())
.where( [](char a){return a % 2 == 0;})
.select([](char a){return std::string(1,a);})
.sum();
......
......@@ -63,7 +63,7 @@ TEST(OrderByRange, NoElements)
auto rng = from(src);
auto dst = rng.orderBy();
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
//////////////////////////////////////////////////////////////////////////
......
......@@ -50,7 +50,7 @@ TEST(SkipRange, ManyToZero)
auto rng = from(src);
auto dst = rng.skip(6);
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(SkipRange, ManyToZeroLess)
......@@ -60,7 +60,7 @@ TEST(SkipRange, ManyToZeroLess)
auto rng = from(src);
auto dst = rng.skip(10);
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
//////////////////////////////////////////////////////////////////////////
......@@ -83,7 +83,7 @@ TEST(SkipRange, OneToZero)
auto rng = from(src);
auto dst = rng.skip(1);
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(SkipRange, OneToZeroLess)
......@@ -93,7 +93,7 @@ TEST(SkipRange, OneToZeroLess)
auto rng = from(src);
auto dst = rng.skip(2);
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(SkipRange, ZeroToZero)
......@@ -103,7 +103,7 @@ TEST(SkipRange, ZeroToZero)
auto rng = from(src);
auto dst = rng.skip(0);
EXPECT_THROW(rng.nextObject(), LinqEndException);
EXPECT_THROW(rng.next(), LinqEndException);
}
TEST(SkipRange, ZeroToZeroLess)
......@@ -113,7 +113,7 @@ TEST(SkipRange, ZeroToZeroLess)
auto rng = from(src);
auto dst = rng.skip(2);
EXPECT_THROW(rng.nextObject(), LinqEndException);
EXPECT_THROW(rng.next(), LinqEndException);
}
//////////////////////////////////////////////////////////////////////////
......@@ -194,7 +194,7 @@ TEST(SkipWhileRange, ManyToZero)
auto rng = from(src);
auto dst = rng.skipWhile([](int it){return it > 0;});
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(SkipWhileRange_i, ManyToZeroeByIndex)
......@@ -204,7 +204,7 @@ TEST(SkipWhileRange_i, ManyToZeroeByIndex)
auto rng = from(src);
auto dst = rng.skipWhile_i([](int /*it*/, int idx){return idx < 6;});
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(SkipWhileRange_i, ManyToZeroByItemValue)
......@@ -214,7 +214,7 @@ TEST(SkipWhileRange_i, ManyToZeroByItemValue)
auto rng = from(src);
auto dst = rng.skipWhile_i([](int it, int /*idx*/){return it > 0;});
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(SkipWhileRange_i, ManyToZeroIndexAndItemValue)
......@@ -224,7 +224,7 @@ TEST(SkipWhileRange_i, ManyToZeroIndexAndItemValue)
auto rng = from(src);
auto dst = rng.skipWhile_i([](int it, int idx){return idx != it;});
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
//////////////////////////////////////////////////////////////////////////
......@@ -280,7 +280,7 @@ TEST(SkipWhileRange, OneToZero)
auto rng = from(src);
auto dst = rng.skipWhile([](int it){return it == 5;});
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(SkipWhileRange_i, OneToZeroByIndex)
......@@ -290,7 +290,7 @@ TEST(SkipWhileRange_i, OneToZeroByIndex)
auto rng = from(src);
auto dst = rng.skipWhile_i([](int /*it*/, int idx){return idx < 6;});
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(SkipWhileRange_i, OneToZeroByItemValue)
......@@ -300,7 +300,7 @@ TEST(SkipWhileRange_i, OneToZeroByItemValue)
auto rng = from(src);
auto dst = rng.skipWhile_i([](int it, int /*idx*/){return it > 0;});
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(SkipWhileRange_i, OneToZeroIndexAndItemValue)
......@@ -310,7 +310,7 @@ TEST(SkipWhileRange_i, OneToZeroIndexAndItemValue)
auto rng = from(src);
auto dst = rng.skipWhile_i([](int it, int idx){return idx != it;});
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(SkipWhileRange, ZeroToZero)
......@@ -320,7 +320,7 @@ TEST(SkipWhileRange, ZeroToZero)
auto rng = from(src);
auto dst = rng.skipWhile([](int){return false;});
EXPECT_THROW(rng.nextObject(), LinqEndException);
EXPECT_THROW(rng.next(), LinqEndException);
}
TEST(SkipWhileRange_i, ZeroToZero)
......@@ -330,7 +330,7 @@ TEST(SkipWhileRange_i, ZeroToZero)
auto rng = from(src);
auto dst = rng.skipWhile_i([](int /*it*/, int /*idx*/){return true;});
EXPECT_THROW(rng.nextObject(), LinqEndException);
EXPECT_THROW(rng.next(), LinqEndException);
}
//////////////////////////////////////////////////////////////////////////
......@@ -45,8 +45,8 @@ TEST(Sum, BoolSum)
src.push_back(4);
src.push_back(5);
auto rng1 = from(src).sum<int>([](int a){return a%2 == 0;});
auto rng2 = from(src).sum<int>([](int a){return a%2 == 1;});
auto rng1 = from(src).sum([](int a){return a%2 == 0;});
auto rng2 = from(src).sum([](int a){return a%2 == 1;});
EXPECT_EQ(2, rng1);
EXPECT_EQ(3, rng2);
......
......@@ -61,7 +61,7 @@ TEST(TakeRange, ManyToZero)
auto rng = from(src);
auto dst = rng.take(0);
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
//////////////////////////////////////////////////////////////////////////
......@@ -95,7 +95,7 @@ TEST(TakeRange, OneToZero)
auto rng = from(src);
auto dst = rng.take(0);
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(TakeRange, ZeroToZero)
......@@ -105,7 +105,7 @@ TEST(TakeRange, ZeroToZero)
auto rng = from(src);
auto dst = rng.take(0);
EXPECT_THROW(rng.nextObject(), LinqEndException);
EXPECT_THROW(rng.next(), LinqEndException);
}
//////////////////////////////////////////////////////////////////////////
......@@ -193,7 +193,7 @@ TEST(TakeWhileRange, ManyToZero)
auto rng = from(src);
auto dst = rng.takeWhile([](int it){return it < 0;});
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(TakeWhileRange_i, ManyToZeroByIndex)
......@@ -203,7 +203,7 @@ TEST(TakeWhileRange_i, ManyToZeroByIndex)
auto rng = from(src);
auto dst = rng.takeWhile_i([](int /*it*/, int idx){return idx > 0;});
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(TakeWhileRange_i, ManyToZeroByItemValue)
......@@ -213,7 +213,7 @@ TEST(TakeWhileRange_i, ManyToZeroByItemValue)
auto rng = from(src);
auto dst = rng.takeWhile_i([](int it, int /*idx*/){return it > 2;});
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(TakeWhileRange_i, ManyToZeroByIdexAndItemValue)
......@@ -223,7 +223,7 @@ TEST(TakeWhileRange_i, ManyToZeroByIdexAndItemValue)
auto rng = from(src);
auto dst = rng.takeWhile_i([](int it, int idx){return it < 0 || idx > 0;});
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
//////////////////////////////////////////////////////////////////////////
......@@ -279,7 +279,7 @@ TEST(TakeWhileRange, OneToZero)
auto rng = from(src);
auto dst = rng.takeWhile([](int){return false;});
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(TakeWhileRange_i, OneToZeroByIndex)
......@@ -289,7 +289,7 @@ TEST(TakeWhileRange_i, OneToZeroByIndex)
auto rng = from(src);
auto dst = rng.takeWhile_i([](int /*it*/, int idx){return idx > 0;});
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(TakeWhileRange_i, OneToZeroByItemValue)
......@@ -299,7 +299,7 @@ TEST(TakeWhileRange_i, OneToZeroByItemValue)
auto rng = from(src);
auto dst = rng.takeWhile_i([](int it, int /*idx*/){return it < 5;});
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(TakeWhileRange_i, OneToZeroByIndexAndItemValue)
......@@ -309,7 +309,7 @@ TEST(TakeWhileRange_i, OneToZeroByIndexAndItemValue)
auto rng = from(src);
auto dst = rng.takeWhile_i([](int it, int idx){return idx == 0 && it > 5;});
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(TakeWhileRange, ZeroToZero)
......@@ -319,7 +319,7 @@ TEST(TakeWhileRange, ZeroToZero)
auto rng = from(src);
auto dst = rng.takeWhile([](int){return false;});
EXPECT_THROW(rng.nextObject(), LinqEndException);
EXPECT_THROW(rng.next(), LinqEndException);
}
TEST(TakeWhileRange_i, ZeroToZero)
......@@ -329,7 +329,7 @@ TEST(TakeWhileRange_i, ZeroToZero)
auto rng = from(src);
auto dst = rng.takeWhile_i([](int /*it*/, int /*idx*/){return false;});
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
//////////////////////////////////////////////////////////////////////////
......@@ -6,7 +6,7 @@
using namespace boolinq;
TEST(ToDeque, Deque2Deque)
TEST(toStdDeque, Deque2Deque)
{
std::deque<int> src;
src.push_back(100);
......@@ -14,7 +14,7 @@ TEST(ToDeque, Deque2Deque)
src.push_back(300);
auto rng = from(src);
auto dst = rng.toDeque();
auto dst = rng.toStdDeque();
EXPECT_EQ(dst,src);
}
......@@ -6,7 +6,7 @@
using namespace boolinq;
TEST(ToList, List2List)
TEST(toStdList, List2List)
{
std::list<int> src;
src.push_back(100);
......@@ -14,7 +14,7 @@ TEST(ToList, List2List)
src.push_back(300);
auto rng = from(src);
auto dst = rng.toList();
auto dst = rng.toStdList();
EXPECT_EQ(dst,src);
}
......@@ -6,7 +6,7 @@
using namespace boolinq;
TEST(ToSet, Vector2Set)
TEST(toStdSet, Vector2Set)
{
std::vector<int> src;
src.push_back(1);
......@@ -16,7 +16,7 @@ TEST(ToSet, Vector2Set)
src.push_back(2);
auto rng = from(src);
auto dst = rng.toSet();
auto dst = rng.toStdSet();
EXPECT_EQ(3U, dst.size());
EXPECT_NE(dst.end(), dst.find(1));
......
......@@ -6,7 +6,7 @@
using namespace boolinq;
TEST(ToVector, Vector2Vector)
TEST(toStdVector, Vector2Vector)
{
std::vector<int> src;
src.push_back(100);
......@@ -14,7 +14,7 @@ TEST(ToVector, Vector2Vector)
src.push_back(300);
auto rng = from(src);
auto dst = rng.toVector();
auto dst = rng.toStdVector();
EXPECT_EQ(dst,src);
}
......@@ -99,5 +99,5 @@ TEST(UnbytesRange, EmptyDefault)
auto rng = from(src);
auto dst = rng.unbytes<int>();
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
......@@ -17,7 +17,7 @@ TEST(WhereRange, IntOdd)
auto rng = from(src);
auto dst = rng.where([](int a){return a%2 == 1;});
CheckRangeEqArray(dst, ans);
}
......@@ -42,7 +42,7 @@ TEST(WhereRange, FirstLetterFront)
auto rng = from(src);
auto dst = rng.where([](std::string a){return a[0] == 'a';});
CheckRangeEqArray(dst, ans);
}
......@@ -73,17 +73,17 @@ TEST(WhereRange, NameAgeLess)
auto rng = from(src);
auto dst = rng.where([](const NameAge & a){return a.age < 18;});
CheckRangeEqArray(dst, ans, [](const NameAge & a){return a.name;});
}
//////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
TEST(WhereRange, MayToOne)
{
int src[] = {0,1,2};
int ans[] = {1};
auto rng = from(src);
auto dst = rng.where([](int a){return a == 1;});
......@@ -104,21 +104,21 @@ TEST(WhereRange, OneToOne)
TEST(WhereRange, ManyToZero)
{
int src[] = {0,1,2};
auto rng = from(src);
auto dst = rng.where([](int a){return a == 5;});
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(WhereRange, OneToZero)
{
int src[] = {5};
auto rng = from(src);
auto dst = rng.where( [](int a){return a>10;});
EXPECT_THROW(dst.nextObject(), LinqEndException);
EXPECT_THROW(dst.next(), LinqEndException);
}
TEST(WhereRange, ZeroToZero)
......@@ -128,5 +128,5 @@ TEST(WhereRange, ZeroToZero)
auto rng = from(src);
auto dst = rng.where( [](int a){return a>0;});
EXPECT_THROW(rng.nextObject(), LinqEndException);
EXPECT_THROW(rng.next(), LinqEndException);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment