当前位置: 首页>>代码示例>>Java>>正文


Java ExtWrapIntEncoding类代码示例

本文整理汇总了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);					
	}
}
 
开发者ID:medic,项目名称:javarosa,代码行数:23,代码来源:NumericEncodingTest.java

示例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);
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:24,代码来源:NumericEncodingTest.java

示例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);
		}
	}
}
 
开发者ID:medic,项目名称:javarosa,代码行数:30,代码来源:NumericEncodingTest.java

示例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);
        }
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:31,代码来源:NumericEncodingTest.java

示例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);
}
 
开发者ID:medic,项目名称:javarosa,代码行数:4,代码来源:NumericEncodingTest.java

示例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);
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:5,代码来源:NumericEncodingTest.java

示例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);
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:4,代码来源:NumericEncodingTest.java


注:本文中的org.javarosa.core.util.externalizable.ExtWrapIntEncoding类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。