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
0c21a0ca
Commit
0c21a0ca
authored
May 12, 2016
by
Vit Babel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IterRangeTest: add tests for more linq-creators
parent
cf6de211
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
IterRangeTest.cpp
test/IterRangeTest.cpp
+36
-0
No files found.
test/IterRangeTest.cpp
View file @
0c21a0ca
...
...
@@ -2,6 +2,9 @@
#include <deque>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <array>
#include <gtest/gtest.h>
#include "CommonTests.h"
...
...
@@ -60,6 +63,39 @@ TEST(IterRange, VectorInt)
CheckRangeEqArray
(
from
<
int
>
(
vec
.
cbegin
(),
vec
.
cend
()),
ans
);
}
TEST
(
IterRange
,
SetInt
)
{
std
::
set
<
int
>
set
=
{
1
,
2
,
3
,
4
,
5
};
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
);
}
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
,
StdArrayInt
)
{
std
::
array
<
int
,
5
>
arr
=
{
1
,
2
,
3
,
4
,
5
};
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
);
}
TEST
(
IterRange
,
ArrayInt
)
{
int
arr
[]
=
{
1
,
2
,
3
,
4
,
5
};
...
...
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