Implemented tests for Toy_Bytecode and Toy_Routine

This commit is contained in:
2024-09-22 14:13:50 +10:00
parent 4567484038
commit a2625fa6d4
6 changed files with 811 additions and 15 deletions

View File

@@ -34,6 +34,11 @@ static void writeBytecodeHeader(Toy_Bytecode* bc) {
const char* build = Toy_private_version_build();
int len = (int)strlen(build) + 1;
//BUGFIX: ensure the end of the header has 4-byte alignment
if (len % 4 != 1) { //1 to fill the 4th byte above
len += 4 - (len % 4) +1; //ceil
}
expand(bc, len);
memcpy(bc->ptr + bc->count, build, len);
bc->count += len;