#include "src/tint/lang/core/type/multisampled_texture.h"
#include "src/tint/lang/core/type/storage_texture.h"
#include "src/tint/lang/core/type/texture_dimension.h"
#include "src/tint/lang/wgsl/ast/id_attribute.h"
#include "src/tint/lang/wgsl/ast/return_statement.h"
#include "src/tint/lang/wgsl/ast/stage_attribute.h"
#include "src/tint/lang/wgsl/resolver/resolver.h"
#include "src/tint/lang/wgsl/resolver/resolver_helper_test.h"
#include "gmock/gmock.h"
namespace tint::resolver {
namespace {
usingnamespacetint::core::fluent_types;
usingnamespacetint::core::number_suffixes;
DataType;
alias;
alias1;
alias2;
alias3;
class ResolverTypeValidationTest : public resolver::TestHelper, public testing::Test { … };
TEST_F(ResolverTypeValidationTest, VariableDeclNoInitializer_Pass) { … }
TEST_F(ResolverTypeValidationTest, GlobalOverrideNoInitializer_Pass) { … }
TEST_F(ResolverTypeValidationTest, GlobalVariableWithAddressSpace_Pass) { … }
TEST_F(ResolverTypeValidationTest, GlobalConstNoAddressSpace_Pass) { … }
TEST_F(ResolverTypeValidationTest, GlobalVariableUnique_Pass) { … }
TEST_F(ResolverTypeValidationTest, GlobalVariableFunctionVariableNotUnique_Pass) { … }
TEST_F(ResolverTypeValidationTest, RedeclaredIdentifierInnerScope_Pass) { … }
TEST_F(ResolverTypeValidationTest, RedeclaredIdentifierInnerScopeBlock_Pass) { … }
TEST_F(ResolverTypeValidationTest, RedeclaredIdentifierDifferentFunctions_Pass) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_AIntLiteral_Pass) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_UnsignedLiteral_Pass) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_SignedLiteral_Pass) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_UnsignedConst_Pass) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_SignedConst_Pass) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_AIntLiteral_Zero) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_UnsignedLiteral_Zero) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_SignedLiteral_Zero) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_SignedLiteral_Negative) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_UnsignedConst_Zero) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_SignedConst_Zero) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_SignedConst_Negative) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_FloatLiteral) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_IVecLiteral) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_FloatConst) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_IVecConst) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_UnderElementCountLimit) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_OverElementCountLimit) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_StorageBufferLargeArray) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_NestedStorageBufferLargeArray) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_TooBig_ImplicitStride) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_TooBig_ExplicitStride) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_NamedOverride_PrivateVar) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_NamedOverride_InArray) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_NamedOverride_InStruct) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_NamedOverride_FunctionVar_Explicit) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_NamedOverride_FunctionLet_Explicit) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_NamedOverride_FunctionVar_Implicit) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_NamedOverride_FunctionLet_Implicit) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_UnnamedOverride_Equivalence) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_NamedOverride_Param) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_NamedOverride_ReturnType) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_Workgroup_Overridable) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_ModuleVar) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_FunctionConst) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_FunctionLet) { … }
TEST_F(ResolverTypeValidationTest, ArraySize_ComplexExpr) { … }
TEST_F(ResolverTypeValidationTest, RuntimeArrayInFunction_Fail) { … }
TEST_F(ResolverTypeValidationTest, PtrType_ArrayIncomplete) { … }
TEST_F(ResolverTypeValidationTest, Struct_Member_VectorIncomplete) { … }
TEST_F(ResolverTypeValidationTest, Struct_Member_MatrixIncomplete) { … }
TEST_F(ResolverTypeValidationTest, Struct_TooBig) { … }
TEST_F(ResolverTypeValidationTest, Struct_MemberOffset_TooBig) { … }
TEST_F(ResolverTypeValidationTest, RuntimeArrayIsLast_Pass) { … }
TEST_F(ResolverTypeValidationTest, RuntimeArrayInArray) { … }
TEST_F(ResolverTypeValidationTest, RuntimeArrayInStructInArray) { … }
TEST_F(ResolverTypeValidationTest, RuntimeArrayInStructInStruct) { … }
TEST_F(ResolverTypeValidationTest, RuntimeArrayIsNotLast_Fail) { … }
TEST_F(ResolverTypeValidationTest, RuntimeArrayAsGlobalVariable) { … }
TEST_F(ResolverTypeValidationTest, RuntimeArrayAsLocalVariable) { … }
TEST_F(ResolverTypeValidationTest, RuntimeArrayAsParameter_Fail) { … }
TEST_F(ResolverTypeValidationTest, PtrToPtr_Fail) { … }
TEST_F(ResolverTypeValidationTest, PtrToRuntimeArrayAsPointerParameter_Fail) { … }
TEST_F(ResolverTypeValidationTest, PtrToRuntimeArrayAsParameter_Fail) { … }
TEST_F(ResolverTypeValidationTest, AliasRuntimeArrayIsNotLast_Fail) { … }
TEST_F(ResolverTypeValidationTest, AliasRuntimeArrayIsLast_Pass) { … }
TEST_F(ResolverTypeValidationTest, ArrayOfNonStorableType) { … }
TEST_F(ResolverTypeValidationTest, ArrayOfNonStorableTypeWithStride) { … }
namespace GetCanonicalTests {
struct Params { … };
template <typename T>
constexpr Params ParamsFor() { … }
static constexpr Params cases[] = …;
CanonicalTest;
TEST_P(CanonicalTest, All) { … }
INSTANTIATE_TEST_SUITE_P(…);
}
namespace SampledTextureTests {
SampledTextureDimensionTest;
TEST_P(SampledTextureDimensionTest, All) { … }
INSTANTIATE_TEST_SUITE_P(…);
MultisampledTextureDimensionTest;
TEST_P(MultisampledTextureDimensionTest, All) { … }
INSTANTIATE_TEST_SUITE_P(…);
struct TypeParams { … };
template <typename T>
constexpr TypeParams TypeParamsFor(bool is_valid) { … }
static constexpr TypeParams type_cases[] = …;
SampledTextureTypeTest;
TEST_P(SampledTextureTypeTest, All) { … }
INSTANTIATE_TEST_SUITE_P(…);
MultisampledTextureTypeTest;
TEST_P(MultisampledTextureTypeTest, All) { … }
INSTANTIATE_TEST_SUITE_P(…);
}
namespace StorageTextureTests {
struct DimensionParams { … };
static constexpr DimensionParams Dimension_cases[] = …;
StorageTextureDimensionTest;
TEST_P(StorageTextureDimensionTest, All) { … }
INSTANTIATE_TEST_SUITE_P(…);
struct FormatParams { … };
static constexpr FormatParams format_cases[] = …;
StorageTextureFormatTest;
TEST_P(StorageTextureFormatTest, All) { … }
INSTANTIATE_TEST_SUITE_P(…);
StorageTextureAccessTest;
TEST_F(StorageTextureAccessTest, MissingTemplates) { … }
TEST_F(StorageTextureAccessTest, MissingAccess_Fail) { … }
TEST_F(StorageTextureAccessTest, WriteOnlyAccess_Pass) { … }
TEST_F(StorageTextureAccessTest, ReadOnlyAccess_Pass) { … }
TEST_F(StorageTextureAccessTest, ReadOnlyAccess_FeatureDisallowed) { … }
TEST_F(StorageTextureAccessTest, RWAccess_Pass) { … }
TEST_F(StorageTextureAccessTest, RWAccess_FeatureDisallowed) { … }
}
namespace MatrixTests {
struct Params { … };
template <typename T>
constexpr Params ParamsFor(uint32_t columns, uint32_t rows) { … }
ValidMatrixTypes;
TEST_P(ValidMatrixTypes, Okay) { … }
INSTANTIATE_TEST_SUITE_P(…);
InvalidMatrixElementTypes;
TEST_P(InvalidMatrixElementTypes, InvalidElementType) { … }
INSTANTIATE_TEST_SUITE_P(…);
}
namespace VectorTests {
struct Params { … };
template <typename T>
constexpr Params ParamsFor(uint32_t width) { … }
ValidVectorTypes;
TEST_P(ValidVectorTypes, Okay) { … }
INSTANTIATE_TEST_SUITE_P(…);
InvalidVectorElementTypes;
TEST_P(InvalidVectorElementTypes, InvalidElementType) { … }
INSTANTIATE_TEST_SUITE_P(…);
}
namespace BuiltinTypeAliasTests {
struct Params { … };
template <typename T>
constexpr Params Case(const char* alias) { … }
BuiltinTypeAliasTest;
TEST_P(BuiltinTypeAliasTest, CheckEquivalent) { … }
TEST_P(BuiltinTypeAliasTest, Construct) { … }
INSTANTIATE_TEST_SUITE_P(…);
}
namespace TypeDoesNotTakeTemplateArgs {
ResolverUntemplatedTypeUsedWithTemplateArgs;
TEST_P(ResolverUntemplatedTypeUsedWithTemplateArgs, Builtin_UseWithTemplateArgs) { … }
TEST_P(ResolverUntemplatedTypeUsedWithTemplateArgs, BuiltinAlias_UseWithTemplateArgs) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(ResolverUntemplatedTypeUsedWithTemplateArgs, Struct_Type) { … }
TEST_F(ResolverUntemplatedTypeUsedWithTemplateArgs, Struct_Ctor) { … }
TEST_F(ResolverUntemplatedTypeUsedWithTemplateArgs, AliasedArray_Type) { … }
TEST_F(ResolverUntemplatedTypeUsedWithTemplateArgs, AliasedArray_Ctor) { … }
}
}
}