From a7f155f6bcbec330cd19946086dc6ddda2b96adb Mon Sep 17 00:00:00 2001 From: mocabe Date: Thu, 28 May 2020 03:03:20 +0900 Subject: [PATCH] [test] Update test for ResultValue --- tests/ResultValueRValue/ResultValueRValue.cpp | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/tests/ResultValueRValue/ResultValueRValue.cpp b/tests/ResultValueRValue/ResultValueRValue.cpp index 9d7ecb6..73388a1 100644 --- a/tests/ResultValueRValue/ResultValueRValue.cpp +++ b/tests/ResultValueRValue/ResultValueRValue.cpp @@ -24,21 +24,29 @@ VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE static_assert(false, "Conversions not enabled"); #endif -template void as_value(T) {} -template void as_cref(const T&) {} -template void as_rvref(T&&) {} +void as_value(int) {} +void as_ref(int&) {} +void as_cref(const int&) {} +void as_rvref(int&&) {} +void as_crvref(const int&&) {} void test() { - auto device = vk::Device{}; + using result = vk::ResultValue; - // just example: non-result values (vk::Image) - as_value(device.createImage({})); - as_cref(device.createImage({})); - as_rvref(device.createImage({})); + auto val = result {vk::Result{}, 42}; + const auto cval = result {vk::Result{}, 42}; - // vk::ResultValue should also work - as_value(device.createGraphicsPipeline(nullptr, {})); - as_cref(device.createGraphicsPipeline(nullptr, {})); - as_rvref(device.createGraphicsPipeline(nullptr,{})); + as_value(val); + as_value(cval); + + as_ref(val); + //as_ref(cval); // should fail + as_cref(val); + as_cref(cval); + + as_rvref(std::move(val)); + //as_rvref(std::move(cval)); // should fail + as_crvref(std::move(val)); + as_crvref(std::move(cval)); }