diff --git a/scripts/run_ir_test.sh b/scripts/run_ir_test.sh index cb5d120..0baaa0d 100755 --- a/scripts/run_ir_test.sh +++ b/scripts/run_ir_test.sh @@ -28,21 +28,12 @@ while IFS= read -r test_file; do echo -n "测试: $relative_path ... " - # stderr 单独捕获,stdout 写到输出文件 - err_output=$("$COMPILER" --emit-ir "$test_file" > "$output_file" 2>&1) + "$COMPILER" --emit-ir "$test_file" > "$output_file" 2>&1 exit_code=$? - if [ $exit_code -eq 0 ]; then - # 确认输出文件非空且不含 [error] - if [ -s "$output_file" ] && ! grep -q '\[error\]' "$output_file"; then - echo "通过" - pass_count=$((pass_count + 1)) - else - echo "失败 (生成内容含错误)" - fail_count=$((fail_count + 1)) - failed_cases+=("$relative_path") - echo " 错误信息已保存到: $output_file" - fi + if [ $exit_code -eq 0 ] && [ -s "$output_file" ] && ! grep -q '\[error\]' "$output_file"; then + echo "通过" + pass_count=$((pass_count + 1)) else echo "失败" fail_count=$((fail_count + 1)) diff --git a/test_const_float.sy b/test_const_float.sy deleted file mode 100644 index 19c20c4..0000000 --- a/test_const_float.sy +++ /dev/null @@ -1,9 +0,0 @@ -const float PI = 3.14; -const float E = 2.718; - -int main() { - float r = 5.0; - float area = PI * r * r; - float sum = PI + E; - return 0; -} diff --git a/test_float.sy b/test_float.sy deleted file mode 100644 index 1e76fba..0000000 --- a/test_float.sy +++ /dev/null @@ -1,8 +0,0 @@ -int main() { - float a = 3.14; - float b = 2.0; - float c = a + b; - int d = 10; - float e = d + a; // 隐式转换 int -> float - return 0; -} diff --git a/test_float_full.sy b/test_float_full.sy deleted file mode 100644 index ccb4e9a..0000000 --- a/test_float_full.sy +++ /dev/null @@ -1,30 +0,0 @@ -float test_float(float x, int y) { - float z = x * 2.5; - float w = y + z; // 隐式转换 int -> float - return w / 3.0; -} - -int main() { - float a = 1.5; - float b = 2.5; - - // 浮点运算 - float c = a + b; - float d = a - b; - float e = a * b; - float f = a / b; - - // 浮点比较 - int g = a < b; - int h = a == b; - - // 一元运算 - float i = -a; - int j = !a; - - // 混合运算(隐式转换) - int k = 10; - float m = k + a; - - return 0; -} diff --git a/test_float_simple.sy b/test_float_simple.sy deleted file mode 100644 index 1eff332..0000000 --- a/test_float_simple.sy +++ /dev/null @@ -1,18 +0,0 @@ -float test_float(float x, int y) { - float z = x * 2.5; - float w = y + z; - return w / 3.0; -} - -int main() { - float a = 1.5; - float b = 2.5; - float c = a + b; - float d = a - b; - float e = a * b; - float f = a / b; - float g = -a; - int k = 10; - float m = k + a; - return 0; -}