()
| 917 | } |
| 918 | |
| 919 | fn test_generic_binary<Offset: OffsetSizeTrait>() -> Result<()> { |
| 920 | // create an array natively |
| 921 | let array: Vec<Option<&[u8]>> = vec![Some(b"a"), None, Some(b"aaa")]; |
| 922 | let array = GenericBinaryArray::<Offset>::from(array); |
| 923 | |
| 924 | // export it |
| 925 | let (array, schema) = to_ffi(&array.to_data())?; |
| 926 | |
| 927 | // (simulate consumer) import it |
| 928 | let data = unsafe { from_ffi(array, &schema) }?; |
| 929 | let array = make_array(data); |
| 930 | let array = array |
| 931 | .as_any() |
| 932 | .downcast_ref::<GenericBinaryArray<Offset>>() |
| 933 | .unwrap(); |
| 934 | |
| 935 | // verify |
| 936 | let expected: Vec<Option<&[u8]>> = vec![Some(b"a"), None, Some(b"aaa")]; |
| 937 | let expected = GenericBinaryArray::<Offset>::from(expected); |
| 938 | assert_eq!(array, &expected); |
| 939 | |
| 940 | // (drop/release) |
| 941 | Ok(()) |
| 942 | } |
| 943 | |
| 944 | #[test] |
| 945 | fn test_binary() -> Result<()> { |
nothing calls this directly
no test coverage detected