|
|
|
|
|
|
return foundError; |
|
|
|
} |
|
|
|
|
|
|
|
[Test] |
|
|
|
public void Fail_NestedWithNonPrimitiveType() |
|
|
|
[Test(Description = "Disallow non-primitive types in nested structs")] |
|
|
|
public void Fail_NestedWithNonPrimitiveType() |
|
|
|
{ |
|
|
|
string source; |
|
|
|
List<string> errors; |
|
|
|
|
|
|
Assert.IsTrue(HasErrorString(errors, "contains a non-primitive field type")); |
|
|
|
} |
|
|
|
|
|
|
|
[Test] |
|
|
|
public void Fail_UnsupportedPrimitiveType() |
|
|
|
[Test(Description = "Check for unsupported types in primitive structs")] |
|
|
|
public void Fail_UnsupportedPrimitiveType() |
|
|
|
{ |
|
|
|
string source; |
|
|
|
List<string> errors; |
|
|
|
|
|
|
Assert.IsTrue(HasErrorString(errors, "contains an unsupported field type")); |
|
|
|
} |
|
|
|
|
|
|
|
[Test] |
|
|
|
[Test(Description = "Disallow mixed types in nested structs")] |
|
|
|
public void Fail_MixedTypesInNestedStruct() |
|
|
|
{ |
|
|
|
string source; |
|
|
|
|
|
|
Assert.IsTrue(HasErrorString(errors, "contains mixed basic types")); |
|
|
|
} |
|
|
|
|
|
|
|
[Test] |
|
|
|
public void Fail_TooManyFields() |
|
|
|
[Test(Description = "Disallow more than 16 bytes worth of fields in nested structs")] |
|
|
|
public void Fail_TooManyFields() |
|
|
|
bool success = CSharpToHLSL.GenerateHLSL(typeof(FailureTypes.TooManyFields), new GenerateHLSL(PackingRules.Aggressive), out source, out errors); |
|
|
|
bool success = CSharpToHLSL.GenerateHLSL(typeof(FailureTypes.TooManyFields), new GenerateHLSL(PackingRules.Exact), out source, out errors); |
|
|
|
[Test] |
|
|
|
public void Fail_MergeIncompatibleTypes() |
|
|
|
[Test(Description = "Disallow merging incompatible types when doing aggressive packing")] |
|
|
|
public void Fail_MergeIncompatibleTypes() |
|
|
|
{ |
|
|
|
string source; |
|
|
|
List<string> errors; |
|
|
|
|
|
|
Assert.IsTrue(HasErrorString(errors, "incompatible types")); |
|
|
|
} |
|
|
|
|
|
|
|
[Test] |
|
|
|
public void Fail_MergeCrossBoundary() |
|
|
|
[Test(Description = "Disallow placing fields across register boundaries when merging")] |
|
|
|
public void Fail_MergeCrossBoundary() |
|
|
|
{ |
|
|
|
string source; |
|
|
|
List<string> errors; |
|
|
|