Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
Vector 2023
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIOLA Anthony
Vector 2023
Commits
9c41c77e
Commit
9c41c77e
authored
Sep 18, 2023
by
VIOLA Anthony
Browse files
Options
Downloads
Patches
Plain Diff
TP1
parent
763c886c
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#16668
failed
Sep 18, 2023
Stage: test
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/Vector.java
+3
-2
3 additions, 2 deletions
src/main/java/Vector.java
src/test/java/VectorTest.java
+9
-9
9 additions, 9 deletions
src/test/java/VectorTest.java
with
12 additions
and
11 deletions
src/main/java/Vector.java
+
3
−
2
View file @
9c41c77e
...
...
@@ -78,7 +78,7 @@ public class Vector {
* @return liste vide ou non
*/
public
boolean
isEmpty
()
{
return
elements
.
length
==
0
;
return
this
.
size
==
0
;
}
/**
* ajoute l'entier element à la fin du vecteur.
...
...
@@ -87,7 +87,8 @@ public class Vector {
*/
public
void
add
(
int
element
)
{
if
(!
isEmpty
()){
elements
[
capacity
()-
1
]
=
element
;
this
.
elements
[
this
.
size
]
=
element
;
size
+=
1
;
}
}
/**
...
...
This diff is collapsed.
Click to expand it.
src/test/java/VectorTest.java
+
9
−
9
View file @
9c41c77e
...
...
@@ -36,25 +36,23 @@ public class VectorTest {
}
@Test
@Disabled
void
testEnsureCapacity_CapacitySatisfied
()
{
Vector
vector
=
new
Vector
(
23
);
vector
.
ensureCapacity
(
120
);
assertThat
(
vector
.
capacity
()).
isEqualTo
(
120
);
// TODO : add code
fail
(
"not yet implemented"
);
}
@Test
@Disabled
void
testResize
()
{
Vector
vector
=
new
Vector
();
vector
.
resize
(
120
);
vector
.
add
(
2
);
assertThat
(
vector
.
get
(
119
)).
isEqualTo
(
2
);
// TODO : add code
fail
(
"not yet implemented"
);
}
@Test
@Disabled
void
testResize_Zeros
()
{
Vector
vector
=
new
Vector
(
1
);
vector
.
add
(
2
);
...
...
@@ -73,22 +71,24 @@ public class VectorTest {
@Test
@Disabled
void
testResize_CapacityNeverDecreaseWhenSizeDecrease
()
{
Vector
vector
=
new
Vector
(
8
);
vector
.
add
(
1
);
vector
.
add
(
3
);
vector
.
add
(
12
);
// TODO : add code
fail
(
"not yet implemented"
);
}
@Test
@Disabled
void
testIsEmpty
()
{
Vector
vector
=
new
Vector
();
assertThat
(
vector
.
isEmpty
()).
isTrue
();
vector
.
resize
(
12
);
// TODO : add code
fail
(
"not yet implemented"
);
assertThat
(
vector
.
isEmpty
()).
isFalse
();
}
@Test
@Disabled
void
testAdd
()
{
Vector
vector
=
new
Vector
();
vector
.
add
(
12
);
...
...
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