Remove duplicated tests on ast::TextureType

Those tests already exist under src/ast.

Add a test of sem::Texture::dim() instead

Change-Id: I4b77d46b9a4e3aca8292d64e2477bb002ab5c1cb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51805
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
David Neto 2021-05-21 19:40:23 +00:00 committed by Tint LUCI CQ
parent 9d555d1621
commit e92a1ae4ac
1 changed files with 17 additions and 18 deletions

View File

@ -14,33 +14,32 @@
#include "src/sem/texture_type.h" #include "src/sem/texture_type.h"
#include "src/sem/sampled_texture_type.h"
#include "src/sem/test_helper.h" #include "src/sem/test_helper.h"
namespace tint { namespace tint {
namespace sem { namespace sem {
namespace { namespace {
using TextureTypeTest = TestHelper; using TextureTypeDimTest = TestParamHelper<ast::TextureDimension>;
TEST_F(TextureTypeTest, IsTextureArray) { TEST_P(TextureTypeDimTest, DimMustMatch) {
EXPECT_EQ(false, IsTextureArray(ast::TextureDimension::kNone)); // Check that the dim() query returns the right dimensionality.
EXPECT_EQ(false, IsTextureArray(ast::TextureDimension::k1d)); F32 f32;
EXPECT_EQ(false, IsTextureArray(ast::TextureDimension::k2d)); // TextureType is an abstract class, so use concrete class
EXPECT_EQ(true, IsTextureArray(ast::TextureDimension::k2dArray)); // SampledTexture in its stead.
EXPECT_EQ(false, IsTextureArray(ast::TextureDimension::k3d)); SampledTexture st(GetParam(), &f32);
EXPECT_EQ(false, IsTextureArray(ast::TextureDimension::kCube)); EXPECT_EQ(st.dim(), GetParam());
EXPECT_EQ(true, IsTextureArray(ast::TextureDimension::kCubeArray));
} }
TEST_F(TextureTypeTest, NumCoordinateAxes) { INSTANTIATE_TEST_SUITE_P(Dimensions,
EXPECT_EQ(0, NumCoordinateAxes(ast::TextureDimension::kNone)); TextureTypeDimTest,
EXPECT_EQ(1, NumCoordinateAxes(ast::TextureDimension::k1d)); ::testing::Values(ast::TextureDimension::k1d,
EXPECT_EQ(2, NumCoordinateAxes(ast::TextureDimension::k2d)); ast::TextureDimension::k2d,
EXPECT_EQ(2, NumCoordinateAxes(ast::TextureDimension::k2dArray)); ast::TextureDimension::k2dArray,
EXPECT_EQ(3, NumCoordinateAxes(ast::TextureDimension::k3d)); ast::TextureDimension::k3d,
EXPECT_EQ(3, NumCoordinateAxes(ast::TextureDimension::kCube)); ast::TextureDimension::kCube,
EXPECT_EQ(3, NumCoordinateAxes(ast::TextureDimension::kCubeArray)); ast::TextureDimension::kCubeArray));
}
} // namespace } // namespace
} // namespace sem } // namespace sem