Add tests for #calculate_pages