Remove unused testing files
Change-Id: I0af37c775a818a5a76baa48fb8e55b38c6b40eee Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/43480 Auto-Submit: James Price <jrprice@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
9062f13202
commit
a349e54149
|
@ -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<ast::LocationDecoration>(0),
|
||||
});
|
||||
|
||||
auto* loc2 = Var("loc2", ast::StorageClass::kInput, ty.i32(), nullptr,
|
||||
ast::VariableDecorationList{
|
||||
create<ast::LocationDecoration>(1),
|
||||
});
|
||||
|
||||
auto* builtin1 =
|
||||
Var("builtin1", ast::StorageClass::kInput, ty.i32(), nullptr,
|
||||
ast::VariableDecorationList{
|
||||
create<ast::BuiltinDecoration>(ast::Builtin::kPosition),
|
||||
});
|
||||
|
||||
auto* builtin2 =
|
||||
Var("builtin2", ast::StorageClass::kInput, ty.i32(), nullptr,
|
||||
ast::VariableDecorationList{
|
||||
create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth),
|
||||
});
|
||||
|
||||
auto* f = create<Function>(
|
||||
/* referenced_module_vars */ std::vector<ast::Variable*>{loc1, builtin1,
|
||||
loc2, builtin2},
|
||||
/* local_referenced_module_vars */ std::vector<ast::Variable*>{},
|
||||
/* ancestor_entry_points */ std::vector<Symbol>{});
|
||||
|
||||
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<ast::LocationDecoration>(0),
|
||||
});
|
||||
|
||||
auto* loc2 = Var("loc2", ast::StorageClass::kInput, ty.i32(), nullptr,
|
||||
ast::VariableDecorationList{
|
||||
create<ast::LocationDecoration>(1),
|
||||
});
|
||||
|
||||
auto* builtin1 =
|
||||
Var("builtin1", ast::StorageClass::kInput, ty.i32(), nullptr,
|
||||
ast::VariableDecorationList{
|
||||
create<ast::BuiltinDecoration>(ast::Builtin::kPosition),
|
||||
});
|
||||
|
||||
auto* builtin2 =
|
||||
Var("builtin2", ast::StorageClass::kInput, ty.i32(), nullptr,
|
||||
ast::VariableDecorationList{
|
||||
create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth),
|
||||
});
|
||||
|
||||
auto* f = create<Function>(
|
||||
/* referenced_module_vars */ std::vector<ast::Variable*>{loc1, builtin1,
|
||||
loc2, builtin2},
|
||||
/* local_referenced_module_vars */ std::vector<ast::Variable*>{},
|
||||
/* ancestor_entry_points */ std::vector<Symbol>{});
|
||||
|
||||
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
|
|
@ -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 <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "src/program_builder.h"
|
||||
|
||||
namespace tint {
|
||||
namespace semantic {
|
||||
|
||||
/// Helper class for testing
|
||||
template <typename BASE>
|
||||
class TestHelperBase : public BASE, public ProgramBuilder {};
|
||||
using TestHelper = TestHelperBase<testing::Test>;
|
||||
|
||||
template <typename T>
|
||||
using TestParamHelper = TestHelperBase<testing::TestWithParam<T>>;
|
||||
|
||||
} // namespace semantic
|
||||
} // namespace tint
|
||||
|
||||
#endif // SRC_SEMANTIC_TEST_HELPER_H_
|
Loading…
Reference in New Issue