<?php
// Test the GPA-based grade calculation function
function calculateGradeFromGPA($gpa) {
    if ($gpa >= 5.00) return 'A+';
    elseif ($gpa >= 4.00) return 'A';
    elseif ($gpa >= 3.50) return 'A-';
    elseif ($gpa >= 3.00) return 'B';
    elseif ($gpa >= 2.00) return 'C';
    elseif ($gpa >= 1.00) return 'D';
    else return 'F';
}

echo "=== GPA TO GRADE CONVERSION TEST ===\n\n";

// Test cases
$test_cases = [
    5.00 => 'A+',
    4.50 => 'A',
    4.00 => 'A',
    3.75 => 'A-',
    3.50 => 'A-',
    3.25 => 'B',
    3.00 => 'B',
    2.50 => 'C',
    2.00 => 'C',
    1.50 => 'D',
    1.00 => 'D',
    0.50 => 'F',
    0.00 => 'F'
];

foreach ($test_cases as $gpa => $expected_grade) {
    $calculated_grade = calculateGradeFromGPA($gpa);
    $status = ($calculated_grade === $expected_grade) ? "✅" : "❌";
    echo "$status GPA: $gpa => Grade: $calculated_grade (Expected: $expected_grade)\n";
}

echo "\n=== TEST COMPLETE ===\n";
?>