• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 The Tint Authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "src/ast/sampler.h"
16 
17 #include "src/ast/test_helper.h"
18 
19 namespace tint {
20 namespace ast {
21 namespace {
22 
23 using AstSamplerTest = TestHelper;
24 
TEST_F(AstSamplerTest,Creation)25 TEST_F(AstSamplerTest, Creation) {
26   auto* s = create<Sampler>(SamplerKind::kSampler);
27   EXPECT_EQ(s->kind, SamplerKind::kSampler);
28 }
29 
TEST_F(AstSamplerTest,Creation_ComparisonSampler)30 TEST_F(AstSamplerTest, Creation_ComparisonSampler) {
31   auto* s = create<Sampler>(SamplerKind::kComparisonSampler);
32   EXPECT_EQ(s->kind, SamplerKind::kComparisonSampler);
33   EXPECT_TRUE(s->IsComparison());
34 }
35 
TEST_F(AstSamplerTest,FriendlyNameSampler)36 TEST_F(AstSamplerTest, FriendlyNameSampler) {
37   auto* s = create<Sampler>(SamplerKind::kSampler);
38   EXPECT_EQ(s->FriendlyName(Symbols()), "sampler");
39 }
40 
TEST_F(AstSamplerTest,FriendlyNameComparisonSampler)41 TEST_F(AstSamplerTest, FriendlyNameComparisonSampler) {
42   auto* s = create<Sampler>(SamplerKind::kComparisonSampler);
43   EXPECT_EQ(s->FriendlyName(Symbols()), "sampler_comparison");
44 }
45 
46 }  // namespace
47 }  // namespace ast
48 }  // namespace tint
49