Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
boolinq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
boolinq
Commits
ecab6f46
Commit
ecab6f46
authored
Jun 28, 2019
by
Anton Bukov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reimplemented a lot, has a compiler infinite recursion
parent
a32c5293
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
84 additions
and
82 deletions
+84
-82
.gitignore
.gitignore
+2
-0
boolinq.h
include/boolinq/boolinq.h
+0
-0
boolinq_old.h
include/boolinq/boolinq_old.h
+0
-0
AvgTest.cpp
test/AvgTest.cpp
+1
-1
BitsRangeTest.cpp
test/BitsRangeTest.cpp
+7
-7
BytesRangeTest.cpp
test/BytesRangeTest.cpp
+7
-7
CommonTests.h
test/CommonTests.h
+2
-2
DotCallTest.cpp
test/DotCallTest.cpp
+17
-17
GroupByRangeTest.cpp
test/GroupByRangeTest.cpp
+3
-3
IterRangeTest.cpp
test/IterRangeTest.cpp
+1
-1
LinqTest.cpp
test/LinqTest.cpp
+4
-4
OrderByRangeTest.cpp
test/OrderByRangeTest.cpp
+1
-1
SkipRangeTest.cpp
test/SkipRangeTest.cpp
+6
-6
SkipWhileRangeTest.cpp
test/SkipWhileRangeTest.cpp
+10
-10
TakeRangeTest.cpp
test/TakeRangeTest.cpp
+3
-3
TakeWhileRangeTest.cpp
test/TakeWhileRangeTest.cpp
+10
-10
UnbitsRangeTest.cpp
test/UnbitsRangeTest.cpp
+2
-2
UnbytesRangeTest.cpp
test/UnbytesRangeTest.cpp
+5
-5
WhereRangeTest.cpp
test/WhereRangeTest.cpp
+3
-3
No files found.
.gitignore
View file @
ecab6f46
...
...
@@ -7,3 +7,5 @@ ipch
*.suo
[Bb]uild*
nbproject
.idea
cmake-build-debug
include/boolinq/boolinq.h
View file @
ecab6f46
This diff is collapsed.
Click to expand it.
include/boolinq/boolinq_old.h
0 → 100644
View file @
ecab6f46
This diff is collapsed.
Click to expand it.
test/AvgTest.cpp
View file @
ecab6f46
...
...
@@ -47,5 +47,5 @@ TEST(Avg, FiveStringsLen)
auto
rng
=
from
(
src
);
EXPECT_EQ
(
5
,
rng
.
avg
<
int
>
([](
const
std
::
string
&
str
){
return
str
.
size
();}));
EXPECT_EQ
(
5
,
rng
.
avg
([](
const
std
::
string
&
str
){
return
str
.
size
();}));
}
test/BitsRangeTest.cpp
View file @
ecab6f46
...
...
@@ -27,7 +27,7 @@ TEST(BitsRange, OneByteHL)
int
ans
[]
=
{
1
,
0
,
1
,
0
,
1
,
0
,
1
,
0
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
bits
(
HighToLow
);
auto
dst
=
rng
.
bits
(
Bits
HighToLow
);
CheckRangeEqArray
(
dst
,
ans
);
}
...
...
@@ -38,7 +38,7 @@ TEST(BitsRange, OneByteLH)
int
ans
[]
=
{
0
,
1
,
0
,
1
,
0
,
1
,
0
,
1
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
bits
(
LowToHigh
);
auto
dst
=
rng
.
bits
(
Bits
LowToHigh
);
CheckRangeEqArray
(
dst
,
ans
);
}
...
...
@@ -74,7 +74,7 @@ TEST(BitsRange, OneIntHL)
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
bits
(
HighToLow
);
auto
dst
=
rng
.
bits
(
Bits
HighToLow
);
CheckRangeEqArray
(
dst
,
ans
);
}
...
...
@@ -91,8 +91,8 @@ TEST(BitsRange, OneIntLH)
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
bits
(
LowToHigh
,
FirstToLast
);
auto
vvv
=
dst
.
toVector
();
auto
dst
=
rng
.
bits
(
BitsLowToHigh
,
Bytes
FirstToLast
);
auto
vvv
=
dst
.
to
Std
Vector
();
CheckRangeEqArray
(
dst
,
ans
);
}
...
...
@@ -138,7 +138,7 @@ TEST(BitsRange, IntsHL)
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
bits
(
HighToLow
);
auto
dst
=
rng
.
bits
(
Bits
HighToLow
);
CheckRangeEqArray
(
dst
,
ans
);
}
...
...
@@ -160,7 +160,7 @@ TEST(BitsRange, IntsLH)
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
bits
(
LowToHigh
);
auto
dst
=
rng
.
bits
(
Bits
LowToHigh
);
CheckRangeEqArray
(
dst
,
ans
);
}
test/BytesRangeTest.cpp
View file @
ecab6f46
...
...
@@ -27,7 +27,7 @@ TEST(BytesRange, OneByteFL)
int
ans
[]
=
{
0xAA
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
bytes
(
FirstToLast
);
auto
dst
=
rng
.
bytes
(
Bytes
FirstToLast
);
CheckRangeEqArray
(
dst
,
ans
);
}
...
...
@@ -38,7 +38,7 @@ TEST(BytesRange, OneByteLF)
int
ans
[]
=
{
0xAA
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
bytes
(
LastToFirst
);
auto
dst
=
rng
.
bytes
(
Bytes
LastToFirst
);
CheckRangeEqArray
(
dst
,
ans
);
}
...
...
@@ -62,7 +62,7 @@ TEST(BytesRange, OneIntFL)
int
ans
[]
=
{
0x78
,
0x56
,
0x34
,
0x12
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
bytes
(
FirstToLast
);
auto
dst
=
rng
.
bytes
(
Bytes
FirstToLast
);
CheckRangeEqArray
(
dst
,
ans
);
}
...
...
@@ -73,7 +73,7 @@ TEST(BytesRange, OneIntLF)
int
ans
[]
=
{
0x12
,
0x34
,
0x56
,
0x78
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
bytes
(
LastToFirst
);
auto
dst
=
rng
.
bytes
(
Bytes
LastToFirst
);
CheckRangeEqArray
(
dst
,
ans
);
}
...
...
@@ -90,7 +90,7 @@ TEST(BytesRange, IntsDefault)
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
bytes
(
FirstToLast
);
auto
dst
=
rng
.
bytes
(
Bytes
FirstToLast
);
CheckRangeEqArray
(
dst
,
ans
);
}
...
...
@@ -105,7 +105,7 @@ TEST(BytesRange, IntsFL)
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
bytes
(
FirstToLast
);
auto
dst
=
rng
.
bytes
(
Bytes
FirstToLast
);
CheckRangeEqArray
(
dst
,
ans
);
}
...
...
@@ -120,7 +120,7 @@ TEST(BytesRange, IntsLF)
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
bytes
(
LastToFirst
);
auto
dst
=
rng
.
bytes
(
Bytes
LastToFirst
);
CheckRangeEqArray
(
dst
,
ans
);
}
test/CommonTests.h
View file @
ecab6f46
...
...
@@ -16,7 +16,7 @@ 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_THROW
(
dst
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
template
<
typename
R
,
typename
T
,
unsigned
N
>
...
...
@@ -25,7 +25,7 @@ void CheckRangeEqArray(R dst, T (&ans)[N])
for
(
unsigned
i
=
0
;
i
<
N
;
i
++
)
EXPECT_EQ
(
ans
[
i
],
dst
.
nextObject
());
EXPECT_THROW
(
dst
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
template
<
typename
T
,
unsigned
N
>
...
...
test/DotCallTest.cpp
View file @
ecab6f46
...
...
@@ -27,8 +27,8 @@ TEST(DotCall, BytesRange)
};
auto
dstFL1
=
from
(
src
).
bytes
();
auto
dstFL2
=
from
(
src
).
bytes
(
FirstToLast
);
auto
dstLF1
=
from
(
src
).
bytes
(
LastToFirst
);
auto
dstFL2
=
from
(
src
).
bytes
(
Bytes
FirstToLast
);
auto
dstLF1
=
from
(
src
).
bytes
(
Bytes
LastToFirst
);
CheckRangeEqArray
(
dstFL1
,
ansFL
);
CheckRangeEqArray
(
dstFL2
,
ansFL
);
...
...
@@ -48,8 +48,8 @@ TEST(DotCall, UnbytesRange)
unsigned
ansLF
[]
=
{
0x78563412
,
0xDDCCBBAA
};
auto
dstFL1
=
from
(
src
).
unbytes
<
unsigned
>
();
auto
dstFL2
=
from
(
src
).
unbytes
<
unsigned
>
(
FirstToLast
);
auto
dstLF1
=
from
(
src
).
unbytes
<
unsigned
>
(
LastToFirst
);
auto
dstFL2
=
from
(
src
).
unbytes
<
unsigned
>
(
Bytes
FirstToLast
);
auto
dstLF1
=
from
(
src
).
unbytes
<
unsigned
>
(
Bytes
LastToFirst
);
CheckRangeEqArray
(
dstFL1
,
ansFL
);
CheckRangeEqArray
(
dstFL2
,
ansFL
);
...
...
@@ -77,9 +77,9 @@ TEST(DotCall, BitsRangeHL)
};
auto
dstFL1
=
from
(
src
).
bits
();
auto
dstFL2
=
from
(
src
).
bits
(
HighToLow
);
auto
dstFL3
=
from
(
src
).
bits
(
HighToLow
,
FirstToLast
);
auto
dstLF1
=
from
(
src
).
bits
(
HighToLow
,
LastToFirst
);
auto
dstFL2
=
from
(
src
).
bits
(
Bits
HighToLow
);
auto
dstFL3
=
from
(
src
).
bits
(
BitsHighToLow
,
Bytes
FirstToLast
);
auto
dstLF1
=
from
(
src
).
bits
(
BitsHighToLow
,
Bytes
LastToFirst
);
CheckRangeEqArray
(
dstFL1
,
ansFL
);
CheckRangeEqArray
(
dstFL2
,
ansFL
);
...
...
@@ -105,9 +105,9 @@ TEST(DotCall, BitsRangeLH)
1
,
0
,
1
,
1
,
1
,
0
,
1
,
1
,
};
auto
dstFL1
=
from
(
src
).
bits
(
LowToHigh
);
auto
dstFL2
=
from
(
src
).
bits
(
LowToHigh
,
FirstToLast
);
auto
dstLF1
=
from
(
src
).
bits
(
LowToHigh
,
LastToFirst
);
auto
dstFL1
=
from
(
src
).
bits
(
Bits
LowToHigh
);
auto
dstFL2
=
from
(
src
).
bits
(
BitsLowToHigh
,
Bytes
FirstToLast
);
auto
dstLF1
=
from
(
src
).
bits
(
BitsLowToHigh
,
Bytes
LastToFirst
);
CheckRangeEqArray
(
dstFL1
,
ansFL
);
CheckRangeEqArray
(
dstFL2
,
ansFL
);
...
...
@@ -130,10 +130,10 @@ TEST(DotCall, UnbitsRangeHLFL)
unsigned
ansLF_1i
[]
=
{
0xDDCCBBAA
};
auto
dst1_4b
=
from
(
src
).
unbits
();
auto
dst2_4b
=
from
(
src
).
unbits
(
HighToLow
);
auto
dst1_1i
=
from
(
src
).
unbits
<
unsigned
>
(
HighToLow
);
auto
dst2_1i
=
from
(
src
).
unbits
<
unsigned
>
(
HighToLow
,
FirstToLast
);
auto
dst3_1i
=
from
(
src
).
unbits
<
unsigned
>
(
HighToLow
,
LastToFirst
);
auto
dst2_4b
=
from
(
src
).
unbits
(
Bits
HighToLow
);
auto
dst1_1i
=
from
(
src
).
unbits
<
unsigned
>
(
Bits
HighToLow
);
auto
dst2_1i
=
from
(
src
).
unbits
<
unsigned
>
(
BitsHighToLow
,
Bytes
FirstToLast
);
auto
dst3_1i
=
from
(
src
).
unbits
<
unsigned
>
(
BitsHighToLow
,
Bytes
LastToFirst
);
CheckRangeEqArray
(
dst1_4b
,
ans_4b
);
CheckRangeEqArray
(
dst2_4b
,
ans_4b
);
...
...
@@ -160,9 +160,9 @@ TEST(DotCall, UnbitsRangeHLFL)
// 1,0,1,1,1,0,1,1,
// };
//
// auto dstFL1 = from(src).bits<LowToHigh>();
// auto dstFL2 = from(src).bits<
LowToHigh,
FirstToLast>();
// auto dstLF1 = from(src).bits<
LowToHigh,
LastToFirst>();
// auto dstFL1 = from(src).bits<
Bits
LowToHigh>();
// auto dstFL2 = from(src).bits<
BitsLowToHigh,Bytes
FirstToLast>();
// auto dstLF1 = from(src).bits<
BitsLowToHigh,Bytes
LastToFirst>();
//
// CheckRangeEqArray(dstFL1, ansFL);
// CheckRangeEqArray(dstFL2, ansFL);
...
...
test/GroupByRangeTest.cpp
View file @
ecab6f46
...
...
@@ -41,7 +41,7 @@ TEST(GroupByRange, IntsFront)
CheckRangeEqArray(dst.back(), ans_0);
CheckRangeEqArray(dst.popFront(), ans_0);
EXPECT_THROW(dst.nextObject(),
Enumerator
EndException);
EXPECT_THROW(dst.nextObject(),
Linq
EndException);
}
TEST(GroupByRange, IntsBack)
...
...
@@ -73,7 +73,7 @@ TEST(GroupByRange, IntsBack)
CheckRangeEqArray(dst.back(), ans_1);
CheckRangeEqArray(dst.popBack(), ans_1);
EXPECT_THROW(dst.nextObject(),
Enumerator
EndException);
EXPECT_THROW(dst.nextObject(),
Linq
EndException);
}
//////////////////////////////////////////////////////////////////////////
...
...
@@ -126,7 +126,7 @@ TEST(GroupByRange, CountChildrenByAge)
CheckRangeEqArray(dst.back(), ans_true);
CheckRangeEqArray(dst.popFront(), ans_true);
EXPECT_THROW(dst.nextObject(),
Enumerator
EndException);
EXPECT_THROW(dst.nextObject(),
Linq
EndException);
}
*/
test/IterRangeTest.cpp
View file @
ecab6f46
...
...
@@ -126,5 +126,5 @@ TEST(IterRange, EmptyVector)
auto
rng
=
from
(
src
);
EXPECT_THROW
(
rng
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
rng
.
nextObject
(),
Linq
EndException
);
}
test/LinqTest.cpp
View file @
ecab6f46
...
...
@@ -28,7 +28,7 @@ TEST(Linq, WhereOdd)
EXPECT_EQ
(
i
,
rng
.
nextObject
());
}
EXPECT_THROW
(
rng
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
rng
.
nextObject
(),
Linq
EndException
);
}
TEST
(
Linq
,
WhereOdd_WhereLess
)
...
...
@@ -51,7 +51,7 @@ TEST(Linq, WhereOdd_WhereLess)
EXPECT_EQ
(
i
,
rng
.
nextObject
());
}
EXPECT_THROW
(
rng
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
rng
.
nextObject
(),
Linq
EndException
);
}
TEST
(
Linq
,
WhereLess_WhereOdd
)
...
...
@@ -215,7 +215,7 @@ TEST(Linq, Pointer_Front)
EXPECT_EQ
(
i
,
dst
.
nextObject
());
}
EXPECT_THROW
(
dst
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
...
...
@@ -232,7 +232,7 @@ TEST(Linq, Array_Front)
EXPECT_EQ
(
i
,
dst
.
nextObject
());
}
EXPECT_THROW
(
dst
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
//////////////////////////////////////////////////////////////////////////
...
...
test/OrderByRangeTest.cpp
View file @
ecab6f46
...
...
@@ -63,7 +63,7 @@ TEST(OrderByRange, NoElements)
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
orderBy
();
EXPECT_THROW
(
dst
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
//////////////////////////////////////////////////////////////////////////
...
...
test/SkipRangeTest.cpp
View file @
ecab6f46
...
...
@@ -50,7 +50,7 @@ TEST(SkipRange, ManyToZero)
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
skip
(
6
);
EXPECT_THROW
(
dst
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
TEST
(
SkipRange
,
ManyToZeroLess
)
...
...
@@ -60,7 +60,7 @@ TEST(SkipRange, ManyToZeroLess)
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
skip
(
10
);
EXPECT_THROW
(
dst
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
//////////////////////////////////////////////////////////////////////////
...
...
@@ -83,7 +83,7 @@ TEST(SkipRange, OneToZero)
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
skip
(
1
);
EXPECT_THROW
(
dst
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
TEST
(
SkipRange
,
OneToZeroLess
)
...
...
@@ -93,7 +93,7 @@ TEST(SkipRange, OneToZeroLess)
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
skip
(
2
);
EXPECT_THROW
(
dst
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
TEST
(
SkipRange
,
ZeroToZero
)
...
...
@@ -103,7 +103,7 @@ TEST(SkipRange, ZeroToZero)
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
skip
(
0
);
EXPECT_THROW
(
rng
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
rng
.
nextObject
(),
Linq
EndException
);
}
TEST
(
SkipRange
,
ZeroToZeroLess
)
...
...
@@ -113,7 +113,7 @@ TEST(SkipRange, ZeroToZeroLess)
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
skip
(
2
);
EXPECT_THROW
(
rng
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
rng
.
nextObject
(),
Linq
EndException
);
}
//////////////////////////////////////////////////////////////////////////
test/SkipWhileRangeTest.cpp
View file @
ecab6f46
...
...
@@ -194,7 +194,7 @@ TEST(SkipWhileRange, ManyToZero)
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
skipWhile
([](
int
it
){
return
it
>
0
;});
EXPECT_THROW
(
dst
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
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
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
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
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
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
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
//////////////////////////////////////////////////////////////////////////
...
...
@@ -280,7 +280,7 @@ TEST(SkipWhileRange, OneToZero)
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
skipWhile
([](
int
it
){
return
it
==
5
;});
EXPECT_THROW
(
dst
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
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
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
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
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
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
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
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
(),
Enumerator
EndException
);
EXPECT_THROW
(
rng
.
nextObject
(),
Linq
EndException
);
}
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
(),
Enumerator
EndException
);
EXPECT_THROW
(
rng
.
nextObject
(),
Linq
EndException
);
}
//////////////////////////////////////////////////////////////////////////
test/TakeRangeTest.cpp
View file @
ecab6f46
...
...
@@ -61,7 +61,7 @@ TEST(TakeRange, ManyToZero)
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
take
(
0
);
EXPECT_THROW
(
dst
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
//////////////////////////////////////////////////////////////////////////
...
...
@@ -95,7 +95,7 @@ TEST(TakeRange, OneToZero)
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
take
(
0
);
EXPECT_THROW
(
dst
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
TEST
(
TakeRange
,
ZeroToZero
)
...
...
@@ -105,7 +105,7 @@ TEST(TakeRange, ZeroToZero)
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
take
(
0
);
EXPECT_THROW
(
rng
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
rng
.
nextObject
(),
Linq
EndException
);
}
//////////////////////////////////////////////////////////////////////////
test/TakeWhileRangeTest.cpp
View file @
ecab6f46
...
...
@@ -193,7 +193,7 @@ TEST(TakeWhileRange, ManyToZero)
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
takeWhile
([](
int
it
){
return
it
<
0
;});
EXPECT_THROW
(
dst
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
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
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
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
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
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
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
//////////////////////////////////////////////////////////////////////////
...
...
@@ -279,7 +279,7 @@ TEST(TakeWhileRange, OneToZero)
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
takeWhile
([](
int
){
return
false
;});
EXPECT_THROW
(
dst
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
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
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
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
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
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
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
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
(),
Enumerator
EndException
);
EXPECT_THROW
(
rng
.
nextObject
(),
Linq
EndException
);
}
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
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
//////////////////////////////////////////////////////////////////////////
test/UnbitsRangeTest.cpp
View file @
ecab6f46
...
...
@@ -27,7 +27,7 @@ TEST(UnbitsRange, OneByteHL)
int
ans
[]
=
{
0xAA
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
unbits
(
HighToLow
);
auto
dst
=
rng
.
unbits
(
Bits
HighToLow
);
CheckRangeEqArray
(
dst
,
ans
);
}
...
...
@@ -38,7 +38,7 @@ TEST(UnbitsRange, OneByteLH)
int
ans
[]
=
{
0xAA
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
unbits
(
LowToHigh
);
auto
dst
=
rng
.
unbits
(
Bits
LowToHigh
);
CheckRangeEqArray
(
dst
,
ans
);
}
test/UnbytesRangeTest.cpp
View file @
ecab6f46
...
...
@@ -27,7 +27,7 @@ TEST(UnbytesRange, OneIntFL)
unsigned
ans
[]
=
{
0xDDCCBBAA
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
unbytes
<
unsigned
>
(
FirstToLast
);
auto
dst
=
rng
.
unbytes
<
unsigned
>
(
Bytes
FirstToLast
);
CheckRangeEqArray
(
dst
,
ans
);
}
...
...
@@ -38,7 +38,7 @@ TEST(UnbytesRange, OneIntLF)
unsigned
ans
[]
=
{
0xAABBCCDD
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
unbytes
<
unsigned
>
(
LastToFirst
);
auto
dst
=
rng
.
unbytes
<
unsigned
>
(
Bytes
LastToFirst
);
CheckRangeEqArray
(
dst
,
ans
);
}
...
...
@@ -70,7 +70,7 @@ TEST(UnbytesRange, TwoIntsFL)
unsigned
ans
[]
=
{
0x12345678
,
0xDDCCBBAA
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
unbytes
<
unsigned
>
(
FirstToLast
);
auto
dst
=
rng
.
unbytes
<
unsigned
>
(
Bytes
FirstToLast
);
CheckRangeEqArray
(
dst
,
ans
);
}
...
...
@@ -85,7 +85,7 @@ TEST(UnbytesRange, TwoIntsLF)
unsigned
ans
[]
=
{
0x78563412
,
0xAABBCCDD
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
unbytes
<
unsigned
>
(
LastToFirst
);
auto
dst
=
rng
.
unbytes
<
unsigned
>
(
Bytes
LastToFirst
);
CheckRangeEqArray
(
dst
,
ans
);
}
...
...
@@ -99,5 +99,5 @@ TEST(UnbytesRange, EmptyDefault)
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
unbytes
<
int
>
();
EXPECT_THROW
(
dst
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
test/WhereRangeTest.cpp
View file @
ecab6f46
...
...
@@ -108,7 +108,7 @@ TEST(WhereRange, ManyToZero)
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
where
([](
int
a
){
return
a
==
5
;});
EXPECT_THROW
(
dst
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
TEST
(
WhereRange
,
OneToZero
)
...
...
@@ -118,7 +118,7 @@ TEST(WhereRange, OneToZero)
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
where
(
[](
int
a
){
return
a
>
10
;});
EXPECT_THROW
(
dst
.
nextObject
(),
Enumerator
EndException
);
EXPECT_THROW
(
dst
.
nextObject
(),
Linq
EndException
);
}
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
(),
Enumerator
EndException
);
EXPECT_THROW
(
rng
.
nextObject
(),
Linq
EndException
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment