Rename files

This commit is contained in:
2026-01-22 20:56:02 +08:00
parent 8c5197c760
commit 5aa4efede7
12 changed files with 872 additions and 1604 deletions

View File

@@ -7,7 +7,7 @@
using namespace camellya;
TEST_CASE("basic arithmetic", "[script]") {
State state;
Camellya state;
const char *script = R"(
var x = 10;
var y = 20;
@@ -26,7 +26,7 @@ TEST_CASE("basic arithmetic", "[script]") {
}
TEST_CASE("basic function", "[script][func]") {
State state;
Camellya state;
const char *script = R"(
func add(number x, number y) -> number {
return x + y;
@@ -46,7 +46,7 @@ TEST_CASE("basic function", "[script][func]") {
}
TEST_CASE("list indexing is 0-based", "[list]") {
State state;
Camellya state;
const char *script = R"(
var numbers = [10, 20, 30];
)";
@@ -75,7 +75,7 @@ TEST_CASE("list indexing is 0-based", "[list]") {
}
TEST_CASE("class init is called on declaration", "[class][init]") {
State state;
Camellya state;
const char *script = R"(
class Person {
var age : number;
@@ -124,7 +124,7 @@ TEST_CASE("class init is called on declaration", "[class][init]") {
}
TEST_CASE("interpreter performance: simple loop", "[perf][script]") {
State state;
Camellya state;
const char *script = R"(
func sum_to(number n) -> number {
var s = 0;
@@ -151,7 +151,7 @@ TEST_CASE("interpreter performance: simple loop", "[perf][script]") {
}
TEST_CASE("loop break", "[script][loop]") {
State state;
Camellya state;
const char *script = R"(
var sum = 0;
for (var i = 0; i < 10; i = i + 1) {
@@ -170,7 +170,7 @@ TEST_CASE("loop break", "[script][loop]") {
}
TEST_CASE("loop continue", "[script][loop]") {
State state;
Camellya state;
const char *script = R"(
var sum = 0;
for (var i = 0; i < 5; i = i + 1) {
@@ -189,7 +189,7 @@ TEST_CASE("loop continue", "[script][loop]") {
}
TEST_CASE("while break and continue", "[script][loop]") {
State state;
Camellya state;
const char *script = R"(
var i = 0;
var sum = 0;

View File

@@ -4,7 +4,7 @@
using namespace camellya;
TEST_CASE("VM - Basic arithmetic", "[vm]") {
State state;
Camellya state;
SECTION("Addition") {
REQUIRE(state.do_string("var x = 10 + 20;"));
@@ -37,7 +37,7 @@ TEST_CASE("VM - Basic arithmetic", "[vm]") {
}
TEST_CASE("VM - Variables and assignment", "[vm]") {
State state;
Camellya state;
SECTION("Variable declaration and initialization") {
REQUIRE(state.do_string("var a = 42;"));
@@ -57,7 +57,7 @@ TEST_CASE("VM - Variables and assignment", "[vm]") {
}
TEST_CASE("VM - String operations", "[vm]") {
State state;
Camellya state;
SECTION("String concatenation") {
REQUIRE(state.do_string(R"(var greeting = "Hello" + " " + "World";)"));
@@ -70,7 +70,7 @@ TEST_CASE("VM - String operations", "[vm]") {
}
TEST_CASE("VM - Comparison operators", "[vm]") {
State state;
Camellya state;
SECTION("Equality") {
REQUIRE(state.do_string("var eq = 10 == 10;"));
@@ -92,7 +92,7 @@ TEST_CASE("VM - Comparison operators", "[vm]") {
}
TEST_CASE("VM - Lists", "[vm]") {
State state;
Camellya state;
SECTION("Create list") {
REQUIRE(state.do_string("var numbers = [1, 2, 3, 4, 5];"));
@@ -114,7 +114,7 @@ TEST_CASE("VM - Lists", "[vm]") {
}
TEST_CASE("VM - Maps", "[vm]") {
State state;
Camellya state;
SECTION("Create map") {
REQUIRE(state.do_string(R"(var person = {"name": "Alice", "age": "30"};)"));
@@ -135,7 +135,7 @@ TEST_CASE("VM - Maps", "[vm]") {
}
TEST_CASE("VM - If statements", "[vm]") {
State state;
Camellya state;
SECTION("If branch taken") {
REQUIRE(state.do_string(R"(
@@ -163,7 +163,7 @@ TEST_CASE("VM - If statements", "[vm]") {
}
TEST_CASE("VM - While loops", "[vm]") {
State state;
Camellya state;
SECTION("While loop") {
REQUIRE(state.do_string(R"(
@@ -180,7 +180,7 @@ TEST_CASE("VM - While loops", "[vm]") {
}
TEST_CASE("VM - Native functions", "[vm]") {
State state;
Camellya state;
SECTION("len function") {
REQUIRE(state.do_string(R"(