1616using namespace jumanpp ::core;
1717using namespace jumanpp ;
1818
19+ using Catch::Matchers::WithinAbs;
20+
1921namespace {
2022
2123void dumpJumandicLattice (std::string dst,
@@ -107,7 +109,7 @@ TEST_CASE(
107109analysis::EntryBeam::isFake (be2)) {
108110continue ;
109111 }
110- CHECK (be1.totalScore == Approx (be2.totalScore ));
112+ CHECK_THAT (be1.totalScore , WithinAbs (be2.totalScore , 1e- 3f ));
111113 }
112114 }
113115 }
@@ -118,7 +120,7 @@ TEST_CASE(
118120
119121for (int i =0 ; i < tenv.beamSize ; ++i) {
120122CAPTURE (i);
121- CHECK (lbeam1.at (i).totalScore == Approx (lbeam2.at (i).totalScore ));
123+ CHECK_THAT (lbeam1.at (i).totalScore , WithinAbs (lbeam2.at (i).totalScore , 1e- 3f ));
122124 }
123125}
124126
@@ -196,7 +198,7 @@ TEST_CASE(
196198
197199for (int el =0 ; el < nels; ++el) {
198200CAPTURE (el);
199- CHECK (t0s1.at (el) == Approx (t0s2.at (el)));
201+ CHECK_THAT (t0s1.at (el), WithinAbs (t0s2.at (el), 1e- 3f ));
200202 }
201203auto t1x1 = fb1.t1Buf (gen.ngramStats ().num2Grams , nels);
202204auto t1x2 = fb2.t1Buf (gen.ngramStats ().num2Grams , nels);
@@ -232,7 +234,7 @@ TEST_CASE(
232234auto t1s2 = proc2.scores_ .bufferT1 ();
233235for (int el =0 ; el < nels; ++el) {
234236CAPTURE (el);
235- CHECK (t1s1.at (el) == Approx (t1s2.at (el)));
237+ CHECK_THAT (t1s1.at (el), WithinAbs (t1s2.at (el), 1e- 3f ));
236238 }
237239 proc1.resolveBeamAt (t1node.boundary , t1node.position );
238240 proc2.resolveBeamAt (t1node.boundary , t1node.position );
@@ -247,7 +249,7 @@ TEST_CASE(
247249auto t2s2 = proc1.scores_ .bufferT2 ();
248250for (int el =0 ; el < nels; ++el) {
249251CAPTURE (el);
250- CHECK (t2s1.at (el) == Approx (t2s2.at (el)));
252+ CHECK_THAT (t2s1.at (el), WithinAbs (t2s2.at (el), 1e- 3f ));
251253 }
252254 }
253255 }
@@ -337,7 +339,7 @@ TEST_CASE("feature representation of gen/nongen is the same with global beam") {
337339 }
338340
339341CAPTURE (beam);
340- CHECK (be1.totalScore == Approx (be2.totalScore ));
342+ CHECK_THAT (be1.totalScore , WithinAbs (be2.totalScore , 1e- 3f ));
341343CHECK (be1.ptr == be2.ptr );
342344 }
343345 }
@@ -349,7 +351,7 @@ TEST_CASE("feature representation of gen/nongen is the same with global beam") {
349351
350352for (int i =0 ; i < tenv.beamSize ; ++i) {
351353CAPTURE (i);
352- CHECK (lbeam1.at (i).totalScore == Approx (lbeam2.at (i).totalScore ));
354+ CHECK_THAT (lbeam1.at (i).totalScore , WithinAbs (lbeam2.at (i).totalScore , 1e- 3f ));
353355// LOG_WARN() << lbeam1.at(i).totalScore;
354356// LOG_WARN() << lbeam2.at(i).totalScore;
355357 }