diff --git a/src/semantic/sem_function_test.cc b/src/semantic/sem_function_test.cc deleted file mode 100644 index 49eb8b8423..0000000000 --- a/src/semantic/sem_function_test.cc +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/semantic/function.h" - -#include "src/ast/builtin_decoration.h" -#include "src/ast/location_decoration.h" -#include "src/semantic/test_helper.h" - -namespace tint { -namespace semantic { -namespace { - -using FunctionTest = TestHelper; - -TEST_F(FunctionTest, GetReferenceLocations) { - auto* loc1 = Var("loc1", ast::StorageClass::kInput, ty.i32(), nullptr, - ast::VariableDecorationList{ - create(0), - }); - - auto* loc2 = Var("loc2", ast::StorageClass::kInput, ty.i32(), nullptr, - ast::VariableDecorationList{ - create(1), - }); - - auto* builtin1 = - Var("builtin1", ast::StorageClass::kInput, ty.i32(), nullptr, - ast::VariableDecorationList{ - create(ast::Builtin::kPosition), - }); - - auto* builtin2 = - Var("builtin2", ast::StorageClass::kInput, ty.i32(), nullptr, - ast::VariableDecorationList{ - create(ast::Builtin::kFragDepth), - }); - - auto* f = create( - /* referenced_module_vars */ std::vector{loc1, builtin1, - loc2, builtin2}, - /* local_referenced_module_vars */ std::vector{}, - /* ancestor_entry_points */ std::vector{}); - - ASSERT_EQ(f->ReferencedModuleVariables().size(), 4u); - - auto ref_locs = f->ReferencedLocationVariables(); - ASSERT_EQ(ref_locs.size(), 2u); - EXPECT_EQ(ref_locs[0].first, loc1); - EXPECT_EQ(ref_locs[0].second->value(), 0u); - EXPECT_EQ(ref_locs[1].first, loc2); - EXPECT_EQ(ref_locs[1].second->value(), 1u); -} - -TEST_F(FunctionTest, GetReferenceBuiltins) { - auto* loc1 = Var("loc1", ast::StorageClass::kInput, ty.i32(), nullptr, - ast::VariableDecorationList{ - create(0), - }); - - auto* loc2 = Var("loc2", ast::StorageClass::kInput, ty.i32(), nullptr, - ast::VariableDecorationList{ - create(1), - }); - - auto* builtin1 = - Var("builtin1", ast::StorageClass::kInput, ty.i32(), nullptr, - ast::VariableDecorationList{ - create(ast::Builtin::kPosition), - }); - - auto* builtin2 = - Var("builtin2", ast::StorageClass::kInput, ty.i32(), nullptr, - ast::VariableDecorationList{ - create(ast::Builtin::kFragDepth), - }); - - auto* f = create( - /* referenced_module_vars */ std::vector{loc1, builtin1, - loc2, builtin2}, - /* local_referenced_module_vars */ std::vector{}, - /* ancestor_entry_points */ std::vector{}); - - ASSERT_EQ(f->ReferencedModuleVariables().size(), 4u); - - auto ref_locs = f->ReferencedBuiltinVariables(); - ASSERT_EQ(ref_locs.size(), 2u); - EXPECT_EQ(ref_locs[0].first, builtin1); - EXPECT_EQ(ref_locs[0].second->value(), ast::Builtin::kPosition); - EXPECT_EQ(ref_locs[1].first, builtin2); - EXPECT_EQ(ref_locs[1].second->value(), ast::Builtin::kFragDepth); -} - -} // namespace -} // namespace semantic -} // namespace tint diff --git a/src/semantic/test_helper.h b/src/semantic/test_helper.h deleted file mode 100644 index 0a32422781..0000000000 --- a/src/semantic/test_helper.h +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2020 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_SEMANTIC_TEST_HELPER_H_ -#define SRC_SEMANTIC_TEST_HELPER_H_ - -#include -#include -#include - -#include "gtest/gtest.h" -#include "src/program_builder.h" - -namespace tint { -namespace semantic { - -/// Helper class for testing -template -class TestHelperBase : public BASE, public ProgramBuilder {}; -using TestHelper = TestHelperBase; - -template -using TestParamHelper = TestHelperBase>; - -} // namespace semantic -} // namespace tint - -#endif // SRC_SEMANTIC_TEST_HELPER_H_