Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
9dbba924
There was an error fetching the commit references. Please try again later.
Commit
9dbba924
authored
6 years ago
by
Fernando Sahmkow
Committed by
FernandoS27
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add MultiLevelQueue Tests
parent
3bc815a5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/tests/CMakeLists.txt
+1
-0
1 addition, 0 deletions
src/tests/CMakeLists.txt
src/tests/common/multi_level_queue.cpp
+55
-0
55 additions, 0 deletions
src/tests/common/multi_level_queue.cpp
with
56 additions
and
0 deletions
src/tests/CMakeLists.txt
+
1
−
0
View file @
9dbba924
add_executable
(
tests
add_executable
(
tests
common/bit_field.cpp
common/bit_field.cpp
common/bit_utils.cpp
common/bit_utils.cpp
common/multi_level_queue.cpp
common/param_package.cpp
common/param_package.cpp
common/ring_buffer.cpp
common/ring_buffer.cpp
core/arm/arm_test_common.cpp
core/arm/arm_test_common.cpp
...
...
This diff is collapsed.
Click to expand it.
src/tests/common/multi_level_queue.cpp
0 → 100644
+
55
−
0
View file @
9dbba924
// Copyright 2019 Yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include
<catch2/catch.hpp>
#include
<math.h>
#include
"common/common_types.h"
#include
"common/multi_level_queue.h"
namespace
Common
{
TEST_CASE
(
"MultiLevelQueue"
,
"[common]"
)
{
std
::
array
<
f32
,
8
>
values
=
{
0.0
,
5.0
,
1.0
,
9.0
,
8.0
,
2.0
,
6.0
,
7.0
};
Common
::
MultiLevelQueue
<
f32
,
64
>
mlq
;
REQUIRE
(
mlq
.
empty
());
mlq
.
add
(
values
[
2
],
2
);
mlq
.
add
(
values
[
7
],
7
);
mlq
.
add
(
values
[
3
],
3
);
mlq
.
add
(
values
[
4
],
4
);
mlq
.
add
(
values
[
0
],
0
);
mlq
.
add
(
values
[
5
],
5
);
mlq
.
add
(
values
[
6
],
6
);
mlq
.
add
(
values
[
1
],
1
);
u32
index
=
0
;
bool
all_set
=
true
;
for
(
auto
&
f
:
mlq
)
{
all_set
&=
(
f
==
values
[
index
]);
index
++
;
}
REQUIRE
(
all_set
);
REQUIRE
(
!
mlq
.
empty
());
f32
v
=
8.0
;
mlq
.
add
(
v
,
2
);
v
=
-
7.0
;
mlq
.
add
(
v
,
2
,
false
);
REQUIRE
(
mlq
.
front
(
2
)
==
-
7.0
);
mlq
.
yield
(
2
);
REQUIRE
(
mlq
.
front
(
2
)
==
values
[
2
]);
REQUIRE
(
mlq
.
back
(
2
)
==
-
7.0
);
REQUIRE
(
mlq
.
empty
(
8
));
v
=
10.0
;
mlq
.
add
(
v
,
8
);
mlq
.
adjust
(
v
,
8
,
9
);
REQUIRE
(
mlq
.
front
(
9
)
==
v
);
REQUIRE
(
mlq
.
empty
(
8
));
REQUIRE
(
!
mlq
.
empty
(
9
));
mlq
.
adjust
(
values
[
0
],
0
,
9
);
REQUIRE
(
mlq
.
highest_priority_set
()
==
1
);
REQUIRE
(
mlq
.
lowest_priority_set
()
==
9
);
mlq
.
remove
(
values
[
1
],
1
);
REQUIRE
(
mlq
.
highest_priority_set
()
==
2
);
REQUIRE
(
mlq
.
empty
(
1
));
}
}
// namespace Common
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment