File: test_a.c

package info (click to toggle)
haskell-futhark 0.25.32-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 18,236 kB
  • sloc: haskell: 100,484; ansic: 12,100; python: 3,440; yacc: 785; sh: 561; javascript: 558; lisp: 399; makefile: 277
file content (36 lines) | stat: -rw-r--r-- 737 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "a.h"
#include <assert.h>

int main() {
  struct futhark_context_config *cfg = futhark_context_config_new();
  struct futhark_context *ctx = futhark_context_new(cfg);

  int err;

  int x, y;
  x = 3;
  err = futhark_entry_a(ctx, &y, x);
  assert(err == 0);
  assert(y==x+2);

  struct futhark_opaque_t1 *t1;
  err = futhark_entry_b(ctx, &t1, x);
  assert(err == 0);

  struct futhark_opaque_t2 *t2;
  err = futhark_entry_c(ctx, &t2, t1);
  assert(err == 0);

  err = futhark_free_opaque_t1(ctx, t1);
  assert(err == 0);

  err = futhark_entry_d(ctx, &y, t2);
  assert(err == 0);
  assert(y==x+3);

  err = futhark_free_opaque_t2(ctx, t2);
  assert(err == 0);

  futhark_context_free(ctx);
  futhark_context_config_free(cfg);
}