File: maskasserter.h

package info (click to toggle)
aoflagger 3.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,000 kB
  • sloc: cpp: 67,891; python: 497; sh: 242; makefile: 22
file content (31 lines) | stat: -rw-r--r-- 767 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef AOFLAGGER_MASK_ASSERTER_H
#define AOFLAGGER_MASK_ASSERTER_H

#include <string>
#include <stdexcept>
#include <sstream>

#include "../../structures/mask2d.h"

#include <boost/test/unit_test.hpp>

class MaskAsserter {
 public:
  static void AssertEqualMasks(const Mask2D& actual, const Mask2D& expected,
                               const std::string& str) {
    BOOST_CHECK_EQUAL(actual.Width(), expected.Width());
    BOOST_CHECK_EQUAL(actual.Height(), expected.Height());

    size_t errCount = 0;
    for (size_t y = 0; y < actual.Height(); ++y) {
      for (size_t x = 0; x < actual.Width(); ++x) {
        if (actual.Value(x, y) != expected.Value(x, y)) {
          ++errCount;
        }
      }
    }
    BOOST_CHECK_EQUAL(errCount, 0);
  }
};

#endif