[test] Update test for ResultValue

This commit is contained in:
mocabe 2020-05-28 03:03:20 +09:00 committed by Markus Tavenrath
parent 36869db461
commit a7f155f6bc

View File

@ -24,21 +24,29 @@ VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
static_assert(false, "Conversions not enabled"); static_assert(false, "Conversions not enabled");
#endif #endif
template <class T> void as_value(T) {} void as_value(int) {}
template <class T> void as_cref(const T&) {} void as_ref(int&) {}
template <class T> void as_rvref(T&&) {} void as_cref(const int&) {}
void as_rvref(int&&) {}
void as_crvref(const int&&) {}
void test() void test()
{ {
auto device = vk::Device{}; using result = vk::ResultValue<int>;
// just example: non-result values (vk::Image) auto val = result {vk::Result{}, 42};
as_value<vk::Image>(device.createImage({})); const auto cval = result {vk::Result{}, 42};
as_cref<vk::Image>(device.createImage({}));
as_rvref<vk::Image>(device.createImage({}));
// vk::ResultValue<vk::Pipeline> should also work as_value(val);
as_value<vk::Pipeline>(device.createGraphicsPipeline(nullptr, {})); as_value(cval);
as_cref<vk::Pipeline>(device.createGraphicsPipeline(nullptr, {}));
as_rvref<vk::Pipeline>(device.createGraphicsPipeline(nullptr,{})); 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));
} }