summaryrefslogtreecommitdiff
path: root/matching/src/tests/test_common.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'matching/src/tests/test_common.cpp')
-rw-r--r--matching/src/tests/test_common.cpp66
1 files changed, 17 insertions, 49 deletions
diff --git a/matching/src/tests/test_common.cpp b/matching/src/tests/test_common.cpp
index c55577e..9079a56 100644
--- a/matching/src/tests/test_common.cpp
+++ b/matching/src/tests/test_common.cpp
@@ -8,56 +8,24 @@
#include "simplex.h"
#include "matching_distance.h"
-using namespace md;
+//using namespace md;
+using Real = double;
+using Point = md::Point<Real>;
+using Bifiltration = md::Bifiltration<Real>;
+using BifiltrationProxy = md::BifiltrationProxy<Real>;
+using CalculationParams = md::CalculationParams<Real>;
+using CellWithValue = md::CellWithValue<Real>;
+using DualPoint = md::DualPoint<Real>;
+using DualBox = md::DualBox<Real>;
+using Simplex = md::Simplex<Real>;
+using AbstractSimplex = md::AbstractSimplex;
+using BoundStrategy = md::BoundStrategy;
+using TraverseStrategy = md::TraverseStrategy;
+using AxisType = md::AxisType;
+using AngleType = md::AngleType;
+using ValuePoint = md::ValuePoint;
+using Column = md::Column;
-TEST_CASE("Rational", "[common_utils][rational]")
-{
- // gcd
- REQUIRE(gcd(10, 5) == 5);
- REQUIRE(gcd(5, 10) == 5);
- REQUIRE(gcd(5, 7) == 1);
- REQUIRE(gcd(7, 5) == 1);
- REQUIRE(gcd(13, 0) == 13);
- REQUIRE(gcd(0, 13) == 13);
- REQUIRE(gcd(16, 24) == 8);
- REQUIRE(gcd(24, 16) == 8);
- REQUIRE(gcd(16, 32) == 16);
- REQUIRE(gcd(32, 16) == 16);
-
-
- // reduce
- REQUIRE(reduce({2, 1}) == std::make_pair(2, 1));
- REQUIRE(reduce({1, 2}) == std::make_pair(1, 2));
- REQUIRE(reduce({2, 2}) == std::make_pair(1, 1));
- REQUIRE(reduce({0, 2}) == std::make_pair(0, 1));
- REQUIRE(reduce({0, 20}) == std::make_pair(0, 1));
- REQUIRE(reduce({35, 49}) == std::make_pair(5, 7));
- REQUIRE(reduce({35, 25}) == std::make_pair(7, 5));
-
- // midpoint
- REQUIRE(midpoint(Rational {0, 1}, Rational {1, 2}) == std::make_pair(1, 4));
- REQUIRE(midpoint(Rational {1, 4}, Rational {1, 2}) == std::make_pair(3, 8));
- REQUIRE(midpoint(Rational {1, 2}, Rational {1, 2}) == std::make_pair(1, 2));
- REQUIRE(midpoint(Rational {1, 2}, Rational {1, 1}) == std::make_pair(3, 4));
- REQUIRE(midpoint(Rational {3, 7}, Rational {5, 14}) == std::make_pair(11, 28));
-
-
- // arithmetic
-
- REQUIRE(Rational(1, 2) + Rational(3, 5) == Rational(11, 10));
- REQUIRE(Rational(2, 5) - Rational(3, 10) == Rational(1, 10));
- REQUIRE(Rational(2, 3) * Rational(4, 7) == Rational(8, 21));
- REQUIRE(Rational(2, 3) * Rational(3, 2) == Rational(1));
- REQUIRE(Rational(2, 3) / Rational(3, 2) == Rational(4, 9));
- REQUIRE(Rational(1, 2) * Rational(3, 5) == Rational(3, 10));
-
- // comparison
- REQUIRE(Rational(100000, 2000000) < Rational(100001, 2000000));
- REQUIRE(!(Rational(100001, 2000000) < Rational(100000, 2000000)));
- REQUIRE(!(Rational(100000, 2000000) < Rational(100000, 2000000)));
- REQUIRE(Rational(-100000, 2000000) < Rational(100001, 2000000));
- REQUIRE(Rational(-100001, 2000000) < Rational(100000, 2000000));
-};
TEST_CASE("AbstractSimplex", "[abstract_simplex]")
{