Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
ScalFMM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
solverstack
ScalFMM
Commits
95ff34b8
Commit
95ff34b8
authored
9 years ago
by
Quentin Khan
Browse files
Options
Downloads
Patches
Plain Diff
Improve and extend FBasicParticle unit tests
parent
9633c02c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
UTests/utestFBasicParticle.cpp
+86
-0
86 additions, 0 deletions
UTests/utestFBasicParticle.cpp
with
86 additions
and
0 deletions
UTests/utestFBasicParticle.cpp
+
86
−
0
View file @
95ff34b8
...
...
@@ -39,6 +39,10 @@ struct test_FBasicParticle_simple {
test_variadic_constructor_overflow_failure
();
test_constructor_from_tuple
();
test_position_getter
();
test_position_setter
();
test_attribute_getter
();
test_attribute_setter
();
test_compare_equal
();
test_pull_push
();
}
...
...
@@ -170,6 +174,88 @@ struct test_FBasicParticle_simple {
assert
(
pos
!=
p
.
position
());
}
/**
* \brief Tests the position setter
*
* Expected result:
* - setting the position changes the particle position
*/
void
test_position_setter
()
{
typename
Particle
::
position_t
ref
{
1.5
,
2.5
,
3.5
};
Particle
p
(
ref
,
1
,
2
,
3
,
4
,
5
);
p
.
setPosition
({
10.25
,
11.25
,
12.25
});
assert
(
std
::
get
<
0
>
(
p
)
==
10.25
);
assert
(
std
::
get
<
1
>
(
p
)
==
11.25
);
assert
(
std
::
get
<
2
>
(
p
)
==
12.25
);
}
/**
* \brief Test compile time attribute getter
*
* Expected result:
* - the attributes are returned using indices starting from 0
*/
void
test_attribute_getter
()
{
// const
const
Particle
p1
(
std
::
make_tuple
(
1.5
,
2.5
,
3.5
,
1
,
2
,
3
,
4
,
5
));
assert
(
p1
.
attribute
<
0
>
()
==
1
);
assert
(
p1
.
attribute
<
1
>
()
==
2
);
assert
(
p1
.
attribute
<
2
>
()
==
3
);
assert
(
p1
.
attribute
<
3
>
()
==
4
);
assert
(
p1
.
attribute
<
4
>
()
==
5
);
// non const
Particle
p2
(
std
::
make_tuple
(
1.5
,
2.5
,
3.5
,
1
,
2
,
3
,
4
,
5
));
assert
(
p2
.
attribute
<
0
>
()
==
1
);
assert
(
p2
.
attribute
<
1
>
()
==
2
);
assert
(
p2
.
attribute
<
2
>
()
==
3
);
assert
(
p2
.
attribute
<
3
>
()
==
4
);
assert
(
p2
.
attribute
<
4
>
()
==
5
);
}
/**
* \brief Test compile time attribute setter
*
* Expected result:
* - the attributes are set using indices starting from 0
*/
void
test_attribute_setter
()
{
Particle
p1
(
std
::
make_tuple
(
1.5
,
2.5
,
3.5
,
0
,
0
,
0
,
0
,
0
));
p1
.
attribute
<
0
>
()
=
1
;
p1
.
attribute
<
1
>
()
=
2
;
p1
.
attribute
<
2
>
()
=
3
;
p1
.
attribute
<
3
>
()
=
4
;
p1
.
attribute
<
4
>
()
=
5
;
assert
(
p1
.
attribute
<
0
>
()
==
1
);
assert
(
p1
.
attribute
<
1
>
()
==
2
);
assert
(
p1
.
attribute
<
2
>
()
==
3
);
assert
(
p1
.
attribute
<
3
>
()
==
4
);
assert
(
p1
.
attribute
<
4
>
()
==
5
);
}
/**
* \brief Test particle comparison
*
* Expected result:
* - Two particles that have the same position and the same attributes
* compare equal.
*/
void
test_compare_equal
()
{
Particle
p1
(
std
::
make_tuple
(
1.5
,
2.5
,
3.5
,
1
,
2
,
3
,
4
,
5
));
Particle
p2
(
std
::
make_tuple
(
1.5
,
2.5
,
3.5
,
1
,
2
,
3
,
4
,
5
));
Particle
p3
(
std
::
make_tuple
(
1.5
,
2.5
,
3.5
,
1
,
2
,
0
,
4
,
5
));
Particle
p4
(
std
::
make_tuple
(
1.5
,
0
,
3.5
,
1
,
2
,
3
,
4
,
5
));
assert
(
p1
==
p2
);
assert
(
p2
==
p1
);
assert
(
p1
!=
p3
);
assert
(
p1
!=
p4
);
assert
(
p3
!=
p4
);
}
void
test_pull_push
()
{
Particle
p
({
2.3
,
3.4
,
4.5
},
5
,
6
,
7
,
8
,
9
);
...
...
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