Remove "Is" tests

These originate from a time before Castable, and there were hand-written Is<T>() methods on each of the base types.

Castable has its own tests that ensure the Is<T>() and As<T>() work as expected.
We don't need to check that this logic works for every type that derives from castable.

Change-Id: Iaa376dc4b4b5ee413a83fc5f9113cd3ef91dfe4a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50540
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton 2021-05-10 18:27:31 +00:00 committed by Commit Bot service account
parent eebf0c97d9
commit 6ba446fa5e
49 changed files with 0 additions and 712 deletions

View File

@ -41,24 +41,6 @@ TEST_F(AstAccessControlTest, Create) {
EXPECT_EQ(a->type(), u32); EXPECT_EQ(a->type(), u32);
} }
TEST_F(AstAccessControlTest, Is) {
auto* i32 = create<I32>();
Type* ty = create<AccessControl>(AccessControl::kReadOnly, i32);
EXPECT_TRUE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(AstAccessControlTest, AccessRead) { TEST_F(AstAccessControlTest, AccessRead) {
auto* i32 = create<I32>(); auto* i32 = create<I32>();
auto* ac = create<AccessControl>(AccessControl::kReadOnly, i32); auto* ac = create<AccessControl>(AccessControl::kReadOnly, i32);

View File

@ -27,11 +27,6 @@ TEST_F(AccessDecorationTest, Creation) {
EXPECT_EQ(ast::AccessControl::kWriteOnly, d->value()); EXPECT_EQ(ast::AccessControl::kWriteOnly, d->value());
} }
TEST_F(AccessDecorationTest, Is) {
auto* d = create<AccessDecoration>(ast::AccessControl::kReadWrite);
EXPECT_TRUE(d->Is<ast::AccessDecoration>());
}
TEST_F(AccessDecorationTest, ToStr) { TEST_F(AccessDecorationTest, ToStr) {
auto* d = create<AccessDecoration>(ast::AccessControl::kReadOnly); auto* d = create<AccessDecoration>(ast::AccessControl::kReadOnly);
EXPECT_EQ(str(d), R"(AccessDecoration{read_only} EXPECT_EQ(str(d), R"(AccessDecoration{read_only}

View File

@ -40,23 +40,6 @@ TEST_F(AstAliasTest, Create) {
EXPECT_EQ(a->type(), u32); EXPECT_EQ(a->type(), u32);
} }
TEST_F(AstAliasTest, Is) {
Type* ty = create<Alias>(Sym("a"), create<I32>());
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_TRUE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
// Check for linear-time evaluation of Alias::type_name(). // Check for linear-time evaluation of Alias::type_name().
// If type_name() is non-linear, this test should noticeably stall. // If type_name() is non-linear, this test should noticeably stall.
// See: crbug.com/1200936 // See: crbug.com/1200936

View File

@ -51,24 +51,6 @@ TEST_F(AstArrayTest, CreateRuntimeArray) {
EXPECT_TRUE(arr->IsRuntimeArray()); EXPECT_TRUE(arr->IsRuntimeArray());
} }
TEST_F(AstArrayTest, Is) {
auto* i32 = create<I32>();
Type* ty = create<Array>(i32, 3, DecorationList{});
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>());
EXPECT_TRUE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(AstArrayTest, TypeName) { TEST_F(AstArrayTest, TypeName) {
auto* i32 = create<I32>(); auto* i32 = create<I32>();
auto* arr = create<Array>(i32, 0, DecorationList{}); auto* arr = create<Array>(i32, 0, DecorationList{});

View File

@ -26,15 +26,6 @@ TEST_F(BindingDecorationTest, Creation) {
EXPECT_EQ(2u, d->value()); EXPECT_EQ(2u, d->value());
} }
TEST_F(BindingDecorationTest, Is) {
Decoration* d = create<BindingDecoration>(2);
EXPECT_TRUE(d->Is<BindingDecoration>());
EXPECT_FALSE(d->Is<BuiltinDecoration>());
EXPECT_FALSE(d->Is<OverrideDecoration>());
EXPECT_FALSE(d->Is<LocationDecoration>());
EXPECT_FALSE(d->Is<GroupDecoration>());
}
TEST_F(BindingDecorationTest, ToStr) { TEST_F(BindingDecorationTest, ToStr) {
auto* d = create<BindingDecoration>(2); auto* d = create<BindingDecoration>(2);
EXPECT_EQ(str(d), R"(BindingDecoration{2} EXPECT_EQ(str(d), R"(BindingDecoration{2}

View File

@ -34,15 +34,6 @@ TEST_F(BoolLiteralTest, False) {
ASSERT_TRUE(b->IsFalse()); ASSERT_TRUE(b->IsFalse());
} }
TEST_F(BoolLiteralTest, Is) {
ast::Literal* l = create<BoolLiteral>(false);
EXPECT_TRUE(l->Is<BoolLiteral>());
EXPECT_FALSE(l->Is<SintLiteral>());
EXPECT_FALSE(l->Is<FloatLiteral>());
EXPECT_FALSE(l->Is<UintLiteral>());
EXPECT_FALSE(l->Is<IntLiteral>());
}
TEST_F(BoolLiteralTest, ToStr) { TEST_F(BoolLiteralTest, ToStr) {
auto* t = create<BoolLiteral>(true); auto* t = create<BoolLiteral>(true);
auto* f = create<BoolLiteral>(false); auto* f = create<BoolLiteral>(false);

View File

@ -33,23 +33,6 @@ namespace {
using AstBoolTest = TestHelper; using AstBoolTest = TestHelper;
TEST_F(AstBoolTest, Is) {
Type* ty = create<Bool>();
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_TRUE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(AstBoolTest, TypeName) { TEST_F(AstBoolTest, TypeName) {
auto* b = create<Bool>(); auto* b = create<Bool>();
EXPECT_EQ(b->type_name(), "__bool"); EXPECT_EQ(b->type_name(), "__bool");

View File

@ -26,15 +26,6 @@ TEST_F(BuiltinDecorationTest, Creation) {
EXPECT_EQ(Builtin::kFragDepth, d->value()); EXPECT_EQ(Builtin::kFragDepth, d->value());
} }
TEST_F(BuiltinDecorationTest, Is) {
Decoration* d = create<BuiltinDecoration>(Builtin::kFragDepth);
EXPECT_FALSE(d->Is<BindingDecoration>());
EXPECT_TRUE(d->Is<BuiltinDecoration>());
EXPECT_FALSE(d->Is<OverrideDecoration>());
EXPECT_FALSE(d->Is<LocationDecoration>());
EXPECT_FALSE(d->Is<GroupDecoration>());
}
TEST_F(BuiltinDecorationTest, ToStr) { TEST_F(BuiltinDecorationTest, ToStr) {
auto* d = create<BuiltinDecoration>(Builtin::kFragDepth); auto* d = create<BuiltinDecoration>(Builtin::kFragDepth);
EXPECT_EQ(str(d), R"(BuiltinDecoration{frag_depth} EXPECT_EQ(str(d), R"(BuiltinDecoration{frag_depth}

View File

@ -36,23 +36,6 @@ namespace {
using AstDepthTextureTest = TestHelper; using AstDepthTextureTest = TestHelper;
TEST_F(AstDepthTextureTest, Is) {
Type* ty = create<DepthTexture>(TextureDimension::kCube);
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_TRUE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(AstDepthTextureTest, IsTexture) { TEST_F(AstDepthTextureTest, IsTexture) {
Texture* ty = create<DepthTexture>(TextureDimension::kCube); Texture* ty = create<DepthTexture>(TextureDimension::kCube);
EXPECT_TRUE(ty->Is<DepthTexture>()); EXPECT_TRUE(ty->Is<DepthTexture>());

View File

@ -37,23 +37,6 @@ namespace {
using AstExternalTextureTest = TestHelper; using AstExternalTextureTest = TestHelper;
TEST_F(AstExternalTextureTest, Is) {
Type* ty = create<ExternalTexture>();
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_TRUE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(AstExternalTextureTest, IsTexture) { TEST_F(AstExternalTextureTest, IsTexture) {
Texture* ty = create<ExternalTexture>(); Texture* ty = create<ExternalTexture>();
EXPECT_FALSE(ty->Is<DepthTexture>()); EXPECT_FALSE(ty->Is<DepthTexture>());

View File

@ -33,23 +33,6 @@ namespace {
using AstF32Test = TestHelper; using AstF32Test = TestHelper;
TEST_F(AstF32Test, Is) {
Type* ty = create<F32>();
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_TRUE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(AstF32Test, TypeName) { TEST_F(AstF32Test, TypeName) {
auto* f = create<F32>(); auto* f = create<F32>();
EXPECT_EQ(f->type_name(), "__f32"); EXPECT_EQ(f->type_name(), "__f32");

View File

@ -26,15 +26,6 @@ TEST_F(FloatLiteralTest, Value) {
EXPECT_EQ(f->value(), 47.2f); EXPECT_EQ(f->value(), 47.2f);
} }
TEST_F(FloatLiteralTest, Is) {
ast::Literal* l = create<FloatLiteral>(42.f);
EXPECT_FALSE(l->Is<BoolLiteral>());
EXPECT_FALSE(l->Is<SintLiteral>());
EXPECT_FALSE(l->Is<IntLiteral>());
EXPECT_TRUE(l->Is<FloatLiteral>());
EXPECT_FALSE(l->Is<UintLiteral>());
}
TEST_F(FloatLiteralTest, ToStr) { TEST_F(FloatLiteralTest, ToStr) {
auto* f = create<FloatLiteral>(42.1f); auto* f = create<FloatLiteral>(42.1f);
EXPECT_EQ(str(f), "42.099998"); EXPECT_EQ(str(f), "42.099998");

View File

@ -26,14 +26,6 @@ TEST_F(GroupDecorationTest, Creation) {
EXPECT_EQ(2u, d->value()); EXPECT_EQ(2u, d->value());
} }
TEST_F(GroupDecorationTest, Is) {
Decoration* d = create<GroupDecoration>(2);
EXPECT_FALSE(d->Is<BindingDecoration>());
EXPECT_FALSE(d->Is<BuiltinDecoration>());
EXPECT_FALSE(d->Is<OverrideDecoration>());
EXPECT_FALSE(d->Is<LocationDecoration>());
EXPECT_TRUE(d->Is<GroupDecoration>());
}
TEST_F(GroupDecorationTest, ToStr) { TEST_F(GroupDecorationTest, ToStr) {
auto* d = create<GroupDecoration>(2); auto* d = create<GroupDecoration>(2);

View File

@ -34,23 +34,6 @@ namespace {
using AstI32Test = TestHelper; using AstI32Test = TestHelper;
TEST_F(AstI32Test, Is) {
Type* ty = create<I32>();
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_TRUE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(AstI32Test, TypeName) { TEST_F(AstI32Test, TypeName) {
auto* i = create<I32>(); auto* i = create<I32>();
EXPECT_EQ(i->type_name(), "__i32"); EXPECT_EQ(i->type_name(), "__i32");

View File

@ -26,15 +26,6 @@ TEST_F(LocationDecorationTest, Creation) {
EXPECT_EQ(2u, d->value()); EXPECT_EQ(2u, d->value());
} }
TEST_F(LocationDecorationTest, Is) {
Decoration* d = create<LocationDecoration>(2);
EXPECT_FALSE(d->Is<BindingDecoration>());
EXPECT_FALSE(d->Is<BuiltinDecoration>());
EXPECT_FALSE(d->Is<OverrideDecoration>());
EXPECT_TRUE(d->Is<LocationDecoration>());
EXPECT_FALSE(d->Is<GroupDecoration>());
}
TEST_F(LocationDecorationTest, ToStr) { TEST_F(LocationDecorationTest, ToStr) {
auto* d = create<LocationDecoration>(2); auto* d = create<LocationDecoration>(2);
EXPECT_EQ(str(d), R"(LocationDecoration{2} EXPECT_EQ(str(d), R"(LocationDecoration{2}

View File

@ -41,24 +41,6 @@ TEST_F(AstMatrixTest, Creation) {
EXPECT_EQ(m->columns(), 4u); EXPECT_EQ(m->columns(), 4u);
} }
TEST_F(AstMatrixTest, Is) {
auto* i32 = create<I32>();
Type* ty = create<Matrix>(i32, 2, 3);
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_TRUE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(AstMatrixTest, TypeName) { TEST_F(AstMatrixTest, TypeName) {
auto* i32 = create<I32>(); auto* i32 = create<I32>();
auto* m = create<Matrix>(i32, 2, 3); auto* m = create<Matrix>(i32, 2, 3);

View File

@ -38,24 +38,6 @@ namespace {
using AstMultisampledTextureTest = TestHelper; using AstMultisampledTextureTest = TestHelper;
TEST_F(AstMultisampledTextureTest, Is) {
auto* f32 = create<F32>();
Type* ty = create<MultisampledTexture>(TextureDimension::kCube, f32);
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_TRUE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(AstMultisampledTextureTest, IsTexture) { TEST_F(AstMultisampledTextureTest, IsTexture) {
auto* f32 = create<F32>(); auto* f32 = create<F32>();
Texture* ty = create<MultisampledTexture>(TextureDimension::kCube, f32); Texture* ty = create<MultisampledTexture>(TextureDimension::kCube, f32);

View File

@ -27,15 +27,6 @@ TEST_F(OverrideDecorationTest, Creation) {
EXPECT_EQ(12u, d->value()); EXPECT_EQ(12u, d->value());
} }
TEST_F(OverrideDecorationTest, Is) {
Decoration* d = create<OverrideDecoration>(27);
EXPECT_FALSE(d->Is<BindingDecoration>());
EXPECT_FALSE(d->Is<BuiltinDecoration>());
EXPECT_TRUE(d->Is<OverrideDecoration>());
EXPECT_FALSE(d->Is<LocationDecoration>());
EXPECT_FALSE(d->Is<GroupDecoration>());
}
TEST_F(OverrideDecorationTest, ToStr) { TEST_F(OverrideDecorationTest, ToStr) {
auto* d = create<OverrideDecoration>(1200); auto* d = create<OverrideDecoration>(1200);
EXPECT_EQ(str(d), R"(OverrideDecoration{1200} EXPECT_EQ(str(d), R"(OverrideDecoration{1200}

View File

@ -40,24 +40,6 @@ TEST_F(AstPointerTest, Creation) {
EXPECT_EQ(p->storage_class(), ast::StorageClass::kStorage); EXPECT_EQ(p->storage_class(), ast::StorageClass::kStorage);
} }
TEST_F(AstPointerTest, Is) {
auto* i32 = create<I32>();
Type* ty = create<Pointer>(i32, ast::StorageClass::kFunction);
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_TRUE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(AstPointerTest, TypeName) { TEST_F(AstPointerTest, TypeName) {
auto* i32 = create<I32>(); auto* i32 = create<I32>();
auto* p = create<Pointer>(i32, ast::StorageClass::kWorkgroup); auto* p = create<Pointer>(i32, ast::StorageClass::kWorkgroup);

View File

@ -37,24 +37,6 @@ namespace {
using AstSampledTextureTest = TestHelper; using AstSampledTextureTest = TestHelper;
TEST_F(AstSampledTextureTest, Is) {
auto* f32 = create<F32>();
Type* ty = create<SampledTexture>(TextureDimension::kCube, f32);
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_TRUE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(AstSampledTextureTest, IsTexture) { TEST_F(AstSampledTextureTest, IsTexture) {
auto* f32 = create<F32>(); auto* f32 = create<F32>();
Texture* ty = create<SampledTexture>(TextureDimension::kCube, f32); Texture* ty = create<SampledTexture>(TextureDimension::kCube, f32);

View File

@ -44,23 +44,6 @@ TEST_F(AstSamplerTest, Creation_ComparisonSampler) {
EXPECT_TRUE(s->IsComparison()); EXPECT_TRUE(s->IsComparison());
} }
TEST_F(AstSamplerTest, Is) {
Type* ty = create<Sampler>(SamplerKind::kSampler);
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_TRUE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(AstSamplerTest, TypeName_Sampler) { TEST_F(AstSamplerTest, TypeName_Sampler) {
auto* s = create<Sampler>(SamplerKind::kSampler); auto* s = create<Sampler>(SamplerKind::kSampler);
EXPECT_EQ(s->type_name(), "__sampler_sampler"); EXPECT_EQ(s->type_name(), "__sampler_sampler");

View File

@ -26,14 +26,6 @@ TEST_F(SintLiteralTest, Value) {
EXPECT_EQ(i->value(), 47); EXPECT_EQ(i->value(), 47);
} }
TEST_F(SintLiteralTest, Is) {
ast::Literal* l = create<SintLiteral>(42);
EXPECT_FALSE(l->Is<BoolLiteral>());
EXPECT_TRUE(l->Is<SintLiteral>());
EXPECT_FALSE(l->Is<FloatLiteral>());
EXPECT_FALSE(l->Is<UintLiteral>());
}
TEST_F(SintLiteralTest, ToStr) { TEST_F(SintLiteralTest, ToStr) {
auto* i = create<SintLiteral>(-42); auto* i = create<SintLiteral>(-42);
EXPECT_EQ(str(i), "-42"); EXPECT_EQ(str(i), "-42");

View File

@ -28,12 +28,6 @@ TEST_F(StageDecorationTest, Creation_1param) {
EXPECT_EQ(d->value(), PipelineStage::kFragment); EXPECT_EQ(d->value(), PipelineStage::kFragment);
} }
TEST_F(StageDecorationTest, Is) {
Decoration* d = create<StageDecoration>(PipelineStage::kFragment);
EXPECT_FALSE(d->Is<WorkgroupDecoration>());
EXPECT_TRUE(d->Is<StageDecoration>());
}
TEST_F(StageDecorationTest, ToStr) { TEST_F(StageDecorationTest, ToStr) {
auto* d = create<StageDecoration>(PipelineStage::kFragment); auto* d = create<StageDecoration>(PipelineStage::kFragment);
EXPECT_EQ(str(d), R"(StageDecoration{fragment} EXPECT_EQ(str(d), R"(StageDecoration{fragment}

View File

@ -36,25 +36,6 @@ namespace {
using AstStorageTextureTest = TestHelper; using AstStorageTextureTest = TestHelper;
TEST_F(AstStorageTextureTest, Is) {
auto* subtype = StorageTexture::SubtypeFor(ImageFormat::kRgba32Float, *this);
Type* ty = create<StorageTexture>(TextureDimension::k2dArray,
ImageFormat::kRgba32Float, subtype);
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_TRUE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(AstStorageTextureTest, IsTexture) { TEST_F(AstStorageTextureTest, IsTexture) {
auto* subtype = StorageTexture::SubtypeFor(ImageFormat::kRgba32Float, *this); auto* subtype = StorageTexture::SubtypeFor(ImageFormat::kRgba32Float, *this);
Texture* ty = create<StorageTexture>(TextureDimension::k2dArray, Texture* ty = create<StorageTexture>(TextureDimension::k2dArray,

View File

@ -25,10 +25,6 @@ TEST_F(StrideDecorationTest, Creation) {
EXPECT_EQ(2u, d->stride()); EXPECT_EQ(2u, d->stride());
} }
TEST_F(StrideDecorationTest, Is) {
auto* d = create<StrideDecoration>(2);
EXPECT_TRUE(d->Is<StrideDecoration>());
}
TEST_F(StrideDecorationTest, Source) { TEST_F(StrideDecorationTest, Source) {
auto* d = create<StrideDecoration>( auto* d = create<StrideDecoration>(

View File

@ -27,11 +27,6 @@ TEST_F(StructMemberAlignDecorationTest, Creation) {
EXPECT_EQ(2u, d->align()); EXPECT_EQ(2u, d->align());
} }
TEST_F(StructMemberAlignDecorationTest, Is) {
auto* d = create<StructMemberAlignDecoration>(2);
EXPECT_TRUE(d->Is<StructMemberAlignDecoration>());
}
} // namespace } // namespace
} // namespace ast } // namespace ast
} // namespace tint } // namespace tint

View File

@ -25,11 +25,6 @@ TEST_F(StructMemberOffsetDecorationTest, Creation) {
EXPECT_EQ(2u, d->offset()); EXPECT_EQ(2u, d->offset());
} }
TEST_F(StructMemberOffsetDecorationTest, Is) {
auto* d = create<StructMemberOffsetDecoration>(2);
EXPECT_TRUE(d->Is<StructMemberOffsetDecoration>());
}
} // namespace } // namespace
} // namespace ast } // namespace ast
} // namespace tint } // namespace tint

View File

@ -27,11 +27,6 @@ TEST_F(StructMemberOffsetDecorationTest, Creation) {
EXPECT_EQ(2u, d->size()); EXPECT_EQ(2u, d->size());
} }
TEST_F(StructMemberOffsetDecorationTest, Is) {
auto* d = create<StructMemberSizeDecoration>(2);
EXPECT_TRUE(d->Is<StructMemberSizeDecoration>());
}
} // namespace } // namespace
} // namespace ast } // namespace ast
} // namespace tint } // namespace tint

View File

@ -137,24 +137,6 @@ TEST_F(AstStructTest, ToStr) {
)"); )");
} }
TEST_F(AstStructTest, Is) {
Type* ty = create<ast::Struct>(Sym("S"), ast::StructMemberList{},
ast::DecorationList{});
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_TRUE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(AstStructTest, TypeName) { TEST_F(AstStructTest, TypeName) {
auto name = Sym("my_struct"); auto name = Sym("my_struct");
auto* s = auto* s =

View File

@ -34,23 +34,6 @@ namespace {
using AstU32Test = TestHelper; using AstU32Test = TestHelper;
TEST_F(AstU32Test, Is) {
Type* ty = create<U32>();
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_TRUE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(AstU32Test, TypeName) { TEST_F(AstU32Test, TypeName) {
auto* u = create<U32>(); auto* u = create<U32>();
EXPECT_EQ(u->type_name(), "__u32"); EXPECT_EQ(u->type_name(), "__u32");

View File

@ -26,14 +26,6 @@ TEST_F(UintLiteralTest, Value) {
EXPECT_EQ(u->value(), 47u); EXPECT_EQ(u->value(), 47u);
} }
TEST_F(UintLiteralTest, Is) {
ast::Literal* l = create<UintLiteral>(42);
EXPECT_FALSE(l->Is<BoolLiteral>());
EXPECT_FALSE(l->Is<SintLiteral>());
EXPECT_FALSE(l->Is<FloatLiteral>());
EXPECT_TRUE(l->Is<UintLiteral>());
}
TEST_F(UintLiteralTest, ToStr) { TEST_F(UintLiteralTest, ToStr) {
auto* u = create<UintLiteral>(42u); auto* u = create<UintLiteral>(42u);
EXPECT_EQ(str(u), "42u"); EXPECT_EQ(str(u), "42u");

View File

@ -40,24 +40,6 @@ TEST_F(AstVectorTest, Creation) {
EXPECT_EQ(v->size(), 2u); EXPECT_EQ(v->size(), 2u);
} }
TEST_F(AstVectorTest, Is) {
auto* i32 = create<I32>();
Type* ty = create<Vector>(i32, 4);
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_TRUE(ty->Is<Vector>());
}
TEST_F(AstVectorTest, TypeName) { TEST_F(AstVectorTest, TypeName) {
auto* i32 = create<I32>(); auto* i32 = create<I32>();
auto* v = create<Vector>(i32, 3); auto* v = create<Vector>(i32, 3);

View File

@ -55,12 +55,6 @@ TEST_F(WorkgroupDecorationTest, Creation_3param) {
EXPECT_EQ(z, 6u); EXPECT_EQ(z, 6u);
} }
TEST_F(WorkgroupDecorationTest, Is) {
Decoration* d = create<WorkgroupDecoration>(2, 4, 6);
EXPECT_TRUE(d->Is<WorkgroupDecoration>());
EXPECT_FALSE(d->Is<StageDecoration>());
}
TEST_F(WorkgroupDecorationTest, ToStr) { TEST_F(WorkgroupDecorationTest, ToStr) {
auto* d = create<WorkgroupDecoration>(2, 4, 6); auto* d = create<WorkgroupDecoration>(2, 4, 6);
EXPECT_EQ(str(d), R"(WorkgroupDecoration{2 4 6} EXPECT_EQ(str(d), R"(WorkgroupDecoration{2 4 6}

View File

@ -30,25 +30,6 @@ TEST_F(AccessControlTest, Create) {
EXPECT_EQ(a.type(), &u32); EXPECT_EQ(a.type(), &u32);
} }
TEST_F(AccessControlTest, Is) {
I32 i32;
AccessControl at{ast::AccessControl::kReadOnly, &i32};
Type* ty = &at;
EXPECT_TRUE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(AccessControlTest, AccessRead) { TEST_F(AccessControlTest, AccessRead) {
I32 i32; I32 i32;
AccessControl at{ast::AccessControl::kReadOnly, &i32}; AccessControl at{ast::AccessControl::kReadOnly, &i32};

View File

@ -22,23 +22,6 @@ namespace {
using BoolTest = TestHelper; using BoolTest = TestHelper;
TEST_F(BoolTest, Is) {
Bool b;
Type* ty = &b;
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_TRUE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(BoolTest, TypeName) { TEST_F(BoolTest, TypeName) {
Bool b; Bool b;
EXPECT_EQ(b.type_name(), "__bool"); EXPECT_EQ(b.type_name(), "__bool");

View File

@ -27,23 +27,6 @@ namespace {
using DepthTextureTest = TestHelper; using DepthTextureTest = TestHelper;
TEST_F(DepthTextureTest, Is) {
DepthTexture d(ast::TextureDimension::kCube);
Type* ty = &d;
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_TRUE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(DepthTextureTest, IsTexture) { TEST_F(DepthTextureTest, IsTexture) {
DepthTexture d(ast::TextureDimension::kCube); DepthTexture d(ast::TextureDimension::kCube);
Texture* ty = &d; Texture* ty = &d;

View File

@ -27,24 +27,6 @@ namespace {
using ExternalTextureTest = TestHelper; using ExternalTextureTest = TestHelper;
TEST_F(ExternalTextureTest, Is) {
F32 f32;
ExternalTexture s;
Type* ty = &s;
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_TRUE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(ExternalTextureTest, IsTexture) { TEST_F(ExternalTextureTest, IsTexture) {
F32 f32; F32 f32;
ExternalTexture s; ExternalTexture s;

View File

@ -22,23 +22,6 @@ namespace {
using F32Test = TestHelper; using F32Test = TestHelper;
TEST_F(F32Test, Is) {
F32 f;
Type* ty = &f;
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_TRUE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(F32Test, TypeName) { TEST_F(F32Test, TypeName) {
F32 f; F32 f;
EXPECT_EQ(f.type_name(), "__f32"); EXPECT_EQ(f.type_name(), "__f32");

View File

@ -22,23 +22,6 @@ namespace {
using I32Test = TestHelper; using I32Test = TestHelper;
TEST_F(I32Test, Is) {
I32 i;
Type* ty = &i;
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_TRUE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(I32Test, TypeName) { TEST_F(I32Test, TypeName) {
I32 i; I32 i;
EXPECT_EQ(i.type_name(), "__i32"); EXPECT_EQ(i.type_name(), "__i32");

View File

@ -31,25 +31,6 @@ TEST_F(MatrixTest, Creation) {
EXPECT_EQ(m.columns(), 4u); EXPECT_EQ(m.columns(), 4u);
} }
TEST_F(MatrixTest, Is) {
I32 i32;
Vector c{&i32, 2};
Matrix m{&c, 4};
Type* ty = &m;
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_TRUE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(MatrixTest, TypeName) { TEST_F(MatrixTest, TypeName) {
I32 i32; I32 i32;
Vector c{&i32, 2}; Vector c{&i32, 2};

View File

@ -27,24 +27,6 @@ namespace {
using MultisampledTextureTest = TestHelper; using MultisampledTextureTest = TestHelper;
TEST_F(MultisampledTextureTest, Is) {
F32 f32;
MultisampledTexture s(ast::TextureDimension::kCube, &f32);
Type* ty = &s;
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_TRUE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(MultisampledTextureTest, IsTexture) { TEST_F(MultisampledTextureTest, IsTexture) {
F32 f32; F32 f32;
MultisampledTexture s(ast::TextureDimension::kCube, &f32); MultisampledTexture s(ast::TextureDimension::kCube, &f32);

View File

@ -29,23 +29,6 @@ TEST_F(PointerTest, Creation) {
EXPECT_EQ(p.storage_class(), ast::StorageClass::kStorage); EXPECT_EQ(p.storage_class(), ast::StorageClass::kStorage);
} }
TEST_F(PointerTest, Is) {
I32 i32;
Pointer p{&i32, ast::StorageClass::kFunction};
Type* ty = &p;
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_TRUE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(PointerTest, TypeName) { TEST_F(PointerTest, TypeName) {
I32 i32; I32 i32;

View File

@ -26,23 +26,6 @@ namespace {
using SampledTextureTest = TestHelper; using SampledTextureTest = TestHelper;
TEST_F(SampledTextureTest, Is) {
F32 f32;
SampledTexture s(ast::TextureDimension::kCube, &f32);
Type* ty = &s;
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_TRUE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(SampledTextureTest, IsTexture) { TEST_F(SampledTextureTest, IsTexture) {
F32 f32; F32 f32;

View File

@ -33,23 +33,6 @@ TEST_F(SamplerTest, Creation_ComparisonSampler) {
EXPECT_TRUE(s.IsComparison()); EXPECT_TRUE(s.IsComparison());
} }
TEST_F(SamplerTest, Is) {
Sampler s{ast::SamplerKind::kSampler};
Type* ty = &s;
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_TRUE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(SamplerTest, TypeName_Sampler) { TEST_F(SamplerTest, TypeName_Sampler) {
Sampler s{ast::SamplerKind::kSampler}; Sampler s{ast::SamplerKind::kSampler};
EXPECT_EQ(s.type_name(), "__sampler_sampler"); EXPECT_EQ(s.type_name(), "__sampler_sampler");

View File

@ -46,24 +46,6 @@ TEST_F(ArrayTest, CreateRuntimeArray) {
EXPECT_TRUE(arr->IsRuntimeSized()); EXPECT_TRUE(arr->IsRuntimeSized());
} }
TEST_F(ArrayTest, Is) {
I32 i32;
Type* ty = create<Array>(&i32, 2, 4, 8, 4, true);
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_TRUE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(ArrayTest, TypeName) { TEST_F(ArrayTest, TypeName) {
I32 i32; I32 i32;
auto* arr = create<Array>(&i32, 2, 0, 4, 4, true); auto* arr = create<Array>(&i32, 2, 0, 4, 4, true);

View File

@ -36,27 +36,6 @@ TEST_F(StructTest, Creation) {
EXPECT_EQ(s->SizeNoPadding(), 16u); EXPECT_EQ(s->SizeNoPadding(), 16u);
} }
TEST_F(StructTest, Is) {
auto name = Sym("S");
auto* impl =
create<ast::Struct>(name, ast::StructMemberList{}, ast::DecorationList{});
auto* s = create<sem::Struct>(impl, StructMemberList{}, 4 /* align */,
4 /* size */, 4 /* size_no_padding */);
sem::Type* ty = s;
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_TRUE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(StructTest, TypeName) { TEST_F(StructTest, TypeName) {
auto name = Sym("my_struct"); auto name = Sym("my_struct");
auto* impl = auto* impl =

View File

@ -26,38 +26,6 @@ namespace {
using StorageTextureTest = TestHelper; using StorageTextureTest = TestHelper;
TEST_F(StorageTextureTest, Is) {
auto* subtype =
StorageTexture::SubtypeFor(ast::ImageFormat::kRgba32Float, Types());
auto* s = create<StorageTexture>(ast::TextureDimension::k2dArray,
ast::ImageFormat::kRgba32Float, subtype);
Type* ty = s;
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_TRUE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(StorageTextureTest, IsTexture) {
auto* subtype =
StorageTexture::SubtypeFor(ast::ImageFormat::kRgba32Float, Types());
auto* s = create<StorageTexture>(ast::TextureDimension::k2dArray,
ast::ImageFormat::kRgba32Float, subtype);
Texture* ty = s;
EXPECT_FALSE(ty->Is<DepthTexture>());
EXPECT_FALSE(ty->Is<ExternalTexture>());
EXPECT_FALSE(ty->Is<SampledTexture>());
EXPECT_TRUE(ty->Is<StorageTexture>());
}
TEST_F(StorageTextureTest, Dim) { TEST_F(StorageTextureTest, Dim) {
auto* subtype = auto* subtype =
StorageTexture::SubtypeFor(ast::ImageFormat::kRgba32Float, Types()); StorageTexture::SubtypeFor(ast::ImageFormat::kRgba32Float, Types());

View File

@ -22,23 +22,6 @@ namespace {
using U32Test = TestHelper; using U32Test = TestHelper;
TEST_F(U32Test, Is) {
U32 u;
Type* ty = &u;
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_TRUE(ty->Is<U32>());
EXPECT_FALSE(ty->Is<Vector>());
}
TEST_F(U32Test, TypeName) { TEST_F(U32Test, TypeName) {
U32 u; U32 u;
EXPECT_EQ(u.type_name(), "__u32"); EXPECT_EQ(u.type_name(), "__u32");

View File

@ -29,24 +29,6 @@ TEST_F(VectorTest, Creation) {
EXPECT_EQ(v.size(), 2u); EXPECT_EQ(v.size(), 2u);
} }
TEST_F(VectorTest, Is) {
I32 i32;
Vector v{&i32, 4};
Type* ty = &v;
EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Array>());
EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>());
EXPECT_FALSE(ty->Is<Matrix>());
EXPECT_FALSE(ty->Is<Pointer>());
EXPECT_FALSE(ty->Is<Sampler>());
EXPECT_FALSE(ty->Is<Struct>());
EXPECT_FALSE(ty->Is<Texture>());
EXPECT_FALSE(ty->Is<U32>());
EXPECT_TRUE(ty->Is<Vector>());
}
TEST_F(VectorTest, TypeName) { TEST_F(VectorTest, TypeName) {
auto* i32 = create<I32>(); auto* i32 = create<I32>();
auto* v = create<Vector>(i32, 3); auto* v = create<Vector>(i32, 3);