chromium/third_party/dawn/src/tint/lang/wgsl/resolver/function_validation_test.cc

// Copyright 2021 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
//    list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
//    contributors may be used to endorse or promote products derived from
//    this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "src/tint/lang/core/builtin_value.h"
#include "src/tint/lang/wgsl/ast/discard_statement.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 "src/tint/utils/text/string_stream.h"

#include "gmock/gmock.h"

namespace tint::resolver {
namespace {

usingnamespacetint::core::fluent_types;     // NOLINT
usingnamespacetint::core::number_suffixes;  // NOLINT

class ResolverFunctionValidationTest : public TestHelper, public testing::Test {};

TEST_F(ResolverFunctionValidationTest, DuplicateParameterName) {}

TEST_F(ResolverFunctionValidationTest, ParameterMayShadowGlobal) {}

TEST_F(ResolverFunctionValidationTest, LocalConflictsWithParameter) {}

TEST_F(ResolverFunctionValidationTest, NestedLocalMayShadowParameter) {}

TEST_F(ResolverFunctionValidationTest, VoidFunctionEndWithoutReturnStatement_Pass) {}

TEST_F(ResolverFunctionValidationTest, FunctionUsingSameVariableName_Pass) {}

TEST_F(ResolverFunctionValidationTest, FunctionNameSameAsFunctionScopeVariableName_Pass) {}

TEST_F(ResolverFunctionValidationTest, UnreachableCode_return) {}

TEST_F(ResolverFunctionValidationTest, UnreachableCode_return_InBlocks) {}

TEST_F(ResolverFunctionValidationTest, UnreachableCode_discard_nowarning) {}

TEST_F(ResolverFunctionValidationTest, DiscardCalledDirectlyFromVertexEntryPoint) {}

TEST_F(ResolverFunctionValidationTest, DiscardCalledIndirectlyFromComputeEntryPoint) {}

TEST_F(ResolverFunctionValidationTest, FunctionEndWithoutReturnStatement_Fail) {}

TEST_F(ResolverFunctionValidationTest, VoidFunctionEndWithoutReturnStatementEmptyBody_Pass) {}

TEST_F(ResolverFunctionValidationTest, FunctionEndWithoutReturnStatementEmptyBody_Fail) {}

TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementType_Pass) {}

TEST_F(ResolverFunctionValidationTest, VoidFunctionReturnsAInt) {}

TEST_F(ResolverFunctionValidationTest, VoidFunctionReturnsAFloat) {}

TEST_F(ResolverFunctionValidationTest, VoidFunctionReturnsI32) {}

TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementType_void_fail) {}

TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementTypeMissing_fail) {}

TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementTypeF32_pass) {}

TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementTypeF32_fail) {}

TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementTypeF32Alias_pass) {}

TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementTypeF32Alias_fail) {}

TEST_F(ResolverFunctionValidationTest, CannotCallEntryPoint) {}

TEST_F(ResolverFunctionValidationTest, CannotCallFunctionAtModuleScope) {}

TEST_F(ResolverFunctionValidationTest, PipelineStage_MustBeUnique_Fail) {}

TEST_F(ResolverFunctionValidationTest, NoPipelineEntryPoints) {}

TEST_F(ResolverFunctionValidationTest, FunctionVarInitWithParam) {}

TEST_F(ResolverFunctionValidationTest, FunctionConstInitWithParam) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_ConstU32) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Cast) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_I32) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_U32) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_I32_AInt) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_U32_AInt) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Expr) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_MismatchType_U32) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_MismatchType_I32) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_TypeMismatch) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_TypeMismatch2) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Mismatch_ConstU32) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_BadType) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_Negative) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_Zero) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_BadType) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_Negative) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_Zero) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_NestedZeroValueInitializer) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_OverflowsU32_0x10000_0x100_0x100) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_OverflowsU32_0x10000_0x10000) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_OverflowsU32_0x10000_C_0x10000) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_OverflowsU32_0x10000_C) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_OverflowsU32_0x10000_O_0x10000) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_NonConst) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_InvalidExpr_x) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_InvalidExpr_y) {}

TEST_F(ResolverFunctionValidationTest, WorkgroupSize_InvalidExpr_z) {}

TEST_F(ResolverFunctionValidationTest, ReturnIsConstructible_NonPlain) {}

TEST_F(ResolverFunctionValidationTest, ReturnIsConstructible_AtomicInt) {}

TEST_F(ResolverFunctionValidationTest, ReturnIsConstructible_ArrayOfAtomic) {}

TEST_F(ResolverFunctionValidationTest, ReturnIsConstructible_StructOfAtomic) {}

TEST_F(ResolverFunctionValidationTest, ReturnIsConstructible_RuntimeArray) {}

TEST_F(ResolverFunctionValidationTest, ParameterStoreType_NonAtomicFree) {}

TEST_F(ResolverFunctionValidationTest, ParameterStoreType_AtomicFree) {}

TEST_F(ResolverFunctionValidationTest, ParametersAtLimit) {}

TEST_F(ResolverFunctionValidationTest, ParametersOverLimit) {}

TEST_F(ResolverFunctionValidationTest, ParameterVectorNoType) {}

TEST_F(ResolverFunctionValidationTest, ParameterMatrixNoType) {}

enum class Expectation {};
struct TestParams {};

struct TestWithParams : ResolverTestWithParam<TestParams> {};

ResolverFunctionParameterValidationTest;
TEST_P(ResolverFunctionParameterValidationTest, AddressSpaceWithoutUnrestrictedPointerParameters) {}
TEST_P(ResolverFunctionParameterValidationTest, AddressSpaceWithUnrestrictedPointerParameters) {}
INSTANTIATE_TEST_SUITE_P();

}  // namespace
}  // namespace tint::resolver