int main(int argc,char **argv) { char *p; int len; p = vmlog_concat3("foo","","bar",&len); NOTNULL(p); IS(len,6); TRUE(strcmp(p,"foobar") == 0); p = vmlog_concat3("","","",&len); NOTNULL(p); IS(len,0); TRUE(strcmp(p,"") == 0); p = vmlog_concat3("This is a"," stupid ","test.",&len); NOTNULL(p); IS(len,strlen("This is a stupid test.")); TRUE(strcmp(p,"This is a stupid test.") == 0); p = vmlog_concat4len("eins",2,"zwei",4,"drei",0,"vier",4,&len); NOTNULL(p); IS(len,10); TRUE(strcmp(p,"eizweivier") == 0); return 0; }
static void check_logent(vmlog_log_entry *logent,int seq) { TRUE(logent->tag == seq % 5 && logent->index == seq + testdelta); if (!(logent->tag == seq % 5 && logent->index == seq + testdelta)) { fprintf(stdout,"THE FAILED ONE:\n"); vmlog_ringbuf_visualize(ring); } }
/* Process 1OP Integer instructions */ bool eval_1OP_Int(struct lilith* vm, struct Instruction* c) { #ifdef DEBUG char Name[20] = "ILLEGAL_1OP"; #endif switch(c->raw_XOP) { case 0x00000: /* READPC */ { #ifdef DEBUG strncpy(Name, "READPC", 19); #elif TRACE record_trace("READPC"); #endif READPC(vm, c); break; } case 0x00001: /* READSCID */ { #ifdef DEBUG strncpy(Name, "READSCID", 19); #elif TRACE record_trace("READSCID"); #endif READSCID(vm, c); break; } case 0x00002: /* FALSE */ { #ifdef DEBUG strncpy(Name, "FALSE", 19); #elif TRACE record_trace("FALSE"); #endif FALSE(vm, c); break; } case 0x00003: /* TRUE */ { #ifdef DEBUG strncpy(Name, "TRUE", 19); #elif TRACE record_trace("TRUE"); #endif TRUE(vm, c); break; } case 0x01000: /* JSR_COROUTINE */ { #ifdef DEBUG strncpy(Name, "JSR_COROUTINE", 19); #elif TRACE record_trace("JSR_COROUTINE"); #endif JSR_COROUTINE(vm, c); break; } case 0x01001: /* RET */ { #ifdef DEBUG strncpy(Name, "RET", 19); #elif TRACE record_trace("RET"); #endif RET(vm, c); break; } case 0x02000: /* PUSHPC */ { #ifdef DEBUG strncpy(Name, "PUSHPC", 19); #elif TRACE record_trace("PUSHPC"); #endif PUSHPC(vm, c); break; } case 0x02001: /* POPPC */ { #ifdef DEBUG strncpy(Name, "POPPC", 19); #elif TRACE record_trace("POPPC"); #endif POPPC(vm, c); break; } default: { illegal_instruction(vm, c); break; } } #ifdef DEBUG fprintf(stdout, "# %s reg%u\n", Name, c->reg0); #endif return false; }
unsigned int true_uint(void) { return TRUE(); }