The bug appeared when testing on iOS 7 but not iOS 8, which suggested the root cause might be a floating point error with the constraint layout library.
Finding good test input can be tricky. Even with loads of unit tests, bugs still get through. Why not just generate input and let that find the edge cases?