/* testcode.c -- run a word on a node, for tests. See testcode.h. */ #include "v4/testcode.h" long v4_test_call(v4_node *n, v4_exec_state *es, v4_heat *h, v4_cell entry, long max_words) { long words = 0; v4_rstack_push(&n->rs, V4_TEST_HALT); n->p = entry; while (n->p != V4_TEST_HALT) { if (words >= max_words) return -1; /* A golden model must not index outside its own memory on a runaway * P; node.h leaves out-of-range addressing undefined. */ if (n->p < 0 || (v4_ucell)n->p >= V4_NODE_WORDS) return -1; (void)v4_exec_step_word(n, es, h); words++; } return words; }