xo-interpreter2 stack: bugfix: top-level i64 token -> DInteger
This commit is contained in:
parent
e6fdd2b436
commit
854a8dcc48
3 changed files with 122 additions and 4 deletions
|
|
@ -6,6 +6,8 @@
|
|||
#include <xo/interpreter2/VirtualSchematikaMachine.hpp>
|
||||
#include <xo/object2/DFloat.hpp>
|
||||
#include <xo/object2/number/IGCObject_DFloat.hpp>
|
||||
#include <xo/object2/DInteger.hpp>
|
||||
#include <xo/object2/number/IGCObject_DInteger.hpp>
|
||||
|
||||
#ifdef NOT_YET
|
||||
#include <xo/reader2/SchematikaParser.hpp>
|
||||
|
|
@ -27,6 +29,7 @@ namespace xo {
|
|||
using xo::scm::VsmConfig;
|
||||
using xo::scm::VsmResultExt;
|
||||
using xo::scm::DFloat;
|
||||
using xo::scm::DInteger;
|
||||
using xo::mm::AGCObject;
|
||||
using xo::mm::MemorySizeInfo;
|
||||
using xo::facet::FacetRegistry;
|
||||
|
|
@ -62,6 +65,25 @@ namespace xo {
|
|||
VsmConfig cfg;
|
||||
VirtualSchematikaMachine vsm(cfg);
|
||||
|
||||
auto visitor = [&log](const MemorySizeInfo & info) {
|
||||
log && log(xtag("resource", info.resource_name_),
|
||||
xtag("used", info.used_),
|
||||
xtag("alloc", info.allocated_),
|
||||
xtag("commit", info.committed_),
|
||||
xtag("resv", info.reserved_));
|
||||
};
|
||||
|
||||
FacetRegistry::instance().visit_pools(visitor);
|
||||
vsm.visit_pools(visitor);
|
||||
}
|
||||
|
||||
TEST_CASE("VirtualSchematikaMachine-const1", "[interpreter2][VSM]")
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
VsmConfig cfg;
|
||||
VirtualSchematikaMachine vsm(cfg);
|
||||
|
||||
bool eof_flag = false;
|
||||
|
||||
vsm.begin_interactive_session();
|
||||
|
|
@ -90,6 +112,43 @@ namespace xo {
|
|||
vsm.visit_pools(visitor);
|
||||
}
|
||||
|
||||
TEST_CASE("VirtualSchematikaMachine-const2", "[interpreter2][VSM]")
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
VsmConfig cfg;
|
||||
VirtualSchematikaMachine vsm(cfg);
|
||||
|
||||
bool eof_flag = false;
|
||||
|
||||
vsm.begin_interactive_session();
|
||||
VsmResultExt res = vsm.read_eval_print(span_type::from_cstr("1011;"), eof_flag);
|
||||
|
||||
REQUIRE(res.is_value());
|
||||
REQUIRE(res.value());
|
||||
|
||||
log && log(xtag("res.tseq", res.value()->_typeseq()));
|
||||
|
||||
auto x = obj<AGCObject,DInteger>::from(*res.value());
|
||||
|
||||
REQUIRE(x);
|
||||
REQUIRE(x.data()->value() == 1011);
|
||||
|
||||
REQUIRE(res.remaining_.size() == 1);
|
||||
REQUIRE(*res.remaining_.lo() == '\n');
|
||||
|
||||
auto visitor = [&log](const MemorySizeInfo & info) {
|
||||
log && log(xtag("resource", info.resource_name_),
|
||||
xtag("used", info.used_),
|
||||
xtag("alloc", info.allocated_),
|
||||
xtag("commit", info.committed_),
|
||||
xtag("resv", info.reserved_));
|
||||
};
|
||||
|
||||
FacetRegistry::instance().visit_pools(visitor);
|
||||
vsm.visit_pools(visitor);
|
||||
}
|
||||
|
||||
} /*namespace ut*/
|
||||
} /*namespace xo*/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue