Skip to content

Commit

Permalink
Slight relaxation in the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sebjameswml committed Dec 5, 2024
1 parent 18f8df4 commit 6afb527
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/testarange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ int main()
morph::vvec<double> x_ex1 = { 0.0 , 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5 };
x.arange (0.0, 6.0, 0.5);
std::cout << "First example: " << x << std::endl;
if (std::abs((x - x_ex1).longest()) >= std::numeric_limits<double>::epsilon()) { --rtn; }
if (std::abs((x - x_ex1).longest()) > std::numeric_limits<double>::epsilon()) { --rtn; }

// x = np.arange(-2.5, 2.3, 2)
morph::vvec<double> x_ex2 = { -2.5, -0.5, 1.5 };
x.arange (-2.5, 2.3, 2.0);
std::cout << "Second example: " << x << std::endl;
if (std::abs((x - x_ex2).longest()) >= std::numeric_limits<double>::epsilon()) { --rtn; }
if (std::abs((x - x_ex2).longest()) > std::numeric_limits<double>::epsilon()) { --rtn; }

// x = np.arange(-5, 5, 2)
morph::vvec<double> x_ex3 = { -5.0, -3.0, -1.0, 1.0, 3.0 };
x.arange (-5.0, 5.0, 2.0);
std::cout << "Third example: " << x << std::endl;
if (std::abs((x - x_ex3).longest()) >= std::numeric_limits<double>::epsilon()) { --rtn; }
if (std::abs((x - x_ex3).longest()) > std::numeric_limits<double>::epsilon()) { --rtn; }

// x = np.arange(2, -2, 0.27) (should be empty)
morph::vvec<double> x_ex4 = {};
Expand All @@ -40,19 +40,19 @@ int main()
morph::vvec<double> x_ex6 = { 1.0, 0.8, 0.6, 0.4, 0.2, 0.0, -0.2, -0.4, -0.6, -0.8 };
x.arange (1.0, -1.0, -0.2);
std::cout << "Sixth example: " << x << std::endl;
if (std::abs((x - x_ex6).longest()) >= std::numeric_limits<double>::epsilon()) { --rtn; }
if (std::abs((x - x_ex6).longest()) > std::numeric_limits<double>::epsilon()) { --rtn; }

// x = np.arange(-2, 1.2, 0.3)
morph::vvec<double> x_ex7 = { -2.0 , -1.7, -1.4, -1.1, -0.8, -0.5, -0.2, 0.1, 0.4, 0.7, 1.0 };
x.arange (-2.0, 1.2, 0.3);
std::cout << "Seventh example: " << x << std::endl;
if (std::abs((x - x_ex7).longest()) >= std::numeric_limits<double>::epsilon()) { --rtn; }
if (std::abs((x - x_ex7).longest()) > std::numeric_limits<double>::epsilon()) { --rtn; }

// x = np.arange(1, 3, 2.1) (increment greater than gap)
morph::vvec<double> x_ex8 = { 1.0 };
x.arange (1.0, 3.0, 2.1);
std::cout << "Eighth example: " << x << std::endl;
if (std::abs((x - x_ex8).longest()) >= std::numeric_limits<double>::epsilon()) { --rtn; }
if (std::abs((x - x_ex8).longest()) > std::numeric_limits<double>::epsilon()) { --rtn; }


if (rtn == 0) { std::cout << "Success\n"; }
Expand Down

0 comments on commit 6afb527

Please sign in to comment.