dawn-cmake/src/tint/resolver/validator_test_helper.h
dan sinclair f05575bb21 [tint] Move validation code into a Validator class.
This CL moves the Validate methods from the Resolver into a specific
Validator class used by the Resolver.

Bug: tint:1313
Change-Id: Ida21a0cc65f2679739c8499de7065ff8b58c4efc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87150
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-04-21 13:40:16 +00:00

47 lines
1.3 KiB
C++

// Copyright 2022 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_TINT_RESOLVER_VALIDATOR_TEST_HELPER_H_
#define SRC_TINT_RESOLVER_VALIDATOR_TEST_HELPER_H_
#include <memory>
#include "gtest/gtest.h"
#include "src/tint/program_builder.h"
#include "src/tint/resolver/validator.h"
namespace tint::resolver {
/// Helper class for testing
class TestHelper : public ProgramBuilder {
public:
/// Constructor
TestHelper();
/// Destructor
~TestHelper() override;
/// @return a pointer to the Validator
Validator* v() const { return validator_.get(); }
private:
std::unique_ptr<Validator> validator_;
};
class ValidatorTest : public TestHelper, public testing::Test {};
} // namespace tint::resolver
#endif // SRC_TINT_RESOLVER_VALIDATOR_TEST_HELPER_H_