Browse Source
Fixed broken unit test. Added some properties and functions. Added a timing trait and benchmarking to DHash tests
master
Fixed broken unit test. Added some properties and functions. Added a timing trait and benchmarking to DHash tests
master
Drew Short
11 years ago
18 changed files with 269 additions and 44 deletions
-
2.gitignore
-
15src/includes/log4j.properties
-
BINsrc/includes/sample/sample_01_medium.jpg
-
BINsrc/includes/sample/sample_01_small.jpg
-
5src/main/java/com/sothr/imagetools/App.java
-
2src/main/java/com/sothr/imagetools/AppCLI.java
-
55src/main/java/com/sothr/imagetools/AppConfig.java
-
6src/main/resources/default.properties
-
8src/main/scala/com/sothr/imagetools/hash/DHash.scala
-
6src/main/scala/com/sothr/imagetools/hash/HashService.scala
-
68src/main/scala/com/sothr/imagetools/image/ImageService.scala
-
5src/main/scala/com/sothr/imagetools/util/PropertiesEnum.scala
-
13src/main/scala/com/sothr/imagetools/util/PropertiesService.scala
-
31src/main/scala/com/sothr/imagetools/util/Timing.scala
-
6src/test/resources/default.properties
-
7src/test/scala/com/sothr/imagetools/BaseTest.scala
-
7src/test/scala/com/sothr/imagetools/TestParams.scala
-
69src/test/scala/com/sothr/imagetools/hash/HashServiceTest.scala
After Width: 1824 | Height: 1368 | Size: 1.5 MiB |
After Width: 912 | Height: 684 | Size: 519 KiB |
@ -0,0 +1,31 @@ |
|||||
|
package com.sothr.imagetools.util |
||||
|
|
||||
|
import grizzled.slf4j.Logging |
||||
|
|
||||
|
trait Timing extends Logging{ |
||||
|
|
||||
|
def time[R](block: => R): R = { |
||||
|
val t0 = System.currentTimeMillis |
||||
|
val result = block // call-by-name |
||||
|
val t1 = System.currentTimeMillis |
||||
|
info("Elapsed time: " + (t1 - t0) + "ms") |
||||
|
result |
||||
|
} |
||||
|
|
||||
|
def getTime[R](block: => R):Long = { |
||||
|
val t0 = System.currentTimeMillis |
||||
|
val result = block // call-by-name |
||||
|
val t1 = System.currentTimeMillis |
||||
|
info("Elapsed time: " + (t1 - t0) + "ms") |
||||
|
(t1 - t0) |
||||
|
} |
||||
|
|
||||
|
def getMean(times:Long*):Long = { |
||||
|
var ag = 0L |
||||
|
for (i <- times.indices) { |
||||
|
ag += times(i) |
||||
|
} |
||||
|
(ag / times.length) |
||||
|
} |
||||
|
|
||||
|
} |
@ -1,12 +1,13 @@ |
|||||
package com.sothr.imagetools |
package com.sothr.imagetools |
||||
|
|
||||
|
import grizzled.slf4j.Logging |
||||
|
import com.sothr.imagetools.util.Timing |
||||
import org.scalatest.{FunSuite,Matchers,OptionValues,Inside,Inspectors,BeforeAndAfter} |
import org.scalatest.{FunSuite,Matchers,OptionValues,Inside,Inspectors,BeforeAndAfter} |
||||
|
|
||||
abstract class BaseTest extends FunSuite with Matchers with OptionValues with Inside with Inspectors with BeforeAndAfter { |
|
||||
|
abstract class BaseTest extends FunSuite with Matchers with OptionValues with Inside with Inspectors with BeforeAndAfter with Logging with Timing { |
||||
|
|
||||
before { |
before { |
||||
AppConfig.configLogging() |
|
||||
AppConfig.loadProperties() |
|
||||
|
AppConfig.configureApp() |
||||
} |
} |
||||
|
|
||||
} |
} |
@ -0,0 +1,7 @@ |
|||||
|
package com.sothr.imagetools |
||||
|
|
||||
|
object TestParams { |
||||
|
val LargeSampleImage1 = "target/sample/sample_01_large.jpg" |
||||
|
val MediumSampleImage1 = "target/sample/sample_01_medium.jpg" |
||||
|
val SmallSampleImage1 = "target/sample/sample_01_small.jpg" |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue