extern crate hostnames_allocator; use hostnames_allocator::hostnames_allocator::HostnamesAllocator; #[test] fn allocator_allocates_hostnames() { let mut allocator = HostnamesAllocator::new(); assert_eq!(allocator.allocate("gateway"), "gateway1"); assert_eq!(allocator.allocate("gateway"), "gateway2"); assert_eq!(allocator.allocate("gateway"), "gateway3"); assert_eq!(allocator.allocate("proxy"), "proxy1"); assert_eq!(allocator.allocate("proxy"), "proxy2"); allocator.free("gateway2"); allocator.free("gateway5"); assert_eq!(allocator.allocate("proxy"), "proxy3"); assert_eq!(allocator.allocate("gateway"), "gateway2"); assert_eq!(allocator.allocate("gateway"), "gateway4"); assert_eq!(allocator.allocate("gateway"), "gateway5"); }