Skip to content

Instantly share code, notes, and snippets.

@shagohead
Last active September 12, 2025 16:18
Show Gist options
  • Select an option

  • Save shagohead/3f86ca8ed07acff1452e03d87585f34f to your computer and use it in GitHub Desktop.

Select an option

Save shagohead/3f86ca8ed07acff1452e03d87585f34f to your computer and use it in GitHub Desktop.
test_result.c
#include "cyberiada/ursulacheck.h"
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
int err;
UrsulaCheckerData *checker;
char *config;
config = "junior.cfg";
err = cyberiada_ursula_checker_init(&checker, config);
if (err) {
return err;
}
char *task_id;
task_id = "eafd940c-05cc-4c85-b174-2016802ea8a3";
int salt;
salt = 765296071;
char *filename;
filename = "wasp-3.graphml";
FILE *fp;
long lSize;
char *buffer;
fp = fopen(filename, "rb");
if (!fp)
perror(filename), exit(1);
fseek(fp, 0L, SEEK_END);
lSize = ftell(fp);
rewind(fp);
buffer = calloc(1, lSize + 1);
if (!buffer)
fclose(fp), fputs("memory alloc fails", stderr), exit(1);
if (1 != fread(buffer, lSize, 1, fp))
fclose(fp), free(buffer), fputs("entire read fails", stderr), exit(1);
UrsulaCheckerResult result;
char *code;
err = cyberiada_ursula_checker_check_program(checker, task_id, salt, buffer,
&result, &code);
fclose(fp);
free(buffer);
if (err) {
return err;
}
printf("result: %d\ncode: %s", result, code);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment