Add implementation of checkTriangle