143 }
144 }
145
146 public static void verify(BinaryMethod method) {
147 for (int i = 0; i < 50000; ++i) {
148 Verify.verifyBinary(values[i & 255], values[i & 255] - i, method);
149 Verify.verifyBinary(values[i & 255] + i, values[i & 255] - i, method);
150 Verify.verifyBinary(values[i & 255], values[i & 255], method);
151 if ((i & 1) == 1 && i > 5) {
152 Verify.verifyBinary(values[i & 255] + i, values[i & 255] - i, method);
153 } else {
154 Verify.verifyBinary(values[i & 255] - i, values[i & 255] + i, method);
155 }
156 Verify.verifyBinary(values[i & 255], values[(i + 1) & 255], method);
157 }
158 }
159 }
160
161 public static class NonConstantTest {
162 public static java.util.Random rnd = new java.util.Random();
163
164 public static void verify(BinaryMethod method) {
165 for (int i = 0; i < 50000; ++i) {
166 int rnd1 = rnd.nextInt(), rnd2 = rnd.nextInt();
167 Verify.verifyBinary(rnd1, rnd2, method);
168 Verify.verifyBinary(rnd1, rnd2 + 1, method);
169 Verify.verifyBinary(rnd1 + 1, rnd2, method);
170 Verify.verifyBinary(rnd1 - 1, rnd2, method);
171 Verify.verifyBinary(rnd1, rnd2 - 1, method);
172 }
173 }
174 }
175
176 public static class NonConstantLongTest {
177 public static long[] values = { Long.MIN_VALUE, Long.MAX_VALUE, 0, Long.MAX_VALUE - 1831 };
178 public static java.util.Random rnd = new java.util.Random();
179
180 public static void verify(BinaryLongMethod method) {
181 for (int i = 0; i < 50000; ++i) {
182 long rnd1 = rnd.nextLong(), rnd2 = rnd.nextLong();
183 Verify.verifyBinary(rnd1, rnd2, method);
184 Verify.verifyBinary(rnd1, rnd2 + 1, method);
185 Verify.verifyBinary(rnd1 + 1, rnd2, method);
186 Verify.verifyBinary(rnd1 - 1, rnd2, method);
187 Verify.verifyBinary(rnd1, rnd2 - 1, method);
188 Verify.verifyBinary(rnd1 + Long.MAX_VALUE - rnd2, rnd2 + 1, method);
189 Verify.verifyBinary(values[0], values[2], method);
190 Verify.verifyBinary(values[1], values[2], method);
191 Verify.verifyBinary(values[3], 74L, method);
|
143 }
144 }
145
146 public static void verify(BinaryMethod method) {
147 for (int i = 0; i < 50000; ++i) {
148 Verify.verifyBinary(values[i & 255], values[i & 255] - i, method);
149 Verify.verifyBinary(values[i & 255] + i, values[i & 255] - i, method);
150 Verify.verifyBinary(values[i & 255], values[i & 255], method);
151 if ((i & 1) == 1 && i > 5) {
152 Verify.verifyBinary(values[i & 255] + i, values[i & 255] - i, method);
153 } else {
154 Verify.verifyBinary(values[i & 255] - i, values[i & 255] + i, method);
155 }
156 Verify.verifyBinary(values[i & 255], values[(i + 1) & 255], method);
157 }
158 }
159 }
160
161 public static class NonConstantTest {
162 public static java.util.Random rnd = new java.util.Random();
163 public static int[] values = new int[] { Integer.MAX_VALUE, Integer.MIN_VALUE };
164
165 public static void verify(BinaryMethod method) {
166 for (int i = 0; i < 50000; ++i) {
167 int rnd1 = rnd.nextInt(), rnd2 = rnd.nextInt();
168 Verify.verifyBinary(rnd1, rnd2, method);
169 Verify.verifyBinary(rnd1, rnd2 + 1, method);
170 Verify.verifyBinary(rnd1 + 1, rnd2, method);
171 Verify.verifyBinary(rnd1 - 1, rnd2, method);
172 Verify.verifyBinary(rnd1, rnd2 - 1, method);
173 Verify.verifyBinary(0, values[0], method);
174 Verify.verifyBinary(values[0], 0, method);
175 Verify.verifyBinary(0, values[1], method);
176 Verify.verifyBinary(values[1], 0, method);
177 }
178 }
179 }
180
181 public static class NonConstantLongTest {
182 public static long[] values = { Long.MIN_VALUE, Long.MAX_VALUE, 0, Long.MAX_VALUE - 1831 };
183 public static java.util.Random rnd = new java.util.Random();
184
185 public static void verify(BinaryLongMethod method) {
186 for (int i = 0; i < 50000; ++i) {
187 long rnd1 = rnd.nextLong(), rnd2 = rnd.nextLong();
188 Verify.verifyBinary(rnd1, rnd2, method);
189 Verify.verifyBinary(rnd1, rnd2 + 1, method);
190 Verify.verifyBinary(rnd1 + 1, rnd2, method);
191 Verify.verifyBinary(rnd1 - 1, rnd2, method);
192 Verify.verifyBinary(rnd1, rnd2 - 1, method);
193 Verify.verifyBinary(rnd1 + Long.MAX_VALUE - rnd2, rnd2 + 1, method);
194 Verify.verifyBinary(values[0], values[2], method);
195 Verify.verifyBinary(values[1], values[2], method);
196 Verify.verifyBinary(values[3], 74L, method);
|