btreemap.rs 707 B

12345678910111213141516171819202122232425262728
  1. extern crate ralloc;
  2. #[global_allocator]
  3. static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
  4. mod util;
  5. use std::collections::BTreeMap;
  6. #[test]
  7. fn btreemap() {
  8. util::multiply(|| {
  9. let mut map = BTreeMap::new();
  10. util::acid(|| {
  11. map.insert("Nicolas", "Cage");
  12. map.insert("is", "God");
  13. map.insert("according", "to");
  14. map.insert("ca1ek", ".");
  15. });
  16. assert_eq!(map.get("Nicolas"), Some(&"Cage"));
  17. assert_eq!(map.get("is"), Some(&"God"));
  18. assert_eq!(map.get("according"), Some(&"to"));
  19. assert_eq!(map.get("ca1ek"), Some(&"."));
  20. assert_eq!(map.get("This doesn't exist."), None);
  21. });
  22. }