Add new features: ternary operator, file IO, string ops, math functions, array ops, system functions
Build and Package Oraset / build (macos-latest) (push) Waiting to run
Build and Package Oraset / build (ubuntu-latest) (push) Waiting to run
Build and Package Oraset / build (windows-latest) (push) Waiting to run
Build and Package Oraset / release (push) Blocked by required conditions

This commit is contained in:
JGZ_YES
2026-07-23 15:43:44 +08:00
parent 87bd711079
commit 37ae3280e8
7 changed files with 639 additions and 8 deletions
+72
View File
@@ -0,0 +1,72 @@
echo("=== 新功能测试 ===");
echo("");
echo("=== 三元运算符测试 ===");
let a = 10;
let b = 20;
let max = (a > b) ? a : b;
echo("max =", max);
let min = (a < b) ? a : b;
echo("min =", min);
echo("");
echo("=== 文件IO测试 ===");
fopen("test_io.txt", "w");
fputs("Hello World\n", __tmp_file_result);
fclose(__tmp_file_result);
fopen("test_io.txt", "r");
fgets(__tmp_file_result);
echo("读取第一行:", __tmp_str_result);
fclose(__tmp_file_result);
echo("");
echo("=== 字符串函数测试 ===");
let s = "Hello World";
echo("strlen(s) =", strlen(s));
echo("strchr(s, 'W') =", strchr(s, 87));
echo("strstr(s, 'World') =", strstr(s, "World"));
toupper(s);
echo("toupper:", __tmp_str_result);
tolower(__tmp_str_result);
echo("tolower:", __tmp_str_result);
echo("");
echo("=== 数学函数测试 ===");
echo("sin(0) =", sin(0));
echo("cos(0) =", cos(0));
echo("asin(0) =", asin(0));
echo("acos(1) =", acos(1));
echo("atan(0) =", atan(0));
echo("atan2(1, 0) =", atan2(1, 0));
echo("log10(100) =", log10(100));
echo("exp(1) =", exp(1));
echo("");
echo("=== 数组操作测试 ===");
let arr = [1, 2, 3];
echo("初始数组:", arr);
push(arr, 4);
echo("push后:", arr);
let popped = pop(arr);
echo("pop出:", popped);
echo("pop后:", arr);
insert(arr, 1, 99);
echo("insert后:", arr);
let removed = remove(arr, 1);
echo("remove出:", removed);
echo("remove后:", arr);
echo("");
echo("=== 系统函数测试 ===");
getenv("PATH");
echo("PATH长度:", strlen(__tmp_str_result));
echo("");
echo("所有新功能测试完成!");