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

Function test_short_array_to_rust

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

Source from the content-addressed store, hash-verified

2281
2282 #[test]
2283 fn test_short_array_to_rust() -> errors::Result<()> {
2284 let jvm = create_tests_jvm()?;
2285 let rust_value: Vec<i16> = vec![-3_i16, 7_i16, 10000_i16];
2286 let ia: Vec<_> = rust_value
2287 .iter()
2288 .map(|x| {
2289 InvocationArg::try_from(x)
2290 .unwrap()
2291 .into_primitive()
2292 .unwrap()
2293 })
2294 .collect();
2295 let java_instance = jvm.create_java_array(PRIMITIVE_SHORT, &ia)?;
2296 let rust_value_from_java: Vec<i16> = jvm.to_rust(java_instance)?;
2297 assert_eq!(rust_value_from_java, rust_value);
2298
2299 Ok(())
2300 }
2301
2302 #[test]
2303 fn test_char_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