Add tests for offset calculation