You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
swarms/tests/engines/test_cuda_wrapper.rs

26 lines
793 B

#[cfg(test)]
mod tests {
use super::*;
use pyo3::types::IntoPyDict;
#[test]
fn test_execute_on_device() {
let gil = Python::acquire_gil();
let py = gil.python();
// Define a Python module for testing
let rust_cuda = PyModule::new(py, "rust_cuda").unwrap();
rust_cuda.add_function(wrap_pyfunction!(execute_on_device, rust_cuda).unwrap()).unwrap();
// Test the execute_on_device function
let result: PyResult<f32> = rust_cuda.call1("execute_on_device", (0, 1.0f32, 2.0f32)).unwrap().extract().unwrap();
assert!(result.is_ok());
}
#[test]
fn test_execute_cuda() {
// Test the execute_cuda function
let result = execute_cuda(0, 1.0f32, 2.0f32);
assert!(result.is_ok());
}
}