fix silly test bugs (thanks selckin!)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1136357 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2011-06-16 10:15:20 +00:00
parent aa6966782f
commit 38b838b25a
2 changed files with 9 additions and 9 deletions

View File

@ -502,12 +502,12 @@ public class TestNRTManager extends LuceneTestCase {
int seenTermCount = 0; int seenTermCount = 0;
int shift; int shift;
int trigger; int trigger;
if (totTermCount.get() == 0) { if (totTermCount.get() < 10) {
shift = 0; shift = 0;
trigger = 1; trigger = 1;
} else { } else {
shift = random.nextInt(totTermCount.get()/10);
trigger = totTermCount.get()/10; trigger = totTermCount.get()/10;
shift = random.nextInt(trigger);
} }
while(System.currentTimeMillis() < stopTime) { while(System.currentTimeMillis() < stopTime) {
@ -518,13 +518,13 @@ public class TestNRTManager extends LuceneTestCase {
} }
totTermCount.set(seenTermCount); totTermCount.set(seenTermCount);
seenTermCount = 0; seenTermCount = 0;
if (totTermCount.get() == 0) { if (totTermCount.get() < 10) {
shift = 0; shift = 0;
trigger = 1; trigger = 1;
} else { } else {
trigger = totTermCount.get()/10; trigger = totTermCount.get()/10;
//System.out.println("trigger " + trigger); //System.out.println("trigger " + trigger);
shift = random.nextInt(totTermCount.get()/10); shift = random.nextInt(trigger);
} }
termsEnum.seek(new BytesRef("")); termsEnum.seek(new BytesRef(""));
continue; continue;

View File

@ -411,24 +411,24 @@ public class TestNRTThreads extends LuceneTestCase {
int seenTermCount = 0; int seenTermCount = 0;
int shift; int shift;
int trigger; int trigger;
if (totTermCount.get() == 0) { if (totTermCount.get() < 10) {
shift = 0; shift = 0;
trigger = 1; trigger = 1;
} else { } else {
shift = random.nextInt(totTermCount.get()/10);
trigger = totTermCount.get()/10; trigger = totTermCount.get()/10;
shift = random.nextInt(trigger);
} }
while(System.currentTimeMillis() < searchStopTime) { while(System.currentTimeMillis() < searchStopTime) {
BytesRef term = termsEnum.next(); BytesRef term = termsEnum.next();
if (term == null) { if (term == null) {
if (seenTermCount == 0) { if (seenTermCount < 10) {
break; break;
} }
totTermCount.set(seenTermCount); totTermCount.set(seenTermCount);
seenTermCount = 0; seenTermCount = 0;
trigger = totTermCount.get()/10; trigger = totTermCount.get()/10;
//System.out.println("trigger " + trigger); //System.out.println("trigger " + trigger);
shift = random.nextInt(totTermCount.get()/10); shift = random.nextInt(trigger);
termsEnum.seek(new BytesRef("")); termsEnum.seek(new BytesRef(""));
continue; continue;
} }