.
This commit is contained in:
18
tests/test_list.cpp
Normal file
18
tests/test_list.cpp
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user