| 64 | } |
| 65 | |
| 66 | void cmpDataMZ(const MSExperiment& exp1, const MSExperiment& exp2, double abs_tol = 1e-5, double rel_tol = 1+1e-5) |
| 67 | { |
| 68 | // Logic of comparison: if the absolute difference criterion is fulfilled, |
| 69 | // the relative one does not matter. If the absolute difference is larger |
| 70 | // than allowed, the test does not fail if the relative difference is less |
| 71 | // than allowed. |
| 72 | // Note that the sample spectrum intensity has a very large range, from |
| 73 | // 0.00013 to 183 838 intensity and encoding both values with high accuracy |
| 74 | // is difficult. |
| 75 | |
| 76 | TOLERANCE_ABSOLUTE(abs_tol) |
| 77 | TOLERANCE_RELATIVE(rel_tol) |
| 78 | for (Size i = 0; i < exp1.getNrSpectra(); i++) |
| 79 | { |
| 80 | TEST_EQUAL(exp1.getSpectra()[i].size(), exp2.getSpectra()[i].size()) |
| 81 | for (Size k = 0; k < exp1.getSpectra()[i].size(); k++) |
| 82 | { |
| 83 | // slof is no good for values smaller than 5 |
| 84 | // if (exp.getSpectrum(i)[k].getIntensity() < 1.0) {continue;} |
| 85 | auto a = exp1.getSpectra()[i][k].getMZ(); |
| 86 | auto b = exp2.getSpectra()[i][k].getMZ(); |
| 87 | // avoid the console clutter if nothing interesing happens |
| 88 | if (!TEST::isRealSimilar(a, b)) TEST_REAL_SIMILAR(a, b) |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | void cmpDataRT(const MSExperiment& exp1, const MSExperiment& exp2, double abs_tol = 1e-5, double rel_tol = 1+1e-5) |
| 94 | { |
no test coverage detected