added a triangle validation function and updated the test with invalid