Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Upgrade sbt, specs, add a build.properties, and bump travis's target

  • Loading branch information...
commit 833c64330874b4edcb2eb551961ff552e283b60f 1 parent d05247e
@ianoc ianoc authored
Showing with 54 additions and 48 deletions.
  1. +1 −1  .travis.yml
  2. +6 −3 algebird-test/src/test/scala/com/twitter/algebird/AbstractAlgebraTest.scala
  3. +2 −2 algebird-test/src/test/scala/com/twitter/algebird/ApproximateTest.scala
  4. +2 −2 algebird-test/src/test/scala/com/twitter/algebird/BloomFilterTest.scala
  5. +2 −2 algebird-test/src/test/scala/com/twitter/algebird/CountMinSketchTest.scala
  6. +1 −1  algebird-test/src/test/scala/com/twitter/algebird/EventuallyTest.scala
  7. +2 −2 algebird-test/src/test/scala/com/twitter/algebird/HyperLogLogTest.scala
  8. +1 −1  algebird-test/src/test/scala/com/twitter/algebird/MinHasherTest.scala
  9. +1 −1  algebird-test/src/test/scala/com/twitter/algebird/MinMaxAggregatorTest.scala
  10. +12 −12 algebird-test/src/test/scala/com/twitter/algebird/MomentsGroupTest.scala
  11. +4 −4 algebird-test/src/test/scala/com/twitter/algebird/MonadFoldMTest.scala
  12. +2 −2 algebird-test/src/test/scala/com/twitter/algebird/OperatorTest.scala
  13. +1 −1  algebird-test/src/test/scala/com/twitter/algebird/QTreeTest.scala
  14. +1 −1  algebird-test/src/test/scala/com/twitter/algebird/SGDTest.scala
  15. +2 −2 algebird-test/src/test/scala/com/twitter/algebird/SketchMapTest.scala
  16. +1 −1  algebird-test/src/test/scala/com/twitter/algebird/TopKTests.scala
  17. +1 −1  algebird-test/src/test/scala/com/twitter/algebird/TupleAggregatorsTest.scala
  18. +9 −5 project/Build.scala
  19. +1 −0  project/build.properties
  20. +2 −4 project/plugins.sbt
View
2  .travis.yml
@@ -1,4 +1,4 @@
language: scala
scala:
- 2.9.3
- - 2.10.0
+ - 2.10.3
View
9 algebird-test/src/test/scala/com/twitter/algebird/AbstractAlgebraTest.scala
@@ -1,13 +1,16 @@
package com.twitter.algebird
-import org.specs._
+import org.specs2.mutable._
+import org.scalacheck._
+import org.specs2.ScalaCheck
+import org.scalacheck.Prop
import com.twitter.algebird.BaseProperties._
import org.scalacheck.Arbitrary
import org.scalacheck.Gen
import scala.Some
class AbstractAlgebraTest extends Specification with ScalaCheck {
- noDetailedDiffs()
+
"A Monoid should be able to sum" in {
val monoid = implicitly[Monoid[Int]]
val list = List(1,5,6,6,4,5)
@@ -77,6 +80,6 @@ class AbstractAlgebraTest extends Specification with ScalaCheck {
} yield Metrics(count, largest)
}
- commutativeMonoidLaws[Metrics] must pass
+ Prop.all(commutativeMonoidLaws[Metrics])
}
}
View
4 algebird-test/src/test/scala/com/twitter/algebird/ApproximateTest.scala
@@ -1,6 +1,6 @@
package com.twitter.algebird
-import org.specs._
+import org.specs2.mutable._
import org.scalacheck.Arbitrary
import org.scalacheck.Arbitrary.arbitrary
@@ -77,7 +77,7 @@ object ApproximateLaws extends Properties("Approximate") {
}
class ApproximateTest extends Specification {
- noDetailedDiffs()
+
"Approximate" should {
"Correctly identify exact" in {
View
4 algebird-test/src/test/scala/com/twitter/algebird/BloomFilterTest.scala
@@ -1,6 +1,6 @@
package com.twitter.algebird
-import org.specs._
+import org.specs2.mutable._
import org.scalacheck.Arbitrary
import org.scalacheck.Arbitrary.arbitrary
@@ -26,7 +26,7 @@ object BloomFilterLaws extends Properties("BloomFilter") {
class BloomFilterTest extends Specification {
- noDetailedDiffs()
+
val SEED = 1
val RAND = new scala.util.Random
View
4 algebird-test/src/test/scala/com/twitter/algebird/CountMinSketchTest.scala
@@ -1,6 +1,6 @@
package com.twitter.algebird
-import org.specs._
+import org.specs2.mutable._
import org.scalacheck.Arbitrary
import org.scalacheck.Arbitrary.arbitrary
@@ -25,7 +25,7 @@ object CountMinSketchLaws extends Properties("CountMinSketch") {
}
class CountMinSketchTest extends Specification {
- noDetailedDiffs()
+
val DELTA = 1E-10
val EPS = 0.001
View
2  algebird-test/src/test/scala/com/twitter/algebird/EventuallyTest.scala
@@ -2,7 +2,7 @@ package com.twitter.algebird
import org.scalacheck.{Arbitrary, Properties}
import org.scalacheck.Gen._
-import org.specs.Specification
+import org.specs2.mutable._
object EventuallyRingLaws extends Properties("EventuallyRing") {
import BaseProperties._
View
4 algebird-test/src/test/scala/com/twitter/algebird/HyperLogLogTest.scala
@@ -1,6 +1,6 @@
package com.twitter.algebird
-import org.specs._
+import org.specs2.mutable._
import org.scalacheck.Arbitrary
import org.scalacheck.Arbitrary.arbitrary
@@ -24,7 +24,7 @@ object HyperLogLogLaws extends Properties("HyperLogLog") {
}
class HyperLogLogTest extends Specification {
- noDetailedDiffs()
+
import HyperLogLog._ //Get the implicit int2bytes, long2Bytes
val r = new java.util.Random
View
2  algebird-test/src/test/scala/com/twitter/algebird/MinHasherTest.scala
@@ -1,6 +1,6 @@
package com.twitter.algebird
-import org.specs._
+import org.specs2.mutable._
import org.scalacheck.Arbitrary
import org.scalacheck.Arbitrary.arbitrary
View
2  algebird-test/src/test/scala/com/twitter/algebird/MinMaxAggregatorTest.scala
@@ -1,6 +1,6 @@
package com.twitter.algebird
-import org.specs._
+import org.specs2.mutable._
class MinMaxAggregatorTest extends Specification {
val data = List(1, 3, 5, 0, 7, 6)
View
24 algebird-test/src/test/scala/com/twitter/algebird/MomentsGroupTest.scala
@@ -1,15 +1,15 @@
package com.twitter.algebird
-import org.specs._
+import org.specs2.mutable._
class MomentsGroupTest extends Specification {
- noDetailedDiffs()
-
+
+
/**
* Given a list of doubles, create a Moments object to hold
* the list's central moments.
*/
- def getMoments(xs : List[Double]) : Moments =
+ def getMoments(xs : List[Double]) : Moments =
xs.foldLeft(MomentsGroup.zero) { (m, x) => MomentsGroup.plus(m, Moments(x)) }
def testApproxEq(f1 : Double, f2 : Double) {
@@ -26,33 +26,33 @@ class MomentsGroupTest extends Specification {
val m2 = getMoments(Nil)
testApproxEq(m2.count, 0)
}
-
+
"Moments should calculate mean" in {
val m1 = getMoments(List(1, 2, 3, 4, 5))
testApproxEq(m1.mean, 3)
val m2 = getMoments(List(1, 1, 1, 2, 3))
- testApproxEq(m2.mean, 1.6)
+ testApproxEq(m2.mean, 1.6)
}
-
+
// variance = function(x) { mean((x - mean(x)) ** 2) }
"Moments should calculate variance" in {
val m1 = getMoments(List(1, 2, 3, 4, 5))
testApproxEq(m1.variance, 2)
val m2 = getMoments(List(1, 1, 1, 2, 3))
- testApproxEq(m2.variance, 0.64)
- }
-
+ testApproxEq(m2.variance, 0.64)
+ }
+
// skewness = function(x) { mean((x - mean(x)) ** 3) / (mean((x - mean(x)) ** 2)) ** 1.5 }
"Moments should calculate skewness" in {
val m1 = getMoments(List(1, 2, 3, 4, 5))
testApproxEq(m1.skewness, 0)
val m2 = getMoments(List(1, 1, 1, 2, 3))
- testApproxEq(m2.skewness, 0.84375)
+ testApproxEq(m2.skewness, 0.84375)
}
-
+
// kurtosis = function(x) { -3 + mean((x - mean(x)) ** 4) / (mean((x - mean(x)) ** 2) ** 2) }
"Moments should calculate kurtosis" in {
val m1 = getMoments(List(1, 2, 3, 4, 5))
View
8 algebird-test/src/test/scala/com/twitter/algebird/MonadFoldMTest.scala
@@ -1,16 +1,16 @@
package com.twitter.algebird
-import org.specs._
+import org.specs2.mutable._
class MonadFoldMTest extends Specification {
- noDetailedDiffs()
+
def binSmalls(x: Int, y: Int) : Option[Int] = if(y > 9) None else Some(x+y)
"A monad foldM" should {
"fold correctly" in {
-
+
// nice easy example from Learn You a Haskell
-
+
val first = Monad.foldM(0,List(2,8,3,1))(binSmalls)
first must be_==(Some(14))
def binSmalls2(x: Int, y: String) : Option[Int] = if(y == "11") None else Some(x+y.toInt)
View
4 algebird-test/src/test/scala/com/twitter/algebird/OperatorTest.scala
@@ -1,11 +1,11 @@
package com.twitter.algebird
-import org.specs._
+import org.specs2.mutable._
import Operators._
class OperatorTest extends Specification {
- noDetailedDiffs()
+
"Operators" should {
"allow plus" in {
View
2  algebird-test/src/test/scala/com/twitter/algebird/QTreeTest.scala
@@ -16,7 +16,7 @@ limitations under the License.
package com.twitter.algebird
-import org.specs._
+import org.specs2.mutable._
import org.scalacheck.Arbitrary
import org.scalacheck.Arbitrary.arbitrary
View
2  algebird-test/src/test/scala/com/twitter/algebird/SGDTest.scala
@@ -1,6 +1,6 @@
package com.twitter.algebird
-import org.specs._
+import org.specs2.mutable._
import org.scalacheck.Arbitrary
import org.scalacheck.Arbitrary.arbitrary
View
4 algebird-test/src/test/scala/com/twitter/algebird/SketchMapTest.scala
@@ -1,6 +1,6 @@
package com.twitter.algebird
-import org.specs._
+import org.specs2.mutable._
import org.scalacheck.Arbitrary
import org.scalacheck.Arbitrary.arbitrary
@@ -34,7 +34,7 @@ class SketchMapTest extends Specification {
import SketchMapTestImplicits._
import HyperLogLog.int2Bytes
- noDetailedDiffs()
+
val MONOID = SketchMap.monoid[Int, Long](EPS, DELTA, SEED, HEAVY_HITTERS_COUNT)
val RAND = new scala.util.Random
View
2  algebird-test/src/test/scala/com/twitter/algebird/TopKTests.scala
@@ -23,7 +23,7 @@ import scala.collection.JavaConverters._
import org.scalacheck.{Arbitrary, Properties}
import org.scalacheck.Gen._
-import org.specs.Specification
+import org.specs2.mutable._
import org.scalacheck.Prop.forAll
object TopKTests extends Properties("TopKTests") {
View
2  algebird-test/src/test/scala/com/twitter/algebird/TupleAggregatorsTest.scala
@@ -1,6 +1,6 @@
package com.twitter.algebird
-import org.specs._
+import org.specs2.mutable._
class TupleAggregatorsTest extends Specification {
import GeneratedTupleAggregator._
View
14 project/Build.scala
@@ -2,7 +2,6 @@ package algebird
import sbt._
import Keys._
-import sbtgitflow.ReleasePlugin._
import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings
import com.typesafe.tools.mima.plugin.MimaKeys.previousArtifact
@@ -14,7 +13,12 @@ object AlgebirdBuild extends Build {
case x => x
}
- val sharedSettings = Project.defaultSettings ++ releaseSettings ++ Seq(
+ def specs2Import(scalaVersion: String) = scalaVersion match {
+ case version if version startsWith "2.9" => "org.specs2" %% "specs2" % "1.12.4.1" % "test"
+ case version if version startsWith "2.10" => "org.specs2" %% "specs2" % "1.13" % "test"
+ }
+
+ val sharedSettings = Project.defaultSettings ++ Seq(
organization := "com.twitter",
scalaVersion := "2.9.3",
crossScalaVersions := Seq("2.9.3", "2.10.0"),
@@ -122,9 +126,9 @@ object AlgebirdBuild extends Build {
lazy val algebirdTest = module("test").settings(
libraryDependencies ++= Seq(
- "org.scalacheck" %% "scalacheck" % "1.10.0",
- "org.scala-tools.testing" %% "specs" % "1.6.9"
- )
+ "org.scalacheck" %% "scalacheck" % "1.10.0"
+ ),
+ libraryDependencies <+= scalaVersion(specs2Import(_))
).dependsOn(algebirdCore)
lazy val algebirdUtil = module("util").settings(
View
1  project/build.properties
@@ -0,0 +1 @@
+sbt.version=0.13.0
View
6 project/plugins.sbt
@@ -3,8 +3,6 @@ resolvers ++= Seq(
"sonatype-releases" at "http://oss.sonatype.org/content/repositories/releases"
)
-addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.0")
+addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.2")
-addSbtPlugin("com.twitter" % "sbt-gitflow" % "0.1.0")
-
-addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.5")
+addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.6")
Please sign in to comment.
Something went wrong with that request. Please try again.