Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 455b0df

Browse files
committed
Try fix CI
1 parent 57d6ce4 commit 455b0df

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/library/scala/util/hashing/MurmurHash3.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,10 @@ private[hashing] class MurmurHash3 {
289289
initial = hash
290290
rangeState = 1
291291
case 1 =>
292-
rangeDiff = hash - prev
292+
rangeState = 2
293293
rangeState = if (rangeDiff == 0) 3 else 2
294294
case 2 =>
295-
if(rangeDiff != hash - prev) rangeState = 3
295+
if(rangeDiff != hash - prev || rangeDiff == 0) rangeState = 3
296296
case _ =>
297297
}
298298
prev = hash

test/junit/scala/util/hashing/MurmurHash3Test.scala

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,13 @@ class MurmurHash3Test {
5959

6060
@Test
6161
def testEqualArray(): Unit = {
62-
val z1 = (1 to 2).map(_ => 0).toArray
63-
val z2 = (1 to 5).map(_ => 0).toArray
64-
check(z1.hashCode, z1)
65-
check(z2.hashCode, z2)
66-
assertNotEquals(z1.hashCode, z2.hashCode)
62+
val z1 = (1 to 1).map(_ => 0).toArray
63+
val z2 = (1 to 2).map(_ => 0).toArray
64+
val z3 = (1 to 3).map(_ => 0).toArray
65+
val z4 = (1 to 4).map(_ => 0).toArray
66+
Seq(z1, z2, z3, z4).foreach(z => check(z.toIndexedSeq.hashCode(), z))
67+
Seq(z1, z2, z3, z4).sliding(2).foreach{ case Seq(a, b) =>
68+
assertNotEquals(a.toIndexedSeq.hashCode(), b.toIndexedSeq.hashCode())
69+
}
6770
}
6871
}

0 commit comments

Comments
 (0)