|
|
@ -5,8 +5,8 @@ |
|
|
|
// license that can be found in the LICENSE file or at
|
|
|
|
// license that can be found in the LICENSE file or at
|
|
|
|
// https://developers.google.com/open-source/licenses/bsd
|
|
|
|
// https://developers.google.com/open-source/licenses/bsd
|
|
|
|
|
|
|
|
|
|
|
|
use crate::opaque_pointee::opaque_pointee; |
|
|
|
use super::opaque_pointee::opaque_pointee; |
|
|
|
use crate::{upb_MessageValue, CType, RawArena}; |
|
|
|
use super::{upb_MessageValue, CType, RawArena}; |
|
|
|
use std::ptr::NonNull; |
|
|
|
use std::ptr::NonNull; |
|
|
|
|
|
|
|
|
|
|
|
opaque_pointee!(upb_Map); |
|
|
|
opaque_pointee!(upb_Map); |
|
|
@ -49,13 +49,14 @@ extern "C" { |
|
|
|
|
|
|
|
|
|
|
|
#[cfg(test)] |
|
|
|
#[cfg(test)] |
|
|
|
mod tests { |
|
|
|
mod tests { |
|
|
|
|
|
|
|
use super::super::Arena; |
|
|
|
use super::*; |
|
|
|
use super::*; |
|
|
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
#[test] |
|
|
|
fn map_ffi_test() { |
|
|
|
fn map_ffi_test() { |
|
|
|
// SAFETY: FFI unit test uses C API under expected patterns.
|
|
|
|
// SAFETY: FFI unit test uses C API under expected patterns.
|
|
|
|
unsafe { |
|
|
|
unsafe { |
|
|
|
let arena = crate::Arena::new(); |
|
|
|
let arena = Arena::new(); |
|
|
|
let raw_arena = arena.raw(); |
|
|
|
let raw_arena = arena.raw(); |
|
|
|
let map = upb_Map_New(raw_arena, CType::Bool, CType::Double); |
|
|
|
let map = upb_Map_New(raw_arena, CType::Bool, CType::Double); |
|
|
|
assert_eq!(upb_Map_Size(map), 0); |
|
|
|
assert_eq!(upb_Map_Size(map), 0); |
|
|
|