Suppressed print statements during tests

This commit is contained in:
2022-09-05 05:30:06 +01:00
parent fb1ac71f42
commit dceb83e618
5 changed files with 26 additions and 14 deletions

View File

@@ -11,7 +11,12 @@
#include <stdlib.h>
#include <string.h>
//IO functions
//supress the print output
static void noPrintFn(const char* output) {
//NO OP
}
//compilation functions
char* readFile(char* path, size_t* fileSize) {
FILE* file = fopen(path, "rb");
@@ -86,6 +91,10 @@ unsigned char* compileString(char* source, size_t* size) {
void runBinary(unsigned char* tb, size_t size) {
Interpreter interpreter;
initInterpreter(&interpreter);
//NOTE: supress print output for testing
setInterpreterPrint(&interpreter, noPrintFn);
runInterpreter(&interpreter, tb, size);
freeInterpreter(&interpreter);
}
@@ -138,6 +147,9 @@ int main() {
int size = 0;
unsigned char* bytecode = collateCompiler(&compiler, &size);
//NOTE: supress print output for testing
setInterpreterPrint(&interpreter, noPrintFn);
//run
runInterpreter(&interpreter, bytecode, size);