From e195881834ec376a0fe762022074234d605b8e35 Mon Sep 17 00:00:00 2001 From: Vincent W Date: Thu, 9 Oct 2025 16:55:37 +0200 Subject: [PATCH] fix(documentation): Fix formatting --- doc/tests/ConfigManager.md | 16 ++++++++-------- doc/tests/DatabaseManager.md | 18 +++++++++--------- doc/tests/ExamResultGenerator.md | 16 ++++++++-------- doc/tests/FinalGradeDeterminator.md | 12 ++++++------ doc/tests/GradeCalculator.md | 8 ++++---- 5 files changed, 35 insertions(+), 35 deletions(-) diff --git a/doc/tests/ConfigManager.md b/doc/tests/ConfigManager.md index 192691d..71cb9a8 100644 --- a/doc/tests/ConfigManager.md +++ b/doc/tests/ConfigManager.md @@ -1,17 +1,17 @@ -## Unit Tests +# Config Manager Unit Tests Unit tests for `ConfigManager` are implemented in `src/g2_2025_grade_calculator_pkg/test/ConfigManager.test.cpp` using Google Test and ROS2 test utilities. The tests use temporary TOML files to validate configuration loading and parsing functionality. -### Test Cases +## Test Cases -#### 1. ConstructorTest +### 1. ConstructorTest **Description:** Verifies that ConfigManager can be created with a ROS2 logger without crashing. - **Test Action:** Create ConfigManager instance with ROS2 logger - **Expected Result:** Instance created successfully without exceptions -#### 2. LoadValidConfigTest +### 2. LoadValidConfigTest **Description:** Tests loading of valid TOML configuration files with proper parsing. @@ -22,7 +22,7 @@ Unit tests for `ConfigManager` are implemented in `src/g2_2025_grade_calculator_ - Returns `true` - `is_loaded()` returns `true` -#### 3. LoadInvalidFileTest +### 3. LoadInvalidFileTest **Description:** Tests error handling when attempting to load non-existent configuration files. @@ -31,7 +31,7 @@ Unit tests for `ConfigManager` are implemented in `src/g2_2025_grade_calculator_ - Returns `false` - `is_loaded()` returns `false` -#### 4. DatabaseConfigParsingTest +### 4. DatabaseConfigParsingTest **Description:** Tests complete database configuration parsing with all parameters. @@ -52,7 +52,7 @@ Unit tests for `ConfigManager` are implemented in `src/g2_2025_grade_calculator_ ``` - **Expected Result:** All configuration values parsed correctly with proper types -#### 5. DatabaseConfigWithoutPoolTest +### 5. DatabaseConfigWithoutPoolTest **Description:** Tests default values when optional pool section is missing from configuration. @@ -69,7 +69,7 @@ Unit tests for `ConfigManager` are implemented in `src/g2_2025_grade_calculator_ - Main database config parsed correctly - Default pool values: `min_connections = 1`, `max_connections = 10` -#### 6. GetConfigWithoutLoadingTest +### 6. GetConfigWithoutLoadingTest **Description:** Tests behavior when attempting to access configuration before loading any file. diff --git a/doc/tests/DatabaseManager.md b/doc/tests/DatabaseManager.md index b90b1ab..7a5abd6 100644 --- a/doc/tests/DatabaseManager.md +++ b/doc/tests/DatabaseManager.md @@ -1,31 +1,31 @@ -## Unit Tests +# Database Manager Unit Tests Unit tests for `DatabaseManager` are implemented in `src/g2_2025_grade_calculator_pkg/test/DatabaseManager.test.cpp` using Google Test and ROS2 test utilities. The tests are designed to work reliably whether a database connection is available or not, focusing on error handling and method behavior validation. -### Test Cases +## Test Cases -#### 1. ConstructorTest +### 1. ConstructorTest **Description:** Verifies that DatabaseManager can be created without crashing and proper initialization occurs. - **Test Action:** Create DatabaseManager instance with ROS2 logger - **Expected Result:** Instance created successfully without exceptions -#### 2. ConnectionStatusTest +### 2. ConnectionStatusTest **Description:** Tests that the `is_connected()` method returns a valid boolean value. - **Test Action:** Call `is_connected()` method - **Expected Result:** Returns either `true` or `false` (no crashes or invalid states) -#### 3. QueuePendingCombinationsTest +### 3. QueuePendingCombinationsTest **Description:** Verifies retrieval of pending student-course combinations that need exam results. - **Test Action:** Call `queue_pending_combinations()` - **Expected Result:** Returns valid vector (empty if no database connection, populated if connected) -#### 4. StoreExamResultTest +### 4. StoreExamResultTest **Description:** Tests exam result storage with graceful handling of connection states. @@ -35,7 +35,7 @@ Unit tests for `DatabaseManager` are implemented in `src/g2_2025_grade_calculato - Grade: `85` - **Expected Result:** Returns `false` if no connection, `true` if connected and successful -#### 5. EnrollStudentTest +### 5. EnrollStudentTest **Description:** Tests student enrollment into courses. @@ -43,7 +43,7 @@ Unit tests for `DatabaseManager` are implemented in `src/g2_2025_grade_calculato - StudentCourse object with test data - **Expected Result:** Returns `false` if no connection, `true` if connected and successful -#### 6. GetFinalGradeTest +### 6. GetFinalGradeTest **Description:** Tests final grade retrieval for non-existent student-course combinations. @@ -52,7 +52,7 @@ Unit tests for `DatabaseManager` are implemented in `src/g2_2025_grade_calculato - Course: `"NonExistentCourse"` - **Expected Result:** Returns `-1` (no results found or no connection) -#### 7. StoreFinalResultTest +### 7. StoreFinalResultTest **Description:** Tests storing calculated final course results. diff --git a/doc/tests/ExamResultGenerator.md b/doc/tests/ExamResultGenerator.md index 7fbbf7f..b0adbda 100644 --- a/doc/tests/ExamResultGenerator.md +++ b/doc/tests/ExamResultGenerator.md @@ -1,10 +1,10 @@ -## Unit Tests +# Exam Result Generator Node Unit Tests Unit tests for `ExamResultGenerator` are implemented in `src/g2_2025_grade_calculator_pkg/test/ExamResultGenerator.test.cpp` using Google Test and ROS2 test utilities. The tests use a test subscriber node to capture published messages and validate node behavior. -### Test Cases +## Test Cases -#### 1. ConstructorTest +### 1. ConstructorTest **Description:** Verifies that ExamResultGenerator can be created without crashing and proper initialization occurs. @@ -13,7 +13,7 @@ Unit tests for `ExamResultGenerator` are implemented in `src/g2_2025_grade_calcu - Node created successfully without exceptions - Node name set to `"exam_result_generator"` -#### 2. PublisherCreationTest +### 2. PublisherCreationTest **Description:** Verifies that the `exam_results` topic publisher is properly configured. @@ -22,7 +22,7 @@ Unit tests for `ExamResultGenerator` are implemented in `src/g2_2025_grade_calcu - `/exam_results` topic is published - Topic uses `g2_2025_interfaces/msg/Exam` message type -#### 3. SubscriberCreationTest +### 3. SubscriberCreationTest **Description:** Tests that the node subscribes to the `student_course_management` topic with correct message type. @@ -31,7 +31,7 @@ Unit tests for `ExamResultGenerator` are implemented in `src/g2_2025_grade_calcu - `/student_course_management` topic is subscribed - Subscription uses `g2_2025_interfaces/msg/Student` message type -#### 4. StudentManagementMessageHandlingTest +### 4. StudentManagementMessageHandlingTest **Description:** Tests the node's ability to handle incoming student management messages without crashing. @@ -41,7 +41,7 @@ Unit tests for `ExamResultGenerator` are implemented in `src/g2_2025_grade_calcu - Course: `"Test Course"` - **Expected Result:** Message processed without crashes -#### 5. MultipleStudentMessagesTest +### 5. MultipleStudentMessagesTest **Description:** Validates handling of multiple rapid student management messages for robustness testing. @@ -51,7 +51,7 @@ Unit tests for `ExamResultGenerator` are implemented in `src/g2_2025_grade_calcu - Courses: `["Math", "Physics", "Chemistry"]` - **Expected Result:** All messages processed without crashes or memory issues -#### 6. ExamMessageValidationTest +### 6. ExamMessageValidationTest **Description:** Captures and validates published exam result messages for correct content and format. diff --git a/doc/tests/FinalGradeDeterminator.md b/doc/tests/FinalGradeDeterminator.md index 4b6cce0..fb94255 100644 --- a/doc/tests/FinalGradeDeterminator.md +++ b/doc/tests/FinalGradeDeterminator.md @@ -1,17 +1,17 @@ -## Unit Tests +# Final Grade Determintator Node Unit Tests Unit tests for `FinalGradeDeterminator` are implemented in `src/g2_2025_grade_calculator_pkg/test/FinalGradeDeterminator.test.cpp` using Google Test and ROS2 test utilities. The tests use a mock database manager and a mock grade calculator service to simulate the node's interactions. -### Test Cases +## Test Cases -#### 1. ConstructorTest +### 1. ConstructorTest **Description:** Verifies that the node can be constructed without errors. - **Input:** Construct a `FinalGradeDeterminator` node. - **Expected Output:** No exceptions are thrown. The node is created successfully. -#### 2. ExamCollectionTest +### 2. ExamCollectionTest **Description:** Sends the required number of exam results and checks that a grade calculation request is triggered, a student message is published, and the results are stored. @@ -24,7 +24,7 @@ Unit tests for `FinalGradeDeterminator` are implemented in `src/g2_2025_grade_ca - A student message is published with the correct student and course. - The final grade is calculated as the average: (80 + 85 + 90 + 75 + 95) / 5 = 85. -#### 3. PartialExamCollectionTest +### 3. PartialExamCollectionTest **Description:** Sends fewer than the required number of exam results and checks that no grade calculation or student message occurs. @@ -36,7 +36,7 @@ Unit tests for `FinalGradeDeterminator` are implemented in `src/g2_2025_grade_ca - No grade calculation service request is made. - No student message is published. -#### 4. MultipleStudentsTest +### 4. MultipleStudentsTest **Description:** Simulates multiple students submitting exam results and verifies that each student triggers independent grade calculation and messaging. diff --git a/doc/tests/GradeCalculator.md b/doc/tests/GradeCalculator.md index 767a95f..479623f 100644 --- a/doc/tests/GradeCalculator.md +++ b/doc/tests/GradeCalculator.md @@ -1,10 +1,10 @@ -## Unit Tests +# Grade Calculator Node Unit Tests Unit tests for `GradeCalculator` are implemented in `src/g2_2025_grade_calculator_pkg/test/GradeCalculator.test.cpp` using Google Test and ROS2 test utilities. The tests use a client to call the grade calculation service and verify the results. -### Test Cases +## Test Cases -#### 1. NormalAverage +### 1. NormalAverage **Description:** Verifies that the service returns the average of the provided grades for a normal student name. @@ -14,7 +14,7 @@ Unit tests for `GradeCalculator` are implemented in `src/g2_2025_grade_calculato - **Expected Output:** - Result: `80` (average of 80, 90, 70) -#### 2. WesselBonus +### 2. WesselBonus **Description:** Checks that the student name "Wessel" (case-insensitive) receives a 10-point bonus, and the result is clamped to 100 if necessary.