Added tests for typechecking
This commit is contained in:
6
tests_ispcpp/error_0.ispc
Normal file
6
tests_ispcpp/error_0.ispc
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
//@error
|
||||||
|
//assigning mismatched polymorphic types
|
||||||
|
|
||||||
|
export void foo(floating<0> bar) {
|
||||||
|
floating<1> baz = bar;
|
||||||
|
}
|
||||||
6
tests_ispcpp/error_1.ispc
Normal file
6
tests_ispcpp/error_1.ispc
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
//@error
|
||||||
|
//assigning mismatched polymorphic types
|
||||||
|
|
||||||
|
export void foo(floating<0> bar) {
|
||||||
|
floating baz = bar;
|
||||||
|
}
|
||||||
6
tests_ispcpp/error_2.ispc
Normal file
6
tests_ispcpp/error_2.ispc
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
//@error
|
||||||
|
//assigning mismatched polymorphic types
|
||||||
|
|
||||||
|
export void foo(number<0> bar) {
|
||||||
|
floating<0> baz = bar;
|
||||||
|
}
|
||||||
6
tests_ispcpp/error_3.ispc
Normal file
6
tests_ispcpp/error_3.ispc
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
//@error
|
||||||
|
//assigning mismatched polymorphic types
|
||||||
|
|
||||||
|
export void foo(number<0> bar) {
|
||||||
|
integer baz = bar;
|
||||||
|
}
|
||||||
19
tests_ispcpp/error_4.ispc
Normal file
19
tests_ispcpp/error_4.ispc
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
//@error
|
||||||
|
// cannot determine return type for mult
|
||||||
|
|
||||||
|
|
||||||
|
floating mult(floating<0> x, floating<1>y) {
|
||||||
|
return x * y;
|
||||||
|
}
|
||||||
|
|
||||||
|
export void saxpy(uniform int N,
|
||||||
|
uniform floating<0> scale,
|
||||||
|
uniform floating<1> X[],
|
||||||
|
uniform floating<1> Y[],
|
||||||
|
uniform floating<2> result[])
|
||||||
|
{
|
||||||
|
foreach (i = 0 ... N) {
|
||||||
|
floating<2> tmp = mult(scale, X[i]) + Y[i];
|
||||||
|
result[i] = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user