law of cosines test