Skip to content

Commit f6b0103

Browse files
committed
shorten test_surf
1 parent 875a506 commit f6b0103

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

test/unitTest/test_surf.cpp

+19-21
Original file line numberDiff line numberDiff line change
@@ -539,30 +539,28 @@ TEST_F (SuRFUnitTest, lookupRangeWordTest) {
539539
}
540540

541541
TEST_F (SuRFUnitTest, lookupRangeIntTest) {
542-
for (int t = 0; t < kNumSuffixType; t++) {
543-
for (int k = 0; k < kNumSuffixLen; k++) {
544-
newSuRFInts(kSuffixTypeList[t], kSuffixLenList[k]);
545-
for (uint64_t i = 0; i < kIntTestBound; i++) {
546-
bool exist = surf_->lookupRange(uint64ToString(i), true,
547-
uint64ToString(i), true);
548-
if (i % kIntTestSkip == 0)
542+
for (int k = 0; k < kNumSuffixLen; k++) {
543+
newSuRFInts(kMixed, kSuffixLenList[k]);
544+
for (uint64_t i = 0; i < kIntTestBound; i++) {
545+
bool exist = surf_->lookupRange(uint64ToString(i), true,
546+
uint64ToString(i), true);
547+
if (i % kIntTestSkip == 0)
548+
ASSERT_TRUE(exist);
549+
else
550+
ASSERT_FALSE(exist);
551+
552+
for (unsigned j = 1; j < kIntTestSkip + 2; j++) {
553+
exist = surf_->lookupRange(uint64ToString(i), false,
554+
uint64ToString(i + j), true);
555+
uint64_t left_bound_interval_id = i / kIntTestSkip;
556+
uint64_t right_bound_interval_id = (i + j) / kIntTestSkip;
557+
if ((i % kIntTestSkip == 0)
558+
|| ((i < kIntTestBound - 1)
559+
&& ((left_bound_interval_id < right_bound_interval_id)
560+
|| ((i + j) % kIntTestSkip == 0))))
549561
ASSERT_TRUE(exist);
550562
else
551563
ASSERT_FALSE(exist);
552-
553-
for (unsigned j = 1; j < kIntTestSkip + 2; j++) {
554-
exist = surf_->lookupRange(uint64ToString(i), false,
555-
uint64ToString(i + j), true);
556-
uint64_t left_bound_interval_id = i / kIntTestSkip;
557-
uint64_t right_bound_interval_id = (i + j) / kIntTestSkip;
558-
if ((i % kIntTestSkip == 0)
559-
|| ((i < kIntTestBound - 1)
560-
&& ((left_bound_interval_id < right_bound_interval_id)
561-
|| ((i + j) % kIntTestSkip == 0))))
562-
ASSERT_TRUE(exist);
563-
else
564-
ASSERT_FALSE(exist);
565-
}
566564
}
567565
}
568566
}

0 commit comments

Comments
 (0)