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
08fb44cc
Commit
08fb44cc
authored
Jul 01, 2019
by
Anton Bukov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add SelectMany tests
parent
d110077e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
+35
-0
CMakeLists.txt
test/CMakeLists.txt
+1
-0
SelectManyTest.cpp
test/SelectManyTest.cpp
+34
-0
No files found.
test/CMakeLists.txt
View file @
08fb44cc
...
@@ -42,6 +42,7 @@ SET (
...
@@ -42,6 +42,7 @@ SET (
${
PROJECT_SOURCE_DIR
}
/test/PrependTest.cpp
${
PROJECT_SOURCE_DIR
}
/test/PrependTest.cpp
${
PROJECT_SOURCE_DIR
}
/test/ReverseTest.cpp
${
PROJECT_SOURCE_DIR
}
/test/ReverseTest.cpp
${
PROJECT_SOURCE_DIR
}
/test/SelectTest.cpp
${
PROJECT_SOURCE_DIR
}
/test/SelectTest.cpp
${
PROJECT_SOURCE_DIR
}
/test/SelectManyTest.cpp
${
PROJECT_SOURCE_DIR
}
/test/SkipTest.cpp
${
PROJECT_SOURCE_DIR
}
/test/SkipTest.cpp
${
PROJECT_SOURCE_DIR
}
/test/SkipWhileTest.cpp
${
PROJECT_SOURCE_DIR
}
/test/SkipWhileTest.cpp
${
PROJECT_SOURCE_DIR
}
/test/SumTest.cpp
${
PROJECT_SOURCE_DIR
}
/test/SumTest.cpp
...
...
test/SelectManyTest.cpp
0 → 100644
View file @
08fb44cc
#include <vector>
#include <string>
#include <gtest/gtest.h>
#include "CommonTests.h"
#include "boolinq.h"
using
namespace
boolinq
;
TEST
(
SelectMany
,
AxA
)
{
int
src
[]
=
{
1
,
2
,
3
};
int
ans
[]
=
{
1
,
2
,
2
,
3
,
3
,
3
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
selectMany
([](
int
a
){
return
repeat
(
a
,
a
);});
CheckRangeEqArray
(
dst
,
ans
);
}
TEST
(
SelectMany
,
OneTwoThree
)
{
int
src
[]
=
{
1
,
2
,
3
};
int
ans
[]
=
{
1
,
2
,
3
,
2
,
4
,
6
,
3
,
6
,
9
};
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
selectMany
([
&
src
](
int
a
){
return
from
(
src
).
select
([
a
](
int
v
){
return
a
*
v
;});
});
CheckRangeEqArray
(
dst
,
ans
);
}
\ No newline at end of file
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