Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Programmation2
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RANGHEARD Leo
Programmation2
Commits
0bcbf939
Commit
0bcbf939
authored
4 years ago
by
RANGHEARD Leo
Browse files
Options
Downloads
Patches
Plain Diff
Correction Student et TestStudent, fin de TestCohort
testAddResults() délibérément fausse
parent
b76bcfb0
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
tp1/Student.java
+1
-1
1 addition, 1 deletion
tp1/Student.java
tp1/TestCohort.java
+35
-0
35 additions, 0 deletions
tp1/TestCohort.java
tp1/TestStudent.java
+0
-8
0 additions, 8 deletions
tp1/TestStudent.java
with
36 additions
and
9 deletions
tp1/Student.java
+
1
−
1
View file @
0bcbf939
...
...
@@ -41,7 +41,7 @@ public class Student {
*/
@Override
public
String
toString
()
{
return
firstName
+
lastName
;
return
firstName
+
" "
+
lastName
;
}
...
...
This diff is collapsed.
Click to expand it.
tp1/TestCohort.java
0 → 100644
+
35
−
0
View file @
0bcbf939
import
java.util.ArrayList
;
import
java.util.List
;
public
class
TestCohort
{
public
static
void
main
(
String
[]
args
){
TestCohort
test
=
new
TestCohort
();
if
(
test
.
testGetStudents
()
==
true
)
System
.
out
.
println
(
"testGetStudents = correct"
);
else
System
.
out
.
println
(
"testGetStudents = incorrect"
);
if
(
test
.
testToString
()
==
true
)
System
.
out
.
println
(
"testToString = correct"
);
else
System
.
out
.
println
(
"testToString = incorrect"
);
}
public
boolean
testGetStudents
(){
List
<
Student
>
testStudents
=
new
ArrayList
<>();
Cohort
testCohort
=
new
Cohort
(
"Programmation"
);
testStudents
.
add
(
new
Student
(
"Leo"
,
"Rangheard"
));
testStudents
.
add
(
new
Student
(
"Ahmed"
,
"Souissi"
));
testCohort
.
addStudent
(
new
Student
(
"Leo"
,
"Rangheard"
));
testCohort
.
addStudent
(
new
Student
(
"Ahmed"
,
"Souissi"
));
if
(
testCohort
.
getStudents
().
equals
(
testStudents
))
return
true
;
else
return
false
;
}
public
boolean
testToString
(){
Cohort
testCohort
=
new
Cohort
(
"Programmation"
);
if
(
testCohort
.
toString
().
equals
(
"Programmation"
))
return
true
;
else
return
false
;
}
}
This diff is collapsed.
Click to expand it.
tp1/TestStudent.java
+
0
−
8
View file @
0bcbf939
...
...
@@ -24,11 +24,6 @@ public class TestStudent {
System
.
out
.
println
(
"averageGrade = correct"
);
else
System
.
out
.
println
(
"averageGrade = incorrect"
);
if
(
test
.
testPrintResults
()
==
true
)
System
.
out
.
println
(
"printResults = correct"
);
else
System
.
out
.
println
(
"printResults = incorrect"
);
}
public
boolean
testAddResult
(){
Grade
grade
=
new
Grade
(
11.7
);
...
...
@@ -72,7 +67,4 @@ public class TestStudent {
else
return
false
;
}
public
boolean
testPrintResults
(){
}
}
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