extern crate symtern;
use symtern::prelude::*;
use symtern::Pool;
use symtern::ErrorKind;
fn main() {
{
let mut pool = Pool::<u16,u8>::new();
for i in 0u16..256 {
assert!(pool.intern(&i).is_ok(), "Failed to intern a value");
}
assert!(pool.is_full());
assert!(pool.intern(&123).is_ok());
match pool.intern(&1234) {
Ok(sym) => panic!("Expected overflow, but got symbol {:?}", sym),
Err(err) => match err.kind() {
ErrorKind::PoolOverflow => (),
_ => panic!("Wrong error kind returned from `intern`"),
}
}
}
}