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

26
samples/Terra/globals.t Normal file
View File

@@ -0,0 +1,26 @@
struct A { a : int }
local a = terralib.global(A)
a:set({3})
local b = terralib.global(true)
local c = terralib.global(int[3])
local d = terralib.global(3.5)
terra foobar()
c[0] = 3
return a.a + d
end
e = global(int)
terra doihaveaname()
e = 10
return e
end
assert(doihaveaname() == 10)
assert(6.5 == foobar())
print("HERE")
assert(true == b:get())
assert(3 == c:get()[0])
print("TODO - fix handling of initializers for array-like things and literal strings")