Files
camellya/tests/test_list.cpp
2026-02-04 19:37:03 +08:00

19 lines
448 B
C++

#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);
}
}