5 * Created by Christian Brunschen on 19/05/2008.
6 * Copyright 2008 ZXing authors All rights reserved.
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
21 #include "DataMaskTest.h"
26 CPPUNIT_TEST_SUITE_REGISTRATION(DataMaskTest);
28 class Mask0Condition : public MaskCondition {
31 bool isMasked(int i, int j) {
32 return (i + j) % 2 == 0;
36 class Mask1Condition : public MaskCondition {
39 bool isMasked(int i, int j) {
44 class Mask2Condition : public MaskCondition {
47 bool isMasked(int i, int j) {
52 class Mask3Condition : public MaskCondition {
55 bool isMasked(int i, int j) {
56 return (i + j) % 3 == 0;
60 class Mask4Condition : public MaskCondition {
63 bool isMasked(int i, int j) {
64 return (i / 2 + j / 3) % 2 == 0;
68 class Mask5Condition : public MaskCondition {
71 bool isMasked(int i, int j) {
72 return (i * j) % 2 + (i * j) % 3 == 0;
76 class Mask6Condition : public MaskCondition {
79 bool isMasked(int i, int j) {
80 return ((i * j) % 2 + (i * j) % 3) % 2 == 0;
84 class Mask7Condition : public MaskCondition {
87 bool isMasked(int i, int j) {
88 return ((i + j) % 2 + (i * j) % 3) % 2 == 0;
93 void DataMaskTest::testMask0() {
94 Mask0Condition condition;
95 testMaskAcrossDimensions(0, condition);
98 void DataMaskTest::testMask1() {
99 Mask1Condition condition;
100 testMaskAcrossDimensions(1, condition);
103 void DataMaskTest::testMask2() {
104 Mask2Condition condition;
105 testMaskAcrossDimensions(2, condition);
108 void DataMaskTest::testMask3() {
109 Mask3Condition condition;
110 testMaskAcrossDimensions(3, condition);
113 void DataMaskTest::testMask4() {
114 Mask4Condition condition;
115 testMaskAcrossDimensions(4, condition);
118 void DataMaskTest::testMask5() {
119 Mask5Condition condition;
120 testMaskAcrossDimensions(5, condition);
123 void DataMaskTest::testMask6() {
124 Mask6Condition condition;
125 testMaskAcrossDimensions(6, condition);
128 void DataMaskTest::testMask7() {
129 Mask7Condition condition;
130 testMaskAcrossDimensions(7, condition);