-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_clone.rs
More file actions
51 lines (45 loc) · 1.81 KB
/
test_clone.rs
File metadata and controls
51 lines (45 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! Test for image cloning functionality
use std::ffi::c_void;
// Import the clone functions
extern "C" {
fn vxCloneImage(context: *mut c_void, source: *mut c_void) -> *mut c_void;
fn vxCloneImageWithGraph(context: *mut c_void, graph: *mut c_void, source: *mut c_void) -> *mut c_void;
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_clone_image_null_params() {
// Test with null context - should return null
let result = unsafe { vxCloneImage(std::ptr::null_mut(), std::ptr::null_mut()) };
assert!(result.is_null());
}
#[test]
fn test_clone_image_with_graph_null_params() {
// Test with null context and graph - should return null
let result = unsafe {
vxCloneImageWithGraph(std::ptr::null_mut(), std::ptr::null_mut(), std::ptr::null_mut())
};
assert!(result.is_null());
}
}
fn main() {
println!("Image clone strategy implemented successfully!");
println!("");
println!("Functions implemented:");
println!(" - vxCloneImage(context, source) -> vx_image");
println!(" - vxCloneImageWithGraph(context, graph, source) -> vx_image");
println!(" - clone_image(source) -> Image (Rust API)");
println!("");
println!("The clone strategy:");
println!(" 1. Validates context and source image parameters");
println!(" 2. Queries source image dimensions and format");
println!(" 3. Creates a new image with same properties");
println!(" 4. Performs deep copy of pixel data");
println!(" 5. Copies mapped patches metadata");
println!(" 6. Returns the cloned image");
println!("");
println!("For virtual images:");
println!(" - Creates regular image (virtual -> concrete)");
println!(" - vxCloneImageWithGraph uses graph context for virtual images");
}