Is being a right triangle both necessary and sufficient for the Pythagorean Theorem to hold? I recently encountered a Stack Overflow question (since closed) in which the OP was testing for whether a triangle was right by whether or not it "met" the criteria of the Pythagorean Theorem (i.e. whether or not the square of the hypotenuse is equal to the square of the two sides). The code was to this effect:
public void Test(int a, int b, int c) {
   if ((c * c) == ((a * a) + (b * b)) {
     System.out.println("This is a right triangle");
   }
   else {
     System.out.println("This is not a right triangle");
   }
}

(There are obviously some other problems with this code, like the fact that it doesn't validate the input to make sure that the inputs are positive and the fact that it only accepts integers).
The question was asking about something completely different in the code and never directly addressed the test, but I got to thinking: is this a valid test for whether a triangle is a right triangle?
Obviously, the Pythagorean Theorem states that, for all right triangles, $a^2 + b^2 = c^2$ (where $a$ and $b$ are sides and $c$ is the hypotenuse). This will hold for all right triangles, so being a right triangle is a sufficient condition for the Pythagorean Theorem to hold.
Is it also a necessary condition? I.e. if $c^2 = a^2 + b^2$ for some arbitrary triangle, is the triangle necessarily a right triangle? Or are there counterexamples?

Suppose that $a^2 + b^2 = c^2$ is a necessary condition to be a right triangle.
Corollary: $a^2 + b^2 = c^2$ is a sufficient condition to be a right triangle.
Proof: Suppose you're given a particular triangle whose side lengths satisfy $a^2 + b^2 = c^2$.
Construct a right triangle whose two sides adjacent to the angle are of length $a$ and $b$ (e.g. start with the right angle, and mark off the two sides to have the appropriate length). By the supposition, it follows that the third side of the right triangle has length $c$.
By the side-side-side congruence theorem, the original triangle is congruent to the right triangle, and thus the original triangle is a right triangle.
