From ede9ed68e096c94bb0ceaee6fbbaa55805e8c03a Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Wed, 13 Mar 2019 18:05:00 -0400 Subject: [PATCH] Add test for constant sized arrays --- ash/tests/constant_size_arrays.rs | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 ash/tests/constant_size_arrays.rs diff --git a/ash/tests/constant_size_arrays.rs b/ash/tests/constant_size_arrays.rs new file mode 100644 index 0000000..f736c0a --- /dev/null +++ b/ash/tests/constant_size_arrays.rs @@ -0,0 +1,41 @@ +extern crate ash; + +use ash::vk::{PhysicalDeviceProperties, PipelineColorBlendStateCreateInfo}; + +#[test] +fn assert_struct_field_is_array() { + let pipeline_cache_uuid: [u8; 16] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + + let _ = PhysicalDeviceProperties::builder().pipeline_cache_uuid(pipeline_cache_uuid); + + let _ = PhysicalDeviceProperties { + pipeline_cache_uuid, + ..Default::default() + }; + + let blend_constants: [f32; 4] = [0.0, 0.0, 0.0, 0.0]; + + let _ = PipelineColorBlendStateCreateInfo::builder().blend_constants(blend_constants); + + let _ = PipelineColorBlendStateCreateInfo { + blend_constants, + ..Default::default() + }; +} + +#[test] +#[allow(dead_code)] +fn assert_ffi_array_param_is_pointer() { + use ash::version::DeviceV1_0; + unsafe { + // don't run it, just make sure it compiles + if false { + let device: ash::Device = std::mem::uninitialized(); + let cmd_buffer = std::mem::uninitialized(); + + let blend_constants: [f32; 4] = [0.0, 0.0, 0.0, 0.0]; + + device.cmd_set_blend_constants(cmd_buffer, &blend_constants); + } + } +}