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/multisampled_texture.h"
16
17 #include "src/ast/access.h"
18 #include "src/ast/alias.h"
19 #include "src/ast/array.h"
20 #include "src/ast/bool.h"
21 #include "src/ast/depth_texture.h"
22 #include "src/ast/f32.h"
23 #include "src/ast/i32.h"
24 #include "src/ast/matrix.h"
25 #include "src/ast/pointer.h"
26 #include "src/ast/sampled_texture.h"
27 #include "src/ast/sampler.h"
28 #include "src/ast/storage_texture.h"
29 #include "src/ast/struct.h"
30 #include "src/ast/test_helper.h"
31 #include "src/ast/texture.h"
32 #include "src/ast/u32.h"
33 #include "src/ast/vector.h"
34
35 namespace tint {
36 namespace ast {
37 namespace {
38
39 using AstMultisampledTextureTest = TestHelper;
40
TEST_F(AstMultisampledTextureTest,IsTexture)41 TEST_F(AstMultisampledTextureTest, IsTexture) {
42 auto* f32 = create<F32>();
43 Texture* ty = create<MultisampledTexture>(TextureDimension::kCube, f32);
44 EXPECT_FALSE(ty->Is<DepthTexture>());
45 EXPECT_TRUE(ty->Is<MultisampledTexture>());
46 EXPECT_FALSE(ty->Is<SampledTexture>());
47 EXPECT_FALSE(ty->Is<StorageTexture>());
48 }
49
TEST_F(AstMultisampledTextureTest,Dim)50 TEST_F(AstMultisampledTextureTest, Dim) {
51 auto* f32 = create<F32>();
52 auto* s = create<MultisampledTexture>(TextureDimension::k3d, f32);
53 EXPECT_EQ(s->dim, TextureDimension::k3d);
54 }
55
TEST_F(AstMultisampledTextureTest,Type)56 TEST_F(AstMultisampledTextureTest, Type) {
57 auto* f32 = create<F32>();
58 auto* s = create<MultisampledTexture>(TextureDimension::k3d, f32);
59 EXPECT_EQ(s->type, f32);
60 }
61
TEST_F(AstMultisampledTextureTest,FriendlyName)62 TEST_F(AstMultisampledTextureTest, FriendlyName) {
63 auto* f32 = create<F32>();
64 auto* s = create<MultisampledTexture>(TextureDimension::k3d, f32);
65 EXPECT_EQ(s->FriendlyName(Symbols()), "texture_multisampled_3d<f32>");
66 }
67
68 } // namespace
69 } // namespace ast
70 } // namespace tint
71