Commit a440133b authored by Sean McBride's avatar Sean McBride

General code review of vtkMath: trivial & conservative

- prefer preincrement
- always use {} with if statements
- replaced a #define with a const
- fixed some incorrect indentation
- remove some extraneous semicolons and parentheses
- removed dead tests
- improved comments
- added some consts
parent b8ec9be1
......@@ -23,10 +23,6 @@
#include <vector>
static int TestPi();
#if 0
static int TestDoublePi();
static int TestDoubleTwoPi();
#endif
static int TestDegreesFromRadians();
static int TestRound();
static int TestFloor();
......@@ -98,11 +94,6 @@ int UnitTestMath(int,char *[])
status += TestPi();
#if 0
status += TestDoublePi(); // legacy
status += TestDoubleTwoPi(); // legacy
#endif
status += TestDegreesFromRadians();
status += TestRound();
status += TestFloor();
......@@ -202,56 +193,6 @@ int TestPi()
return status;
}
#if 0
// Validate by comparing to atan/4
int TestDoublePi()
{
int status = 0;
std::cout << "DoublePi..";
if (vtkMath::DoublePi() != std::atan(1.0) * 4.0)
{
std::cout << "Expected " << vtkMath::Pi()
<< " but got " << std::atan(1.0) * 4.0;
++status;
}
if (status)
{
std::cout << "..FAILED" << std::endl;
}
else
{
std::cout << ".PASSED" << std::endl;
}
return status;
}
// Validate by comparing to atan/4 * 2
int TestDoubleTwoPi()
{
int status = 0;
std::cout << "DoubleTwoPi..";
if (vtkMath::DoubleTwoPi() != std::atan(1.0) * 4.0 * 2.0)
{
std::cout << "Expected " << vtkMath::Pi() * 2.0
<< " but got " << std::atan(1.0) * 4.0 * 2.0;
++status;
}
if (status)
{
std::cout << "..FAILED" << std::endl;
}
else
{
std::cout << ".PASSED" << std::endl;
}
return status;
}
#endif
// Validate against RadiansFromDegress
int TestDegreesFromRadians()
{
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment