diff --git a/utest/VirtualSchematikaMachine.test.cpp b/utest/VirtualSchematikaMachine.test.cpp index a27d06f7..b312395c 100644 --- a/utest/VirtualSchematikaMachine.test.cpp +++ b/utest/VirtualSchematikaMachine.test.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -26,6 +27,7 @@ namespace xo { using xo::scm::DString; using xo::scm::DUniqueString; // aks Symbol in lisp using xo::scm::DList; + using xo::scm::DArray; using xo::scm::DFloat; using xo::scm::DBoolean; using xo::scm::DInteger; @@ -628,7 +630,7 @@ namespace xo { { const auto & testname = Catch::getResultCapture().getCurrentTestName(); - bool c_debug_flag = true; + bool c_debug_flag = false; scope log(XO_DEBUG(c_debug_flag), xtag("test", testname)); VsmFixture vsm_fixture(testname, c_debug_flag, @@ -668,6 +670,50 @@ namespace xo { //log && vsm_fixture.log_memory_layout(&log); } + TEST_CASE("VirtualSchematikaMachine-qarray", "[interpreter2][VSM]") + { + const auto & testname = Catch::getResultCapture().getCurrentTestName(); + + bool c_debug_flag = true; + scope log(XO_DEBUG(c_debug_flag), xtag("test", testname)); + + VsmFixture vsm_fixture(testname, c_debug_flag, + VsmConfig().with_parser_debug_flag(c_debug_flag)); + auto & vsm = vsm_fixture.vsm_; + + bool eof_flag = true; + + vsm.begin_interactive_session(); + + span_type input = span_type::from_cstr("#q{ [4.5 7.2] };"); + + log && log(xtag("input", input)); + + VsmResultExt res + = vsm.read_eval_print(input, eof_flag); + + REQUIRE(res.is_value()); + REQUIRE(res.value()); + + log && log(xtag("res.tseq", res.value()->_typeseq()), + xtag("res.type", TypeRegistry::id2name(res.value()->_typeseq()))); + + auto x = obj::from(*res.value()); + REQUIRE(x); + REQUIRE(x->size() == 2); + auto x0 = obj::from(x->at(0)); + REQUIRE(x0); + REQUIRE(x0->value() == 4.5); + auto x1 = obj::from(x->at(1)); + REQUIRE(x1); + REQUIRE(x1->value() == 7.2); + + REQUIRE(res.remaining_.size() == 1); + REQUIRE(*res.remaining_.lo() == '\n'); + + //log && vsm_fixture.log_memory_layout(&log); + } + TEST_CASE("VirtualSchematikaMachine-report_memory_use", "[interpreter2][VSM]") { const auto & testname = Catch::getResultCapture().getCurrentTestName();