提交 deed1585 authored 作者: Thomas Mueller's avatar Thomas Mueller

spaces instead of tabs

上级 39c7c431
/* /*
* Copyright 2004-2009 H2 Group. Multiple-Licensed under the H2 License, * Copyright 2004-2009 H2 Group. Multiple-Licensed under the H2 License, Version
* Version 1.0, and under the Eclipse Public License, Version 1.0 * 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html). * (http://h2database.com/html/license.html). Initial Developer: H2 Group
* Initial Developer: H2 Group
*/ */
package org.h2.test.unit; package org.h2.test.unit;
import java.util.BitSet; import java.util.BitSet;
import java.util.Random; import java.util.Random;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.util.BitField; import org.h2.util.BitField;
...@@ -151,21 +149,21 @@ public class TestBitField extends TestBase { ...@@ -151,21 +149,21 @@ public class TestBitField extends TestBase {
} }
} }
private void testRandomSetRange(){ private void testRandomSetRange() {
BitField bits = new BitField(); BitField bits = new BitField();
BitSet set = new BitSet(); BitSet set = new BitSet();
Random random = new Random(1); Random random = new Random(1);
int maxoff = 500; int maxoff = 500;
int maxlen = 500; int maxlen = 500;
int total = maxoff+maxlen; int total = maxoff + maxlen;
int count = 10000; int count = 10000;
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
int offset = random.nextInt(maxoff); int offset = random.nextInt(maxoff);
int len = random.nextInt(maxlen); int len = random.nextInt(maxlen);
boolean val = random.nextBoolean(); boolean val = random.nextBoolean();
set.set(offset,offset+len,val); set.set(offset, offset + len, val);
bits.setRange(offset,len,val); bits.setRange(offset, len, val);
for(int j=0; j<total; j++){ for (int j = 0; j < total; j++) {
assertEquals(bits.get(j), set.get(j)); assertEquals(bits.get(j), set.get(j));
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论