mirror of
https://github.com/13hannes11/UU_la_parallel_programming_practical_assignments.git
synced 2024-09-04 00:50:58 +02:00
remove template
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
#include <math.h>
|
||||
|
||||
// Get the Square root of a number.
|
||||
double squareRoot(const double a)
|
||||
{
|
||||
double b = sqrt(a);
|
||||
if(b != b) // NaN check
|
||||
{ return -1.0; }
|
||||
else
|
||||
{ return sqrt(a); }
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
#include "calc.cpp"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(SquareRootTest, PositiveNos)
|
||||
{
|
||||
ASSERT_EQ(6, squareRoot(36.0));
|
||||
ASSERT_EQ(18.0, squareRoot(324.0));
|
||||
ASSERT_EQ(25.4, squareRoot(645.16));
|
||||
ASSERT_EQ(0, squareRoot(0.0));
|
||||
}
|
||||
|
||||
TEST(SquareRootTest, NegativeNos)
|
||||
{
|
||||
ASSERT_EQ(-1.0, squareRoot(-15.0));
|
||||
ASSERT_EQ(-1.0, squareRoot(-0.2));
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
Reference in New Issue
Block a user