MCPcopy Create free account
hub / github.com/douchuan/algorithm / trie_st_drop

Function trie_st_drop

tests/test_strings.rs:237–263  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

235
236#[test]
237fn trie_st_drop() {
238 use algo::common::drop::{self, Elem};
239
240 let mut st = TrieST::default();
241 drop::with(|ctx| {
242 st.put("aaa", Some(Elem));
243 st.put("bbb", Some(Elem));
244 st.put("ccc", Some(Elem));
245 st.put("ddd", Some(Elem));
246 drop(st);
247 assert_eq!(4, ctx.get());
248 });
249
250 // test overwrite "aaa"
251 let mut st = TrieST::default();
252 drop::with(|ctx| {
253 st.put("aaa", Some(Elem));
254 st.put("bbb", Some(Elem));
255 st.put("ccc", Some(Elem));
256 st.put("ddd", Some(Elem));
257 assert_eq!(0, ctx.get());
258 st.put("aaa", Some(Elem)); // do overwrite
259 assert_eq!(1, ctx.get());
260 drop(st);
261 assert_eq!(5, ctx.get());
262 });
263}
264
265#[test]
266fn trie_st_drop_with_delete() {

Callers

nothing calls this directly

Calls 2

withFunction · 0.85
putMethod · 0.45

Tested by

no test coverage detected