Add validate function and test

This commit is contained in:
Brandon Fish
2019-02-05 00:01:01 -06:00
parent 8d8dea7ec8
commit 309246e0d6
6 changed files with 42 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
#include <stdio.h>
#include "../wasmer.h"
#include <assert.h>
#include <stdint.h>
int main()
{
// Read the wasm file bytes
FILE *file = fopen("sum.wasm", "r");
fseek(file, 0, SEEK_END);
long len = ftell(file);
uint8_t *bytes = malloc(len);
fseek(file, 0, SEEK_SET);
fread(bytes, 1, len, file);
fclose(file);
bool result = wasmer_validate(bytes, len);
printf("Result: %d", result);
assert(result);
return 0;
}