mirror of
https://github.com/chatmail/core.git
synced 2026-04-29 03:16:29 +03:00
Store dc_kml_t::locations as Option<dc_array_t> instead of pointer
This commit is contained in:
@@ -840,24 +840,24 @@ fn test_dc_kml_parse() {
|
||||
assert!(!kml.addr.is_null());
|
||||
assert_eq!(as_str(kml.addr as *const libc::c_char), "user@example.org",);
|
||||
|
||||
assert_eq!(dc_array_get_cnt(kml.locations), 2);
|
||||
let locations_ref = kml.locations.as_ref().unwrap();
|
||||
assert_eq!(locations_ref.len(), 2);
|
||||
|
||||
assert!(dc_array_get_latitude(kml.locations, 0) > 53.6f64);
|
||||
assert!(dc_array_get_latitude(kml.locations, 0) < 53.8f64);
|
||||
assert!(dc_array_get_longitude(kml.locations, 0) > 9.3f64);
|
||||
assert!(dc_array_get_longitude(kml.locations, 0) < 9.5f64);
|
||||
assert!(dc_array_get_accuracy(kml.locations, 0) > 31.9f64);
|
||||
assert!(dc_array_get_accuracy(kml.locations, 0) < 32.1f64);
|
||||
assert_eq!(dc_array_get_timestamp(kml.locations, 0), 1551906597);
|
||||
assert!(locations_ref.get_latitude(0) > 53.6f64);
|
||||
assert!(locations_ref.get_latitude(0) < 53.8f64);
|
||||
assert!(locations_ref.get_longitude(0) > 9.3f64);
|
||||
assert!(locations_ref.get_longitude(0) < 9.5f64);
|
||||
assert!(locations_ref.get_accuracy(0) > 31.9f64);
|
||||
assert!(locations_ref.get_accuracy(0) < 32.1f64);
|
||||
assert_eq!(locations_ref.get_timestamp(0), 1551906597);
|
||||
|
||||
assert!(dc_array_get_latitude(kml.locations, 1) > 63.6f64);
|
||||
assert!(dc_array_get_latitude(kml.locations, 1) < 63.8f64);
|
||||
assert!(dc_array_get_longitude(kml.locations, 1) > 19.3f64);
|
||||
assert!(dc_array_get_longitude(kml.locations, 1) < 19.5f64);
|
||||
assert!(dc_array_get_accuracy(kml.locations, 1) > 2.4f64);
|
||||
assert!(dc_array_get_accuracy(kml.locations, 1) < 2.6f64);
|
||||
|
||||
assert_eq!(dc_array_get_timestamp(kml.locations, 1), 1544739072);
|
||||
assert!(locations_ref.get_latitude(1) > 63.6f64);
|
||||
assert!(locations_ref.get_latitude(1) < 63.8f64);
|
||||
assert!(locations_ref.get_longitude(1) > 19.3f64);
|
||||
assert!(locations_ref.get_longitude(1) < 19.5f64);
|
||||
assert!(locations_ref.get_accuracy(1) > 2.4f64);
|
||||
assert!(locations_ref.get_accuracy(1) < 2.6f64);
|
||||
assert_eq!(locations_ref.get_timestamp(1), 1544739072);
|
||||
|
||||
dc_kml_unref(&mut kml);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user