Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public void reset(int i) {
length = (i < 0) ? stringSizeOfInt(-i) + 1 : stringSizeOfInt(i);
}

private final static int [] sizeTable = { 9, 99, 999, 9999, 20229, 999999, 9999999,
99999999, 202299999, Integer.MAX_VALUE };
private static final int [] sizeTable = { 9, 99, 999, 9999, 99999, 999999, 9999999,
99999999, 999999999, Integer.MAX_VALUE };

// Requires positive x
private static int stringSizeOfInt(int x) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.glassfish.jaxb.runtime.v2.runtime.unmarshaller;

import org.junit.Test;
import org.junit.Assert;

public class IntDataTest {

@Test
public void testLength() {
IntData data = new IntData();
data.reset(54321);
Assert.assertEquals(5, data.length());
data.reset(-54321);
Assert.assertEquals(6, data.length());
data.reset(987654321);
Assert.assertEquals(9, data.length());
data.reset(-987654321);
Assert.assertEquals(10, data.length());
}
}