-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
MoviesSpec.scala
43 lines (33 loc) · 1.28 KB
/
MoviesSpec.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.github.pedrovgs.sparkplayground.exercise6
import com.github.pedrovgs.sparkplayground.exercise6.Movies._
import com.holdenkarau.spark.testing.SharedSparkContext
import org.scalatest.{FlatSpec, Matchers}
class MoviesSpec extends FlatSpec with Matchers with SharedSparkContext {
"Movies" should "count the number of movies directed by James Camenron" in {
numberOfMoviesDirectedByJamesCameron() shouldBe 7
}
it should "count the number of movies directed by the top five directors" in {
numberOfMoviesDirectedByTheTopFiveDirectors() shouldBe 9
}
it should "count the number of movies" in {
numberOfMovies() shouldBe 5043
}
it should "calculate the mean of facebook likes per movie" in {
meanOfFacebookLikes() shouldBe 9699.063850882436 +- 0.1
}
it should "calculate the sum of movies duration" in {
totalDuration() shouldBe 539007.0 +- 0.1
}
it should "find the max number of likes" in {
maxNumberOfLikes() shouldBe 656730
}
it should "find the min number of likes" in {
minNumberOfLikes() shouldBe 0
}
it should "find the movies duration variance" in {
moviesDurationVariance() shouldBe 634.784748 +- 0.1
}
it should "find the movies duration standard deviation" in {
moviesStandardDeviation() shouldBe 25.1949 +- 0.1
}
}