<?php

require __DIR__ . '/vendor/autoload.php';

use App\Services\MathFormulaProcessor;

echo "=== 测试数学公式处理器优化效果 ===\n\n";

// 测试用例
$testCases = [
    '已知函数 f(x) = x^2 - 4x + 5，求最小值',
    'f(x) = x^2 - 4x + 5',
    '4x^2 - 25y^2',
    '验证：$2x^2 + 1$',
    '这是一段普通文本，不包含数学公式',
    '\frac{1}{2} + \frac{1}{3}',
    'x^2 + y^2 = 1',
    '已知函数 g(x) = 2x + 3，求 g(5)',
];

foreach ($testCases as $index => $testCase) {
    echo "测试用例 " . ($index + 1) . ":\n";
    echo "输入: " . $testCase . "\n";

    $result = MathFormulaProcessor::processFormulas($testCase);

    echo "输出: " . $result . "\n";
    echo "---\n\n";
}

echo "=== 测试完成 ===\n";
