MCPcopy Create free account
hub / github.com/astonbitecode/j4rs / test_double_array_to_rust

Function test_double_array_to_rust

rust/src/api/mod.rs:2383–2400  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2381
2382 #[test]
2383 fn test_double_array_to_rust() -> errors::Result<()> {
2384 let jvm = create_tests_jvm()?;
2385 let rust_value: Vec<f64> = vec![3_f64, 7.5_f64, -1000.5_f64];
2386 let ia: Vec<_> = rust_value
2387 .iter()
2388 .map(|x| {
2389 InvocationArg::try_from(x)
2390 .unwrap()
2391 .into_primitive()
2392 .unwrap()
2393 })
2394 .collect();
2395 let java_instance = jvm.create_java_array(PRIMITIVE_DOUBLE, &ia)?;
2396 let rust_value_from_java: Vec<f64> = jvm.to_rust(java_instance)?;
2397 assert_eq!(rust_value_from_java, rust_value);
2398
2399 Ok(())
2400 }
2401
2402 #[test]
2403 fn test_boolean_array_to_rust() -> errors::Result<()> {

Callers

nothing calls this directly

Calls 6

create_tests_jvmFunction · 0.85
collectMethod · 0.80
mapMethod · 0.80
into_primitiveMethod · 0.80
create_java_arrayMethod · 0.80
to_rustMethod · 0.45

Tested by

no test coverage detected