Skip to content

Commit a1917e6

Browse files
committed
Update tests
1 parent 8528942 commit a1917e6

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

‎tests/unit/map.cpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ int main() {
5050
assert(it4->second == 6);
5151
assert(*p == 6);
5252
assert(x5 == 5);
53+
std::map<short, unsigned>::const_iterator const_it4 = m.find(4);
54+
assert((*const_it4).second == 6);
5355
auto &r = m;
5456
assert(r.size() == 4);
5557
assert(m.find(4) != m.end());

‎tests/unit/out/refcount/map.rs‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,17 @@ fn main_0() -> i32 {
423423
assert!(((*(*it4.borrow()).deref().with(|__p| __p.1.clone()).borrow()) == 6_u32));
424424
assert!(((p.read()) == 6_u32));
425425
assert!((x5 == 5_u32));
426+
let const_it4: Value<RefcountMapIter<i16, u32>> =
427+
Rc::new(RefCell::new(RefcountMapIter::find_key(
428+
(m.as_pointer() as Ptr<BTreeMap<i16, Value<(Value<i16>, Value<u32>)>>>),
429+
&4_i16,
430+
)));
431+
assert!(
432+
((*(*(*const_it4.borrow()).deref().upgrade().deref())
433+
.1
434+
.borrow())
435+
== 6_u32)
436+
);
426437
let r: Ptr<BTreeMap<i16, Value<(Value<i16>, Value<u32>)>>> = m.as_pointer();
427438
assert!(((*r.upgrade().deref()).len() == 4_usize));
428439
assert!(

‎tests/unit/out/unsafe/map.rs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ unsafe fn main_0() -> i32 {
192192
assert!(((*&raw mut (*it4.deref()).1) == (6_u32)));
193193
assert!(((*p) == (6_u32)));
194194
assert!(((x5) == (5_u32)));
195+
let mut const_it4: UnsafeMapIterator<i16, u32> =
196+
UnsafeMapIterator::find_key(&m as *const BTreeMap<i16, Box<(i16, u32)>>, &4_i16).clone();
197+
assert!((((*const_it4.deref().cast_const()).1) == (6_u32)));
195198
let r: *mut BTreeMap<i16, Box<(i16, u32)>> = &mut m;
196199
assert!((((*r).len()) == (4_usize)));
197200
assert!(

0 commit comments

Comments
 (0)