Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sphere
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PIERRON Laurent
sphere
Commits
c0bfe28a
Commit
c0bfe28a
authored
2 years ago
by
PIERRON Laurent
Browse files
Options
Downloads
Patches
Plain Diff
Tous les tests passent. La couverture est à 100%.
parent
7dfdb4b0
No related branches found
No related tags found
No related merge requests found
Pipeline
#10538
passed
2 years ago
Stage: build
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/fr/nancy/iut/SphereTest.java
+49
-0
49 additions, 0 deletions
src/test/java/fr/nancy/iut/SphereTest.java
with
49 additions
and
0 deletions
src/test/java/fr/nancy/iut/SphereTest.java
+
49
−
0
View file @
c0bfe28a
package
fr.nancy.iut
;
package
fr.nancy.iut
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.*;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.*;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
javax.vecmath.Point3d
;
import
javax.vecmath.Point3d
;
...
@@ -8,10 +10,57 @@ import javax.vecmath.Point3d;
...
@@ -8,10 +10,57 @@ import javax.vecmath.Point3d;
* Created by dparsons on 12/08/15.
* Created by dparsons on 12/08/15.
*/
*/
class
SphereTest
{
class
SphereTest
{
private
Sphere
sphere1
;
private
Sphere
sphere2
;
private
Sphere
sphere3
;
@Test
@Test
void
testComputeVolume
()
throws
Exception
{
void
testComputeVolume
()
throws
Exception
{
Sphere
mySphere
=
new
Sphere
(
1.5
);
Sphere
mySphere
=
new
Sphere
(
1.5
);
assertEquals
(
14.137166941154069
,
mySphere
.
computeVolume
(),
0.0
);
assertEquals
(
14.137166941154069
,
mySphere
.
computeVolume
(),
0.0
);
}
}
@BeforeEach
void
setUp
()
{
sphere1
=
new
Sphere
();
sphere2
=
new
Sphere
(
3.0
);
sphere3
=
new
Sphere
(
5.0
,
new
Point3d
(
1
,
2
,
3
));
}
@Test
void
distanceTo
()
{
assertEquals
(
0.0
,
sphere1
.
distanceTo
(
sphere2
));
assertEquals
(
3.7416573867739413
,
sphere1
.
distanceTo
(
sphere3
),
0.0001
);
assertEquals
(
3.7416573867739413
,
sphere2
.
distanceTo
(
sphere3
),
0.0001
);
}
@Test
void
distanceSquaredTo
()
{
assertEquals
(
0.0
,
sphere1
.
distanceSquaredTo
(
sphere2
));
assertEquals
(
14.0
,
sphere1
.
distanceSquaredTo
(
sphere3
),
0.0001
);
assertEquals
(
14.0
,
sphere2
.
distanceSquaredTo
(
sphere3
),
0.0001
);
}
@Test
void
inContactWith
()
{
assertTrue
(
sphere1
.
inContactWith
(
sphere2
));
assertFalse
(!
sphere1
.
inContactWith
(
sphere3
));
assertFalse
(!
sphere2
.
inContactWith
(
sphere3
));
}
@Test
void
getPos
()
{
Point3d
point0
=
new
Point3d
();
Point3d
point123
=
new
Point3d
(
1
,
2
,
3
);
assertEquals
(
point0
,
sphere1
.
getPos
());
assertEquals
(
point0
,
sphere2
.
getPos
());
assertEquals
(
point123
,
sphere3
.
getPos
());
}
@Test
void
getRadius
()
{
assertEquals
(
0.0
,
sphere1
.
getRadius
());
assertEquals
(
3.0
,
sphere2
.
getRadius
());
assertEquals
(
5.0
,
sphere3
.
getRadius
());
}
}
}
\ No newline at end of file
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