|
@ -135,4 +135,15 @@ class StudentTest { |
|
|
assertEquals(expectedAverage, student.calculateAverageGrade(), 0.01, "The calculated average grade is incorrect."); |
|
|
assertEquals(expectedAverage, student.calculateAverageGrade(), 0.01, "The calculated average grade is incorrect."); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void testStudentPasses() { |
|
|
|
|
|
Student student = new Student("John Doe", "S1001", "Student"); |
|
|
|
|
|
Course math = new Course("Math", "C101", 5); // Assuming 5 credits |
|
|
|
|
|
Course physics = new Course("Physics", "C102", 5); // Assuming 5 credits |
|
|
|
|
|
student.assignGrade(math, "15"); // Assuming grade is a String. Adjust if it's numeric. |
|
|
|
|
|
student.assignGrade(physics, "10"); |
|
|
|
|
|
|
|
|
|
|
|
assertTrue(student.hasPassed(), "Student should have passed."); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |