Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
las3_pub
/
predictable_parallel_patterns
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ee8414cf
authored
Jun 14, 2019
by
FritzFlorian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for scan.
parent
ce936ae6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
test/algorithm_test.cpp
+18
-0
No files found.
test/algorithm_test.cpp
View file @
ee8414cf
...
...
@@ -43,3 +43,21 @@ TEST_CASE("for_each functions correctly", "[algorithms/for_each.h]") {
}
});
}
TEST_CASE
(
"scan functions correctly"
,
"[algorithms/scan.h]"
)
{
malloc_scheduler_memory
my_scheduler_memory
{
8
,
2
<<
12
};
scheduler
my_scheduler
{
&
my_scheduler_memory
,
2
};
my_scheduler
.
perform_work
([]()
{
constexpr
int
SIZE
=
1000
;
std
::
array
<
int
,
SIZE
>
input_array
{},
result_array
{};
input_array
.
fill
(
1
);
pls
::
scan
(
input_array
.
begin
(),
input_array
.
end
(),
result_array
.
begin
(),
std
::
plus
<
int
>
(),
0
);
bool
all_correct
=
true
;
for
(
int
i
=
0
;
i
<
SIZE
;
i
++
)
{
all_correct
&=
result_array
[
i
]
==
(
i
+
1
);
}
REQUIRE
(
all_correct
);
});
}
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