本文整理汇总了Java中org.javarosa.core.util.externalizable.ExtWrapIntEncoding类的典型用法代码示例。如果您正苦于以下问题:Java ExtWrapIntEncoding类的具体用法?Java ExtWrapIntEncoding怎么用?Java ExtWrapIntEncoding使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExtWrapIntEncoding类属于org.javarosa.core.util.externalizable包,在下文中一共展示了ExtWrapIntEncoding类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testIntEncodingUniform
import org.javarosa.core.util.externalizable.ExtWrapIntEncoding; //导入依赖的package包/类
public void testIntEncodingUniform () {
ExtWrapIntEncoding enc = new ExtWrapIntEncodingUniform();
testNumericEncoding(0, enc);
testNumericEncoding(-1, enc);
testNumericEncoding(1, enc);
testNumericEncoding(-2, enc);
for (int i = 3; i <= 64; i++) {
long min = (i < 64 ? -((long)0x01 << (i - 1)) : Long.MIN_VALUE);
long max = (i < 64 ? ((long)0x01 << (i - 1)) - 1 : Long.MAX_VALUE);
testNumericEncoding(max - 1, enc);
testNumericEncoding(max, enc);
if (i < 64)
testNumericEncoding(max + 1, enc);
testNumericEncoding(min + 1, enc);
testNumericEncoding(min, enc);
if (i < 64)
testNumericEncoding(min - 1, enc);
}
}
示例2: testIntEncodingUniform
import org.javarosa.core.util.externalizable.ExtWrapIntEncoding; //导入依赖的package包/类
@Test
public void testIntEncodingUniform() {
ExtWrapIntEncoding enc = new ExtWrapIntEncodingUniform();
testNumericEncoding(0, enc);
testNumericEncoding(-1, enc);
testNumericEncoding(1, enc);
testNumericEncoding(-2, enc);
for (int i = 3; i <= 64; i++) {
long min = (i < 64 ? -((long)0x01 << (i - 1)) : Long.MIN_VALUE);
long max = (i < 64 ? ((long)0x01 << (i - 1)) - 1 : Long.MAX_VALUE);
testNumericEncoding(max - 1, enc);
testNumericEncoding(max, enc);
if (i < 64)
testNumericEncoding(max + 1, enc);
testNumericEncoding(min + 1, enc);
testNumericEncoding(min, enc);
if (i < 64)
testNumericEncoding(min - 1, enc);
}
}
示例3: testIntEncodingSmall
import org.javarosa.core.util.externalizable.ExtWrapIntEncoding; //导入依赖的package包/类
public void testIntEncodingSmall () {
int[] biases = {0, 1, 30, 128, 254};
int[] smallTests = {0, 1, 126, 127, 128, 129, 253, 254, 255, 256, -1, -2, -127, -128, -129};
int[] largeTests = {3750, -3750, 33947015, -33947015, Integer.MAX_VALUE, Integer.MAX_VALUE - 1, Integer.MIN_VALUE, Integer.MIN_VALUE + 1};
for (int i = -1; i < biases.length; i++) {
int bias;
if (i == -1) {
bias = ExtWrapIntEncodingSmall.DEFAULT_BIAS;
} else {
bias = biases[i];
if (bias == ExtWrapIntEncodingSmall.DEFAULT_BIAS)
continue;
}
ExtWrapIntEncoding enc = new ExtWrapIntEncodingSmall(bias);
for (int j = 0; j < smallTests.length; j++) {
testNumericEncoding(smallTests[j], enc);
if (bias != 0)
testNumericEncoding(smallTests[j] - bias, enc);
}
for (int j = 0; j < largeTests.length; j++) {
testNumericEncoding(largeTests[j], enc);
}
}
}
示例4: testIntEncodingSmall
import org.javarosa.core.util.externalizable.ExtWrapIntEncoding; //导入依赖的package包/类
@Test
public void testIntEncodingSmall() {
int[] biases = {0, 1, 30, 128, 254};
int[] smallTests = {0, 1, 126, 127, 128, 129, 253, 254, 255, 256, -1, -2, -127, -128, -129};
int[] largeTests = {3750, -3750, 33947015, -33947015, Integer.MAX_VALUE, Integer.MAX_VALUE - 1, Integer.MIN_VALUE, Integer.MIN_VALUE + 1};
for (int i = -1; i < biases.length; i++) {
int bias;
if (i == -1) {
bias = ExtWrapIntEncodingSmall.DEFAULT_BIAS;
} else {
bias = biases[i];
if (bias == ExtWrapIntEncodingSmall.DEFAULT_BIAS)
continue;
}
ExtWrapIntEncoding enc = new ExtWrapIntEncodingSmall(bias);
for (int j = 0; j < smallTests.length; j++) {
testNumericEncoding(smallTests[j], enc);
if (bias != 0)
testNumericEncoding(smallTests[j] - bias, enc);
}
for (int j = 0; j < largeTests.length; j++) {
testNumericEncoding(largeTests[j], enc);
}
}
}
示例5: testNumericEncoding
import org.javarosa.core.util.externalizable.ExtWrapIntEncoding; //导入依赖的package包/类
public void testNumericEncoding (long val, ExtWrapIntEncoding encoding) {
ExternalizableTest.testExternalizable(encoding.clone(new Long(val)), encoding, null, this, null);
}
示例6: testNumericEncoding
import org.javarosa.core.util.externalizable.ExtWrapIntEncoding; //导入依赖的package包/类
public void testNumericEncoding(long val, ExtWrapIntEncoding encoding) {
// TODO PLM: when the call to this test fails, who is blamed in the test suite?
ExternalizableTest.testExternalizable(encoding.clone(new Long(val)), encoding, null, null);
}
示例7: testNumericEncoding
import org.javarosa.core.util.externalizable.ExtWrapIntEncoding; //导入依赖的package包/类
public void testNumericEncoding(long val, ExtWrapIntEncoding encoding) {
ExternalizableTest.testExternalizable(encoding.clone(new Long(val)), encoding, null, null);
}