wasmer/lib/runtime-c-api/tests/test-validate.c

23 lines
467 B
C
Raw Normal View History

2019-02-05 06:01:01 +00:00
#include <stdio.h>
#include "../wasmer.h"
#include <assert.h>
#include <stdint.h>
int main()
{
// Read the wasm file bytes
FILE *file = fopen("assets/sum.wasm", "r");
2019-02-05 06:01:01 +00:00
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;
}