samples: add Terra samples

source: https://github.com/zdevito/terra/tree/master/tests
This commit is contained in:
Bayu Aldi Yansyah
2016-01-28 11:22:27 +07:00
parent e32a837fb2
commit 9b8b39f444
370 changed files with 11921 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
G,T = terralib.includecstring [[
typedef struct {
double c;
} A;
struct A {
int b;
};
]]
G2,T2 = terralib.includecstring [[
struct A;
typedef struct C A;
]]
assert(T2.A == T.A)
assert(G2.A ~= T2.A and G2.A ~= G.A)
terra foo()
var a : G.A
var b : T.A
a.c = 4.5
b.b = 4.5
return a.c + b.b
end
assert(8.5 == foo())