refactored segment tests to iterate over examples