add unit tests and length calculator for enclosing bounding box