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

Function test_long_array_to_rust

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

Source from the content-addressed store, hash-verified

2341
2342 #[test]
2343 fn test_long_array_to_rust() -> errors::Result<()> {
2344 let jvm = create_tests_jvm()?;
2345 let rust_value: Vec<i64> = vec![-100_000, -1_000_000, 1_000_000];
2346 let ia: Vec<_> = rust_value
2347 .iter()
2348 .map(|x| {
2349 InvocationArg::try_from(x)
2350 .unwrap()
2351 .into_primitive()
2352 .unwrap()
2353 })
2354 .collect();
2355 let java_instance = jvm.create_java_array(PRIMITIVE_LONG, &ia)?;
2356 let rust_value_from_java: Vec<i64> = jvm.to_rust(java_instance)?;
2357 assert_eq!(rust_value_from_java, rust_value);
2358
2359 Ok(())
2360 }
2361
2362 #[test]
2363 fn test_float_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