This commit is contained in:
2026-02-04 19:37:03 +08:00
parent 5aa4efede7
commit 36d273e09f
11 changed files with 335 additions and 93 deletions

18
tests/test_list.cpp Normal file
View File

@@ -0,0 +1,18 @@
#include "camellya.h"
#include <catch2/catch_all.hpp>
using namespace camellya;
TEST_CASE("Basic List test", "[list]") {
Camellya c;
SECTION("len function") {
REQUIRE(c.do_string(R"(
var arr = [1, 2, 3, 4];
var size = len(arr);
arr.push(5);
size = arr.len();
)"));
auto size = c.get_global("size");
REQUIRE(std::dynamic_pointer_cast<NumberValue>(size)->value == 5.0);
}
}