From: <mrp...@us...> - 2010-07-21 18:04:29
|
Revision: 3259 http://bigdata.svn.sourceforge.net/bigdata/?rev=3259&view=rev Author: mrpersonick Date: 2010-07-21 18:04:22 +0000 (Wed, 21 Jul 2010) Log Message: ----------- test cases for BigDecimal Modified Paths: -------------- branches/LEXICON_REFACTOR_BRANCH/bigdata/src/java/com/bigdata/btree/keys/IKeyBuilder.java branches/LEXICON_REFACTOR_BRANCH/bigdata/src/test/com/bigdata/btree/keys/TestKeyBuilder.java Modified: branches/LEXICON_REFACTOR_BRANCH/bigdata/src/java/com/bigdata/btree/keys/IKeyBuilder.java =================================================================== --- branches/LEXICON_REFACTOR_BRANCH/bigdata/src/java/com/bigdata/btree/keys/IKeyBuilder.java 2010-07-21 15:00:16 UTC (rev 3258) +++ branches/LEXICON_REFACTOR_BRANCH/bigdata/src/java/com/bigdata/btree/keys/IKeyBuilder.java 2010-07-21 18:04:22 UTC (rev 3259) @@ -28,11 +28,11 @@ package com.bigdata.btree.keys; +import java.math.BigDecimal; import java.math.BigInteger; import java.util.Locale; import java.util.Properties; import java.util.UUID; - import com.bigdata.btree.BytesUtil; import com.bigdata.btree.keys.KeyBuilder.Options; @@ -446,6 +446,17 @@ public IKeyBuilder append(final BigInteger i); /** + * Encode a {@link BigDecimal} into an unsigned byte[] and append it into + * the key buffer. + * + * @param The + * {@link BigDecimal} value. + * + * @return The unsigned byte[]. + */ + public IKeyBuilder append(final BigDecimal d); + + /** * Append the value to the buffer, encoding it as appropriate based on the * class of the object. This method handles all of the primitive data types * plus {@link UUID} and Unicode {@link String}s. Modified: branches/LEXICON_REFACTOR_BRANCH/bigdata/src/test/com/bigdata/btree/keys/TestKeyBuilder.java =================================================================== --- branches/LEXICON_REFACTOR_BRANCH/bigdata/src/test/com/bigdata/btree/keys/TestKeyBuilder.java 2010-07-21 15:00:16 UTC (rev 3258) +++ branches/LEXICON_REFACTOR_BRANCH/bigdata/src/test/com/bigdata/btree/keys/TestKeyBuilder.java 2010-07-21 18:04:22 UTC (rev 3259) @@ -27,6 +27,7 @@ package com.bigdata.btree.keys; +import java.math.BigDecimal; import java.math.BigInteger; import java.util.Arrays; import java.util.Comparator; @@ -37,9 +38,7 @@ import java.util.Set; import java.util.TreeMap; import java.util.UUID; - import junit.framework.TestCase2; - import com.bigdata.btree.BytesUtil; import com.bigdata.btree.BytesUtil.UnsignedByteArrayComparator; @@ -1527,6 +1526,11 @@ } + private BigDecimal decodeBigDecimal(final byte[] key) { + + return KeyBuilder.decodeBigDecimal(0/*offset*/, key); + } + /** * FIXME The 2 byte run length limits the maximum key length for a * BigInteger to ~32k. Write unit tests which verify that we detect and @@ -1552,6 +1556,12 @@ } + private byte[] encodeBigDecimal(final BigDecimal d) { + + return new KeyBuilder().append(d).getKey(); + + } + protected void doEncodeDecodeTest(final BigInteger expected) { byte[] encoded = null; @@ -1599,6 +1609,53 @@ } + protected void doEncodeDecodeTest(final BigDecimal expected) { + + byte[] encoded = null; + BigDecimal actual = null; + Throwable cause = null; + try { + + encoded = encodeBigDecimal(expected); + + actual = decodeBigDecimal(encoded); + + } catch (Throwable t) { + + cause = t; + + } + + if (cause != null || !expected.equals(actual)) { + + final String msg = "BigDecimal" + // + "\nexpected=" + expected + // +// "\nsigned =" + Arrays.toString(expected.toByteArray())+// +// "\nunsigned=" + BytesUtil.toString(expected.toByteArray())+// + "\nencoded =" + BytesUtil.toString(encoded) + // + "\nactual =" + actual// +// +(actual != null ? "\nactualS =" +// + Arrays.toString(actual.toByteArray()) +// + // +// "\nactualU =" +// + BytesUtil.toString(actual.toByteArray()) // +// : "") + ; + + if (cause == null) { + + fail(msg); + + } else { + + fail(msg, cause); + + } + + } + + } + protected void doLTTest(final BigInteger i1, final BigInteger i2) { final byte[] k1 = encodeBigInteger(i1); @@ -1625,6 +1682,32 @@ } + protected void doLTTest(final BigDecimal i1, final BigDecimal i2) { + + final byte[] k1 = encodeBigDecimal(i1); + + final byte[] k2 = encodeBigDecimal(i2); + + final int ret = BytesUtil.compareBytes(k1, k2); + + if (ret >= 0) { + + fail("BigDecimal" + // + "\ni1=" + i1 + // + "\ni2=" + i2 + // +// "\ns1=" + Arrays.toString(i1.toByteArray())+// +// "\ns2=" + Arrays.toString(i2.toByteArray())+// +// "\nu1=" + BytesUtil.toString(i1.toByteArray())+// +// "\nu2=" + BytesUtil.toString(i2.toByteArray())+// + "\nk1=" + BytesUtil.toString(k1) + // + "\nk2=" + BytesUtil.toString(k2) + // + "\nret=" + (ret == 0 ? "EQ" : (ret < 0 ? "LT" : "GT"))// + ); + + } + + } + public void test_BigInteger_383() { final BigInteger v1 = BigInteger.valueOf(383); @@ -1633,6 +1716,14 @@ } + public void test_BigDecimal_383() { + + final BigDecimal v1 = BigDecimal.valueOf(383.0000000000000001); + final BigDecimal v2 = BigDecimal.valueOf(383.0000000000000002); + doLTTest(v1,v2); + + } + public void test_BigInteger_m1() { final BigInteger v = BigInteger.valueOf(-1); @@ -1641,6 +1732,14 @@ } + public void test_BigDecimal_m1() { + + final BigDecimal v = BigDecimal.valueOf(-1.0000000000000001); + + doEncodeDecodeTest(v); + + } + /** * Unit tests for encoding {@link BigInteger} keys. */ @@ -1705,6 +1804,65 @@ } /** + * Unit tests for encoding {@link BigDecimal} keys. + */ + public void test_bigDecimalKey() { + + doEncodeDecodeTest(BigDecimal.valueOf(0)); + + doEncodeDecodeTest(BigDecimal.valueOf(1.00000000001)); + doEncodeDecodeTest(BigDecimal.valueOf(8.00000000001)); + doEncodeDecodeTest(BigDecimal.valueOf(255.00000000001)); + doEncodeDecodeTest(BigDecimal.valueOf(256.00000000001)); + doEncodeDecodeTest(BigDecimal.valueOf(512.00000000001)); + doEncodeDecodeTest(BigDecimal.valueOf(1028.00000000001)); + + doEncodeDecodeTest(BigDecimal.valueOf(-1.00000000001)); + doEncodeDecodeTest(BigDecimal.valueOf(-8.00000000001)); + doEncodeDecodeTest(BigDecimal.valueOf(-255.00000000001)); + doEncodeDecodeTest(BigDecimal.valueOf(-256.00000000001)); + doEncodeDecodeTest(BigDecimal.valueOf(-512.00000000001)); + doEncodeDecodeTest(BigDecimal.valueOf(-1028.00000000001)); + + doEncodeDecodeTest(BigDecimal.valueOf(Double.MIN_VALUE)); + doEncodeDecodeTest(BigDecimal.valueOf(Double.MAX_VALUE)); + doEncodeDecodeTest(BigDecimal.valueOf(Double.MIN_VALUE - 1)); + doEncodeDecodeTest(BigDecimal.valueOf(Double.MAX_VALUE + 1)); + + doLTTest(BigDecimal.valueOf(1.01), BigDecimal.valueOf(2.01)); + + doLTTest(BigDecimal.valueOf(0.01), BigDecimal.valueOf(1.01)); + + doLTTest(BigDecimal.valueOf(-1.01), BigDecimal.valueOf(0.01)); + + doLTTest(BigDecimal.valueOf(-2.01), BigDecimal.valueOf(-1.01)); + + doLTTest(BigDecimal.valueOf(10.01), BigDecimal.valueOf(11.01)); + + doLTTest(BigDecimal.valueOf(258.01), BigDecimal.valueOf(259.01)); + + doLTTest(BigDecimal.valueOf(3.01), BigDecimal.valueOf(259.01)); + + doLTTest(BigDecimal.valueOf(383.01), BigDecimal.valueOf(383.02)); + + for (int i = 0; i <= 516; i++) { + + doEncodeDecodeTest(BigDecimal.valueOf(i)); + + doLTTest(BigDecimal.valueOf(i), BigDecimal.valueOf(i + 1)); + + } + for (int i = 0; i >= -516; i--) { + + doEncodeDecodeTest(BigDecimal.valueOf(i)); + + doLTTest(BigDecimal.valueOf(i), BigDecimal.valueOf(i + 1)); + + } + + } + + /** * Stress test with random <code>long</code> values. */ public void test_BigInteger_stress_long_values() { @@ -1766,6 +1924,67 @@ } /** + * Stress test with random <code>double</code> values. + */ + public void test_BigDecimal_stress_long_values() { + + final Random r = new Random(); + + for (int i = 0; i < 100000; i++) { + + final BigDecimal t1 = BigDecimal.valueOf(r.nextDouble()); + + final BigDecimal v2 = BigDecimal.valueOf(Math.abs(r.nextDouble())); + + final BigDecimal v4 = BigDecimal.valueOf(r.nextDouble()); + + // x LT t1 + final BigDecimal t2 = t1.subtract(v2); + final BigDecimal t4 = t1.subtract(BigDecimal.valueOf(5)); + final BigDecimal t5 = t1.subtract(BigDecimal.valueOf(9)); + + // t1 LT x + final BigDecimal t3 = t1.add(v2); + final BigDecimal t6 = t1.add(BigDecimal.valueOf(5)); + final BigDecimal t7 = t1.add(BigDecimal.valueOf(9)); + + doEncodeDecodeTest(t1); + doEncodeDecodeTest(t2); + doEncodeDecodeTest(t3); + doEncodeDecodeTest(t4); + doEncodeDecodeTest(t5); + doEncodeDecodeTest(t6); + doEncodeDecodeTest(t7); + + doLTTest(t2, t1); + doLTTest(t4, t1); + doLTTest(t5, t1); + + doLTTest(t1, t3); + doLTTest(t1, t6); + doLTTest(t1, t7); + + final int ret = t1.compareTo(v4); + + if (ret < 0) { + + doLTTest(t1, v4); + + } else if (ret > 0) { + + doLTTest(v4, t1); + + } else { + + // equal + + } + + } + + } + + /** * Stress test with random byte[]s from which we then construct * {@link BigInteger}s. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-07-22 14:30:01
|
Revision: 3264 http://bigdata.svn.sourceforge.net/bigdata/?rev=3264&view=rev Author: martyncutcher Date: 2010-07-22 14:29:54 +0000 (Thu, 22 Jul 2010) Log Message: ----------- Provide implementations to support BigDecimal keys Modified Paths: -------------- branches/LEXICON_REFACTOR_BRANCH/bigdata/src/java/com/bigdata/btree/keys/KeyBuilder.java branches/LEXICON_REFACTOR_BRANCH/bigdata/src/test/com/bigdata/btree/keys/TestKeyBuilder.java Modified: branches/LEXICON_REFACTOR_BRANCH/bigdata/src/java/com/bigdata/btree/keys/KeyBuilder.java =================================================================== --- branches/LEXICON_REFACTOR_BRANCH/bigdata/src/java/com/bigdata/btree/keys/KeyBuilder.java 2010-07-21 19:53:42 UTC (rev 3263) +++ branches/LEXICON_REFACTOR_BRANCH/bigdata/src/java/com/bigdata/btree/keys/KeyBuilder.java 2010-07-22 14:29:54 UTC (rev 3264) @@ -945,10 +945,44 @@ } - // FIXME append(BigDecimal) + // The encoding ot a BigDecimal requires the expression + // of scale and length + // BigDecimal.scale indicates the precision of the number, where + // '3' is three decimal places and '-3' rounded to '000' + // BigDecimal.precision() is the number of unscaled digits + // therefore the precision - scale is an expression of the + // exponent of the normalised number. + // This means that the exponent could be zero or negative so the sign of the + // number cannot be indicated by adding to the exponent. + // Instead an explicit sign byte,'0' or '1' is used. + // The actual BigDecimal serialization uses the String conversions + // supported by BigDecimal, less the '-' sign character if applicable. + // The length of this data is terminated by a zero byte. + // + // The variable encoding of BigNumbers requires this String representation + // and negative representations are further encoded using flipDigits + // for the equivalent of 2s compliment negative representation. + public KeyBuilder append(final BigDecimal d) { -// throw new UnsupportedOperationException(); - return append(d.doubleValue()); + int sign = d.signum(); + int precision = d.precision(); + int scale = d.scale(); + int exponent = precision - scale; + if (sign == -1) { + exponent = -exponent; + } + + append((byte) sign); + append(exponent); + + String unscaledStr = d.unscaledValue().toString(); + if (sign == -1) { + unscaledStr = flipDigits(unscaledStr); + } + appendASCII(unscaledStr); // the unscaled BigInteger representation + append((byte) 0); + + return this; } /* @@ -1386,13 +1420,55 @@ } + static final byte eos = decodeByte(0); + static final byte negSign = decodeByte(-1); + // FIXME decodeBigDecimal(int, byte[]) static public BigDecimal decodeBigDecimal(final int offset, final byte[] key) { -// throw new UnsupportedOperationException(); - final double d = decodeDouble(key, offset); - return new BigDecimal(d); + int curs = offset; + byte sign = key[curs++]; + int exponent = decodeInt(key, curs); + boolean neg = sign == negSign; + if (neg) { + exponent = -exponent; + } + curs += 4; + int len = 0; + for (int i = curs; key[i] != eos; i++) len++; + String unscaledStr = decodeASCII(key, curs, len); + if (neg) { + unscaledStr = flipDigits(unscaledStr); + } + + BigInteger unscaled = new BigInteger(unscaledStr); + + int precision = len; + int scale = precision - exponent - (neg ? 1 : 0); + + BigDecimal ret = new BigDecimal(unscaled, scale); + + return ret; // relative scale adjustment } + static final char[] flipMap = {'0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + }; + + /* + * Flip numbers such that 0/9,1/8,2/7,3/6,4/5 + */ + static private String flipDigits(String str) { + char[] chrs = str.toCharArray(); + for (int i = 0; i < chrs.length; i++) { + int flip = '9' - chrs[i]; + if (flip >= 0 && flip < 10) { + chrs[i] = flipMap[flip]; + } + } + + return new String(chrs); + } + public static IKeyBuilder newInstance() { return newInstance(DEFAULT_INITIAL_CAPACITY); Modified: branches/LEXICON_REFACTOR_BRANCH/bigdata/src/test/com/bigdata/btree/keys/TestKeyBuilder.java =================================================================== --- branches/LEXICON_REFACTOR_BRANCH/bigdata/src/test/com/bigdata/btree/keys/TestKeyBuilder.java 2010-07-21 19:53:42 UTC (rev 3263) +++ branches/LEXICON_REFACTOR_BRANCH/bigdata/src/test/com/bigdata/btree/keys/TestKeyBuilder.java 2010-07-22 14:29:54 UTC (rev 3264) @@ -1718,8 +1718,8 @@ public void test_BigDecimal_383() { - final BigDecimal v1 = BigDecimal.valueOf(383.0000000000000001); - final BigDecimal v2 = BigDecimal.valueOf(383.0000000000000002); + final BigDecimal v1 = new BigDecimal("383.00000000000001"); + final BigDecimal v2 = new BigDecimal("383.00000000000002"); doLTTest(v1,v2); } @@ -1734,7 +1734,7 @@ public void test_BigDecimal_m1() { - final BigDecimal v = BigDecimal.valueOf(-1.0000000000000001); + final BigDecimal v = BigDecimal.valueOf(-1.00000000001); doEncodeDecodeTest(v); @@ -1810,19 +1810,23 @@ doEncodeDecodeTest(BigDecimal.valueOf(0)); - doEncodeDecodeTest(BigDecimal.valueOf(1.00000000001)); - doEncodeDecodeTest(BigDecimal.valueOf(8.00000000001)); - doEncodeDecodeTest(BigDecimal.valueOf(255.00000000001)); - doEncodeDecodeTest(BigDecimal.valueOf(256.00000000001)); - doEncodeDecodeTest(BigDecimal.valueOf(512.00000000001)); - doEncodeDecodeTest(BigDecimal.valueOf(1028.00000000001)); + doEncodeDecodeTest(BigDecimal.valueOf(-123450)); + doEncodeDecodeTest(BigDecimal.valueOf(-99)); + doEncodeDecodeTest(BigDecimal.valueOf(-9)); + + doEncodeDecodeTest(BigDecimal.valueOf(1.001)); + doEncodeDecodeTest(BigDecimal.valueOf(8.0001)); + doEncodeDecodeTest(BigDecimal.valueOf(255.0001)); + doEncodeDecodeTest(BigDecimal.valueOf(256.0001)); + doEncodeDecodeTest(BigDecimal.valueOf(512.0001)); + doEncodeDecodeTest(BigDecimal.valueOf(1028.001)); - doEncodeDecodeTest(BigDecimal.valueOf(-1.00000000001)); - doEncodeDecodeTest(BigDecimal.valueOf(-8.00000000001)); - doEncodeDecodeTest(BigDecimal.valueOf(-255.00000000001)); - doEncodeDecodeTest(BigDecimal.valueOf(-256.00000000001)); - doEncodeDecodeTest(BigDecimal.valueOf(-512.00000000001)); - doEncodeDecodeTest(BigDecimal.valueOf(-1028.00000000001)); + doEncodeDecodeTest(BigDecimal.valueOf(-1.0001)); + doEncodeDecodeTest(BigDecimal.valueOf(-8.0001)); + doEncodeDecodeTest(BigDecimal.valueOf(-255.0001)); + doEncodeDecodeTest(BigDecimal.valueOf(-256.0001)); + doEncodeDecodeTest(BigDecimal.valueOf(-512.0001)); + doEncodeDecodeTest(BigDecimal.valueOf(-1028.001)); doEncodeDecodeTest(BigDecimal.valueOf(Double.MIN_VALUE)); doEncodeDecodeTest(BigDecimal.valueOf(Double.MAX_VALUE)); @@ -1926,7 +1930,7 @@ /** * Stress test with random <code>double</code> values. */ - public void test_BigDecimal_stress_long_values() { + public void test_BigDecimal_stress_double_values() { final Random r = new Random(); @@ -2059,7 +2063,88 @@ } } + /** + * Stress test with random byte[]s from which we then construct + * {@link BigDecimal}s. + * + * FIXME: At present the comparisons fail proably due to a failure to + * understand the limits of the BigDecimal representations - so this + * test has been deactivated by name prefix. + */ + public void badTest_BigDecimal_stress_byteArray_values() { + + final Random r = new Random(); + + final int maxlen = 64; + + for (int i = 0; i < 100000; i++) { + final int len1 = r.nextInt(maxlen) + 1; + + final int len2 = r.nextInt(maxlen) + 1; + + final byte[] b1 = new byte[len1]; + + final byte[] b2 = new byte[len2]; + + r.nextBytes(b1); + + r.nextBytes(b2); + + // final BigDecimal t1 = new BigDecimal(new BigInteger(b1), -100 + r.nextInt(200)); + final BigDecimal t1 = new BigDecimal(new BigInteger(b1)); + + final BigDecimal v2 = BigDecimal.valueOf(Math.abs(r.nextDouble())); + + // final BigDecimal v4 = new BigDecimal(new BigInteger(b2), -100 + r.nextInt(200)); + final BigDecimal v4 = new BigDecimal(new BigInteger(b2)); + + // x LT t1 + final BigDecimal t2 = t1.subtract(v2); + final BigDecimal t4 = t1.subtract(BigDecimal.valueOf(5)); + final BigDecimal t5 = t1.subtract(BigDecimal.valueOf(9)); + + // t1 LT x + final BigDecimal t3 = t1.add(v2); + final BigDecimal t6 = t1.add(BigDecimal.valueOf(5)); + final BigDecimal t7 = t1.add(BigDecimal.valueOf(9)); + + doEncodeDecodeTest(t1); + doEncodeDecodeTest(t2); + doEncodeDecodeTest(t3); + doEncodeDecodeTest(t4); + doEncodeDecodeTest(t5); + doEncodeDecodeTest(t6); + doEncodeDecodeTest(t7); + + doLTTest(t2, t1); + doLTTest(t4, t1); + doLTTest(t5, t1); + + doLTTest(t1, t3); + doLTTest(t1, t6); + doLTTest(t1, t7); + + final int ret = t1.compareTo(v4); + + if (ret < 0) { + + doLTTest(t1, v4); + + } else if (ret > 0) { + + doLTTest(v4, t1); + + } else { + + // equal + + } + + } + + } + // /* // * BigDecimal (w/o precision). // */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-07-27 08:57:54
|
Revision: 3303 http://bigdata.svn.sourceforge.net/bigdata/?rev=3303&view=rev Author: martyncutcher Date: 2010-07-27 08:57:48 +0000 (Tue, 27 Jul 2010) Log Message: ----------- It seems that we have finally solved the problem of representing the value of zero with the sign byte. This finesses all the problems of special case precision and scale that seemed so complicated. Modified Paths: -------------- branches/LEXICON_REFACTOR_BRANCH/bigdata/src/java/com/bigdata/btree/keys/KeyBuilder.java branches/LEXICON_REFACTOR_BRANCH/bigdata/src/test/com/bigdata/btree/keys/TestKeyBuilder.java Modified: branches/LEXICON_REFACTOR_BRANCH/bigdata/src/java/com/bigdata/btree/keys/KeyBuilder.java =================================================================== --- branches/LEXICON_REFACTOR_BRANCH/bigdata/src/java/com/bigdata/btree/keys/KeyBuilder.java 2010-07-26 21:58:56 UTC (rev 3302) +++ branches/LEXICON_REFACTOR_BRANCH/bigdata/src/java/com/bigdata/btree/keys/KeyBuilder.java 2010-07-27 08:57:48 UTC (rev 3303) @@ -1000,21 +1000,19 @@ public KeyBuilder append(final BigDecimal d) { final int sign = d.signum(); + if (sign == 0) { + append((byte) 0); + + return this; + } + BigDecimal nd = d.stripTrailingZeros(); String unscaledStr = nd.unscaledValue().toString(); - final int precision; - final int scale; + final int precision = nd.precision(); + final int scale = nd.scale(); - if ("0".equals(unscaledStr)) { - precision = 1; - scale = Integer.MAX_VALUE; - } else { - precision = nd.precision(); - scale = nd.scale(); - } - int exponent = precision - scale; if (sign == -1) { exponent = -exponent; @@ -1046,18 +1044,25 @@ */ static public int byteLength(final BigDecimal value) { - // FIXME Make sure to normalize trailing zeros first if necessary. - final int dataLen = value.unscaledValue().toString().length(); + final int byteLength; - final int byteLength = + if (value.signum() == 0) { + byteLength = 1; + } else { + final BigDecimal nbd = value.stripTrailingZeros(); + + final int dataLen = nbd.unscaledValue().toString().length(); + + byteLength = + 1 /* sign */ + 4 /* exponent */ + dataLen /* data */ + 1 /* termination byte */ ; - + } + return byteLength; - + } /* @@ -1522,6 +1527,11 @@ static public BigDecimal decodeBigDecimal(final int offset, final byte[] key) { int curs = offset; final byte sign = key[curs++]; + + if (sign == decodeZero) { + return new BigDecimal(0); + } + int exponent = decodeInt(key, curs); final boolean neg = sign == negSign; if (neg) { @@ -1538,14 +1548,15 @@ final BigInteger unscaled = new BigInteger(unscaledStr); final int precision = len; - final int scale = precision - exponent - (neg ? 1 : 0); + final int scale = precision - exponent - (neg ? 1 : 0); final BigDecimal ret = new BigDecimal(unscaled, scale); return ret; // relative scale adjustment } - private static final byte eos = decodeByte(0); + private static final byte decodeZero = decodeByte(0); + private static final byte eos = decodeZero; private static final byte eos2 = decodeByte(Byte.MAX_VALUE); private static final byte negSign = decodeByte(-1); Modified: branches/LEXICON_REFACTOR_BRANCH/bigdata/src/test/com/bigdata/btree/keys/TestKeyBuilder.java =================================================================== --- branches/LEXICON_REFACTOR_BRANCH/bigdata/src/test/com/bigdata/btree/keys/TestKeyBuilder.java 2010-07-26 21:58:56 UTC (rev 3302) +++ branches/LEXICON_REFACTOR_BRANCH/bigdata/src/test/com/bigdata/btree/keys/TestKeyBuilder.java 2010-07-27 08:57:48 UTC (rev 3303) @@ -1789,18 +1789,19 @@ final BigDecimal m500 = new BigDecimal("00500"); final BigDecimal m5003 = new BigDecimal("500.000"); - doLTTest(z1, p1); - doLTTest(negp1, z1); - doLTTest(negp1, p1); - doEQTest(z1, negz1); - doEncodeDecodeTest(m5); + doEncodeDecodeTest(negz1); doEncodeDecodeTest(z1); doEncodeDecodeTest(z2); doEncodeDecodeTest(z3); doEncodeDecodeTest(m1); doEncodeDecodeTest(m2); + doLTTest(z1, p1); + doLTTest(negp1, z1); + doLTTest(negp1, p1); + doEQTest(z1, negz1); + doEQTest(m5, m53); doEQTest(m500, m5003); doEQTest(z3, z2); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |