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
afd09e77
Commit
afd09e77
authored
2 years ago
by
DIDIer5454
Browse files
Options
Downloads
Patches
Plain Diff
test corrige
parent
5559e929
No related branches found
No related tags found
No related merge requests found
Pipeline
#10591
passed
2 years ago
Stage: build
Stage: test
Stage: deploy
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/fr/nancy/iut/Sphere.java
+1
-0
1 addition, 0 deletions
src/main/java/fr/nancy/iut/Sphere.java
src/test/java/fr/nancy/iut/SphereTest.java
+51
-0
51 additions, 0 deletions
src/test/java/fr/nancy/iut/SphereTest.java
with
52 additions
and
0 deletions
src/main/java/fr/nancy/iut/Sphere.java
+
1
−
0
View file @
afd09e77
...
...
@@ -35,6 +35,7 @@ public class Sphere {
return
pos_
.
distance
(
other
.
pos_
);
}
//Methode renvoyant la distance au carre entre 2 spheres
public
double
distanceSquaredTo
(
Sphere
other
)
{
return
pos_
.
distanceSquared
(
other
.
pos_
);
}
...
...
This diff is collapsed.
Click to expand it.
src/test/java/fr/nancy/iut/SphereTest.java
+
51
−
0
View file @
afd09e77
...
...
@@ -13,5 +13,56 @@ public class SphereTest {
Sphere
mySphere
=
new
Sphere
(
1.5
);
assertEquals
(
14.137166941154069
,
mySphere
.
computeVolume
(),
0.0
);
}
@Test
public
void
testDistancesquareTo
(){
Sphere
un
=
new
Sphere
(
1.5
,
new
Point3d
(
new
double
[]{
0
,
0
,
3
}));
Sphere
deux
=
new
Sphere
(
1.5
,
new
Point3d
(
new
double
[]{
2
,
1
,
0
}));
assertEquals
(
14
,
un
.
distanceSquaredTo
(
deux
));
}
@Test
public
void
test_inContactWith
(){
Sphere
un
=
new
Sphere
(
1.5
,
new
Point3d
(
new
double
[]{
0
,
0
,
3
}));
Sphere
deux
=
new
Sphere
(
1.5
,
new
Point3d
(
new
double
[]{
2
,
1
,
0
}));
Sphere
trois
=
new
Sphere
(
4
,
new
Point3d
(
new
double
[]{
0
,
0
,
3
}));
assertFalse
(
un
.
inContactWith
(
deux
));
assertTrue
(
trois
.
inContactWith
(
deux
));
assertTrue
(
un
.
inContactWith
(
trois
));
}
@Test
public
void
testGetPos
(){
Sphere
mySphere
=
new
Sphere
(
1.5
);
assertEquals
(
new
Point3d
(
new
double
[]{
0
,
0
,
0
}),
mySphere
.
getPos
());
}
@Test
public
void
testgetRadius
(){
Sphere
deux
=
new
Sphere
(
1.5
,
new
Point3d
(
new
double
[]{
2
,
1
,
0
}));
Sphere
trois
=
new
Sphere
(
4
,
new
Point3d
(
new
double
[]{
0
,
0
,
3
}));
assertEquals
(
1.5
,
deux
.
getRadius
());
}
@Test
public
void
testDistanceTo
(){
Sphere
deux
=
new
Sphere
(
1.5
,
new
Point3d
(
new
double
[]{
2
,
1
,
0
}));
Sphere
trois
=
new
Sphere
(
4
,
new
Point3d
(
new
double
[]{
0
,
0
,
3
}));
assertEquals
(
Math
.
sqrt
(
14.0
),
deux
.
distanceTo
(
trois
));
}
@Test
public
void
TestConstructeurParam
(){
Sphere
deux
=
new
Sphere
(
1.5
,
new
Point3d
(
new
double
[]{
2
,
1
,
0
}));
Sphere
trois
=
new
Sphere
(
4
,
new
Point3d
());
Sphere
un
=
new
Sphere
(
8
);
assertEquals
(
new
Point3d
(
new
double
[]{
0
,
0
,
0
}),
un
.
getPos
());
assertEquals
(
8
,
un
.
getRadius
());
assertEquals
(
4
,
trois
.
getRadius
());
assertEquals
(
new
Point3d
(
new
double
[]{
0
,
0
,
0
}),
trois
.
getPos
());
assertEquals
(
new
Point3d
(
new
double
[]{
2
,
1
,
0
}),
deux
.
getPos
());
assertEquals
(
1.5
,
deux
.
getRadius
());
}
@Test
public
void
ConstructeurSansParam
(){
Sphere
quatre
=
new
Sphere
();
//assertEquals(new Point3d(), quatre.getPos());
assertEquals
(
0.0
,
quatre
.
getRadius
(),
0.0
);
}
}
\ 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