Add explicit to test files.

This CL updates the test files to have explicit added for single
parameter constructors and removed from zero parameter constructors.

Bug: dawn:1339
Change-Id: I21339148bba5e7e89debc38ec426ba15e0d734e2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87021
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
dan sinclair 2022-04-19 08:28:34 +00:00 committed by Dawn LUCI CQ
parent 92bef59295
commit cccadddcb0
25 changed files with 31 additions and 30 deletions

View File

@ -273,7 +273,7 @@ class DawnTestBase {
friend class DawnPerfTestBase;
public:
DawnTestBase(const AdapterTestParam& param);
explicit DawnTestBase(const AdapterTestParam& param);
virtual ~DawnTestBase();
void SetUp();
@ -327,7 +327,7 @@ class DawnTestBase {
virtual std::unique_ptr<dawn::platform::Platform> CreateTestPlatform();
struct PrintToStringParamName {
PrintToStringParamName(const char* test);
explicit PrintToStringParamName(const char* test);
std::string SanitizeParamName(std::string paramName, size_t index) const;
template <class ParamType>
@ -750,7 +750,7 @@ namespace detail {
template <typename T, typename U>
class ExpectEq : public Expectation {
public:
ExpectEq(T singleValue, T tolerance = {});
explicit ExpectEq(T singleValue, T tolerance = {});
ExpectEq(const T* values, const unsigned int count, T tolerance = {});
testing::AssertionResult Check(const void* data, size_t size) override;

View File

@ -46,7 +46,7 @@ class ParamGenerator {
public:
using value_type = ParamStruct;
ParamGenerator(std::vector<Params>... params) : mParams(params...), mIsEmpty(false) {
explicit ParamGenerator(std::vector<Params>... params) : mParams(params...), mIsEmpty(false) {
for (bool isEmpty : {params.empty()...}) {
mIsEmpty |= isEmpty;
}

View File

@ -74,7 +74,7 @@ class FakePersistentCache : public dawn::platform::CachingInterface {
// Test platform that only supports caching.
class DawnTestPlatform : public dawn::platform::Platform {
public:
DawnTestPlatform(dawn::platform::CachingInterface* cachingInterface)
explicit DawnTestPlatform(dawn::platform::CachingInterface* cachingInterface)
: mCachingInterface(cachingInterface) {
}
~DawnTestPlatform() override = default;

View File

@ -423,7 +423,7 @@ class DepthStencilSamplingTest : public DawnTestWithParams<DepthStencilSamplingT
using StencilData = std::array<uint32_t, 4>;
public:
ExtraStencilComponentsExpectation(uint32_t expected) : mExpected(expected) {
explicit ExtraStencilComponentsExpectation(uint32_t expected) : mExpected(expected) {
}
~ExtraStencilComponentsExpectation() override = default;

View File

@ -40,7 +40,7 @@ class OcclusionExpectation : public detail::Expectation {
~OcclusionExpectation() override = default;
OcclusionExpectation(Result expected) {
explicit OcclusionExpectation(Result expected) {
mExpected = expected;
}

View File

@ -76,7 +76,7 @@ class ExpectFloatWithTolerance : public detail::Expectation {
// An expectation for float16 buffers that can correctly compare NaNs (all NaNs are equivalent).
class ExpectFloat16 : public detail::Expectation {
public:
ExpectFloat16(std::vector<uint16_t> expected) : mExpected(std::move(expected)) {
explicit ExpectFloat16(std::vector<uint16_t> expected) : mExpected(std::move(expected)) {
}
testing::AssertionResult Check(const void* data, size_t size) override {

View File

@ -22,10 +22,10 @@ class RCTest : public RefCounted {
RCTest() : RefCounted() {
}
RCTest(uint64_t payload) : RefCounted(payload) {
explicit RCTest(uint64_t payload) : RefCounted(payload) {
}
RCTest(bool* deleted) : mDeleted(deleted) {
explicit RCTest(bool* deleted) : mDeleted(deleted) {
}
~RCTest() override {

View File

@ -20,7 +20,7 @@
namespace {
struct Foo : public PlacementAllocated {
Foo(int value) : value(value) {
explicit Foo(int value) : value(value) {
}
int value;

View File

@ -90,7 +90,7 @@ struct FakeStorage {
// a single range (and that each subresource was seen only once).
struct RangeTracker {
template <typename T>
RangeTracker(const SubresourceStorage<T>& s)
explicit RangeTracker(const SubresourceStorage<T>& s)
: mTracked(s.GetAspectsForTesting(),
s.GetArrayLayerCountForTesting(),
s.GetMipLevelCountForTesting(),

View File

@ -24,7 +24,7 @@ namespace dawn::native {
class BindGroupLayoutMock final : public BindGroupLayoutBase {
public:
BindGroupLayoutMock(DeviceBase* device) : BindGroupLayoutBase(device) {
explicit BindGroupLayoutMock(DeviceBase* device) : BindGroupLayoutBase(device) {
ON_CALL(*this, DestroyImpl).WillByDefault([this]() {
this->BindGroupLayoutBase::DestroyImpl();
});

View File

@ -24,7 +24,7 @@ namespace dawn::native {
class BindGroupMock : public BindGroupBase {
public:
BindGroupMock(DeviceBase* device) : BindGroupBase(device) {
explicit BindGroupMock(DeviceBase* device) : BindGroupBase(device) {
ON_CALL(*this, DestroyImpl).WillByDefault([this]() {
this->BindGroupBase::DestroyImpl();
});

View File

@ -24,7 +24,7 @@ namespace dawn::native {
class CommandBufferMock : public CommandBufferBase {
public:
CommandBufferMock(DeviceBase* device) : CommandBufferBase(device) {
explicit CommandBufferMock(DeviceBase* device) : CommandBufferBase(device) {
ON_CALL(*this, DestroyImpl).WillByDefault([this]() {
this->CommandBufferBase::DestroyImpl();
});

View File

@ -24,7 +24,7 @@ namespace dawn::native {
class ComputePipelineMock : public ComputePipelineBase {
public:
ComputePipelineMock(DeviceBase* device) : ComputePipelineBase(device) {
explicit ComputePipelineMock(DeviceBase* device) : ComputePipelineBase(device) {
ON_CALL(*this, DestroyImpl).WillByDefault([this]() {
this->ComputePipelineBase::DestroyImpl();
});

View File

@ -24,7 +24,7 @@ namespace dawn::native {
class ExternalTextureMock : public ExternalTextureBase {
public:
ExternalTextureMock(DeviceBase* device) : ExternalTextureBase(device) {
explicit ExternalTextureMock(DeviceBase* device) : ExternalTextureBase(device) {
ON_CALL(*this, DestroyImpl).WillByDefault([this]() {
this->ExternalTextureBase::DestroyImpl();
});

View File

@ -24,7 +24,7 @@ namespace dawn::native {
class PipelineLayoutMock : public PipelineLayoutBase {
public:
PipelineLayoutMock(DeviceBase* device) : PipelineLayoutBase(device) {
explicit PipelineLayoutMock(DeviceBase* device) : PipelineLayoutBase(device) {
ON_CALL(*this, DestroyImpl).WillByDefault([this]() {
this->PipelineLayoutBase::DestroyImpl();
});

View File

@ -24,7 +24,7 @@ namespace dawn::native {
class QuerySetMock : public QuerySetBase {
public:
QuerySetMock(DeviceBase* device) : QuerySetBase(device) {
explicit QuerySetMock(DeviceBase* device) : QuerySetBase(device) {
ON_CALL(*this, DestroyImpl).WillByDefault([this]() {
this->QuerySetBase::DestroyImpl();
});

View File

@ -24,7 +24,7 @@ namespace dawn::native {
class RenderPipelineMock : public RenderPipelineBase {
public:
RenderPipelineMock(DeviceBase* device) : RenderPipelineBase(device) {
explicit RenderPipelineMock(DeviceBase* device) : RenderPipelineBase(device) {
ON_CALL(*this, DestroyImpl).WillByDefault([this]() {
this->RenderPipelineBase::DestroyImpl();
});

View File

@ -24,7 +24,7 @@ namespace dawn::native {
class SamplerMock : public SamplerBase {
public:
SamplerMock(DeviceBase* device) : SamplerBase(device) {
explicit SamplerMock(DeviceBase* device) : SamplerBase(device) {
ON_CALL(*this, DestroyImpl).WillByDefault([this]() {
this->SamplerBase::DestroyImpl();
});

View File

@ -27,7 +27,7 @@ namespace dawn::native {
class ShaderModuleMock : public ShaderModuleBase {
public:
ShaderModuleMock(DeviceBase* device);
explicit ShaderModuleMock(DeviceBase* device);
~ShaderModuleMock() override = default;
MOCK_METHOD(void, DestroyImpl, (), (override));

View File

@ -24,7 +24,7 @@ namespace dawn::native {
class SwapChainMock : public SwapChainBase {
public:
SwapChainMock(DeviceBase* device) : SwapChainBase(device) {
explicit SwapChainMock(DeviceBase* device) : SwapChainBase(device) {
ON_CALL(*this, DestroyImpl).WillByDefault([this]() {
this->SwapChainBase::DestroyImpl();
});

View File

@ -37,7 +37,7 @@ namespace dawn::native {
class TextureViewMock : public TextureViewBase {
public:
TextureViewMock(TextureBase* texture) : TextureViewBase(texture) {
explicit TextureViewMock(TextureBase* texture) : TextureViewBase(texture) {
}
~TextureViewMock() override = default;

View File

@ -117,7 +117,7 @@ class ValidationTest : public testing::Test {
struct DummyRenderPass : public wgpu::RenderPassDescriptor {
public:
DummyRenderPass(const wgpu::Device& device);
explicit DummyRenderPass(const wgpu::Device& device);
wgpu::Texture attachment;
wgpu::TextureFormat attachmentFormat;
uint32_t width;

View File

@ -71,7 +71,7 @@ inline testing::Matcher<MatcherLambdaArgument<Lambda>> MatchesLambda(Lambda lamb
class StringMessageMatcher : public testing::MatcherInterface<const char*> {
public:
explicit StringMessageMatcher() {
StringMessageMatcher() {
}
bool MatchAndExplain(const char* message,

View File

@ -30,7 +30,7 @@ namespace dawn::native::vulkan {
class ExternalSemaphoreDmaBuf : public VulkanImageWrappingTestBackend::ExternalSemaphore {
public:
ExternalSemaphoreDmaBuf(int handle) : mHandle(handle) {
explicit ExternalSemaphoreDmaBuf(int handle) : mHandle(handle) {
}
~ExternalSemaphoreDmaBuf() override {
if (mHandle != -1) {
@ -77,7 +77,7 @@ namespace dawn::native::vulkan {
class VulkanImageWrappingTestBackendDmaBuf : public VulkanImageWrappingTestBackend {
public:
VulkanImageWrappingTestBackendDmaBuf(const wgpu::Device& device) {
explicit VulkanImageWrappingTestBackendDmaBuf(const wgpu::Device& device) {
}
~VulkanImageWrappingTestBackendDmaBuf() {

View File

@ -32,7 +32,7 @@ namespace dawn::native::vulkan {
class ExternalSemaphoreOpaqueFD : public VulkanImageWrappingTestBackend::ExternalSemaphore {
public:
ExternalSemaphoreOpaqueFD(int handle) : mHandle(handle) {
explicit ExternalSemaphoreOpaqueFD(int handle) : mHandle(handle) {
}
~ExternalSemaphoreOpaqueFD() override {
if (mHandle != -1) {
@ -94,7 +94,8 @@ namespace dawn::native::vulkan {
class VulkanImageWrappingTestBackendOpaqueFD : public VulkanImageWrappingTestBackend {
public:
VulkanImageWrappingTestBackendOpaqueFD(const wgpu::Device& device) : mDevice(device) {
explicit VulkanImageWrappingTestBackendOpaqueFD(const wgpu::Device& device)
: mDevice(device) {
mDeviceVk = dawn::native::vulkan::ToBackend(dawn::native::FromAPI(device.Get()));
}