[test] Rename target ResultValueRValue to ResultValue

This commit is contained in:
mocabe
2020-05-28 03:10:53 +09:00
committed by Markus Tavenrath
parent a7f155f6bc
commit 52dc8eb2fe
2 changed files with 15 additions and 13 deletions

View File

@@ -0,0 +1,38 @@
# Copyright(c) 2020, Collabora Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.2)
project(ResultValue)
set(HEADERS
)
set(SOURCES
ResultValue.cpp
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
add_library(ResultValue
${HEADERS}
${SOURCES}
)
if (UNIX)
target_link_libraries(ResultValue "-ldl")
endif()
set_target_properties(ResultValue PROPERTIES FOLDER "Tests")

View File

@@ -0,0 +1,54 @@
// Copyright(c) 2020, Collabora Ltd. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// VulkanHpp Tests : ResultValue
// Compile-test for ResultValue
#define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1
#include "vulkan/vulkan.hpp"
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
// Compile only test for issue 589.
void test_conversion()
{
#if defined(VULKAN_DISABLE_IMPLICIT_RESULT_VALUE_CAST)
static_assert(false, "Conversions not enabled");
#endif
void as_value(int);
void as_ref(int&);
void as_cref(const int&);
void as_rvref(int&&);
void as_crvref(const int&&);
using result = vk::ResultValue<int>;
auto val = result {vk::Result{}, 42};
const auto cval = result {vk::Result{}, 42};
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));
}