Skip to content

Commit 5ef82e7

Browse files
committed
Scala 2.13 support
1 parent 37429da commit 5ef82e7

File tree

8 files changed

+16
-15
lines changed

8 files changed

+16
-15
lines changed

Diff for: .scalafmt.conf

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
version = "2.0.0-RC8"
12
maxColumn = 120
23
style = default
34
align.openParenCallSite = true

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ My library implements three Perceptual Hashing algorithms: Radial Hash, DCT hash
1313
#### sbt dependencies
1414

1515
```scala
16-
libraryDependencies += "com.github.poslegm" %% "scala-phash" % "1.2.1"
16+
libraryDependencies += "com.github.poslegm" %% "scala-phash" % "1.2.2"
1717
```
1818

1919
#### API

Diff for: build.sbt

+5-6
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ name := "scala-phash"
22

33
organization := "com.github.poslegm"
44

5-
version := "1.2.1"
5+
version := "1.2.2"
66

7-
scalaVersion := "2.12.8"
8-
crossScalaVersions := Seq("2.11.8", "2.12.1", scalaVersion.value)
7+
scalaVersion := "2.13.0"
8+
crossScalaVersions := Seq("2.11.8", "2.12.8", scalaVersion.value)
99

1010
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
1111

1212
libraryDependencies ++= Seq(
13-
"org.scalactic" %% "scalactic" % "3.0.1",
14-
"org.scalatest" %% "scalatest" % "3.0.1" % "test",
13+
"org.scalactic" %% "scalactic" % "3.0.8",
14+
"org.scalatest" %% "scalatest" % "3.0.8" % "test",
1515
"com.jhlabs" % "filters" % "2.0.235-1"
1616
)
1717

@@ -21,7 +21,6 @@ scalacOptions ++= Seq(
2121
"-feature",
2222
"-language:higherKinds",
2323
"-Xfatal-warnings",
24-
"-Ypartial-unification",
2524
"-Ywarn-unused"
2625
)
2726

Diff for: project/build.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version = 1.2.1
1+
sbt.version = 1.2.8

Diff for: src/main/scala/scalaphash/PhashInternal.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import scalaphash.PHash._
77

88
import scala.annotation.tailrec
99
import scala.collection.mutable.ArrayBuffer
10+
import scala.math.Ordering.Float.TotalOrdering
1011

1112
private[scalaphash] object PHashInternal {
1213
private lazy val dctMatrix = createDctMatrix(32)
@@ -203,7 +204,7 @@ private[scalaphash] object PHashInternal {
203204
}
204205
}
205206

206-
private def findMedian(floats: Seq[Float]): Float = floats match {
207+
private def findMedian(floats: Array[Float]): Float = floats match {
207208
case xs if xs.length % 2 == 0 =>
208209
val tail = xs.sorted.drop(xs.length / 2 - 1)
209210
(tail.head + tail.tail.head) / 2.0f

Diff for: src/test/scala/com/github/poslegm/scalaphash/DCTHashTest.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class DCTHashTest extends FlatSpec with Matchers with PrivateMethodTester {
1717
Array(0.408248, -0.557678, 0.5, -0.408248, 0.288675, -0.149429)
1818
).map(_.map(_.toFloat))
1919

20-
val createDctMatrix = PrivateMethod[Array[Array[Float]]]('createDctMatrix)
20+
val createDctMatrix = PrivateMethod[Array[Array[Float]]](Symbol("createDctMatrix"))
2121
val matrix = PHashInternal invokePrivate createDctMatrix(6)
2222
matrix.length shouldEqual canonical.length
2323
matrix(0).length shouldEqual canonical(0).length

Diff for: src/test/scala/com/github/poslegm/scalaphash/MarrHashTest.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class MarrHashTest extends FlatSpec with Matchers with PrivateMethodTester {
2424
-3.37606e-06)
2525
).map(_.map(_.toFloat))
2626

27-
val createMarrKernel = PrivateMethod[Array[Array[Float]]]('createMarrKernel)
27+
val createMarrKernel = PrivateMethod[Array[Array[Float]]](Symbol("createMarrKernel"))
2828
val matrix = PHashInternal invokePrivate createMarrKernel(1, 1)
2929
matrix.length shouldEqual canonical.length
3030
matrix.indices.foreach(i => matrix(i).length shouldEqual canonical(i).length)
@@ -72,7 +72,7 @@ class MarrHashTest extends FlatSpec with Matchers with PrivateMethodTester {
7272
(for {
7373
aMarrHash <- PHash.marrHash(a)
7474
bMarrHash <- PHash.marrHash(b)
75-
} yield PHash.marrHashDistance(aMarrHash, bMarrHash).map(_.toFloat ~= 0.484375F)) shouldEqual Right(Some(true))
75+
} yield PHash.marrHashDistance(aMarrHash, bMarrHash).map(_.toFloat ~= 0.484375f)) shouldEqual Right(Some(true))
7676
}
7777

7878
"Marr hashes" should "compare dog and cat" in {

Diff for: src/test/scala/com/github/poslegm/scalaphash/RadialHashTest.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ class RadialHashTest extends FlatSpec with Matchers with PrivateMethodTester {
1111

1212
val example2RadialHash = PHash.radialHash(bag)
1313

14-
example2RadialHash.right.get shouldEqual Array(193, 190, 0, 204, 92, 209, 183, 165, 254, 211, 188, 209, 182, 185,
15-
176, 203, 182, 178, 190, 196, 187, 192, 197, 193, 192, 199, 200, 189, 186, 195, 191, 192, 198, 191, 192, 192, 195,
16-
195, 192, 194)
14+
example2RadialHash.getOrElse(Array.empty) shouldEqual Array(193, 190, 0, 204, 92, 209, 183, 165, 254, 211, 188, 209,
15+
182, 185, 176, 203, 182, 178, 190, 196, 187, 192, 197, 193, 192, 199, 200, 189, 186, 195, 191, 192, 198, 191, 192,
16+
192, 195, 195, 192, 194)
1717
}
1818

1919
"Radial hash" should "compare not equal" in {

0 commit comments

Comments
 (0)