Commit 6a21310f authored by Sander Bollen's avatar Sander Bollen
Browse files

testing map mergers

parent 1dae06f5
......@@ -119,12 +119,51 @@ class VcfStatsTest extends TestNGSuite with Matchers {
@Test
def testMergeStatsMap = {
//stub
val m1 : mutable.Map[Any, Int] = mutable.Map("a" -> 1)
val m2 : mutable.Map[Any, Int] = mutable.Map("b" -> 2)
mergeStatsMap(m1, m2)
m1 should equal (mutable.Map("a" -> 1, "b" -> 2))
val m3 : mutable.Map[Any, Int] = mutable.Map(1 -> 500)
val m4 : mutable.Map[Any, Int] = mutable.Map(6 -> 125)
mergeStatsMap(m3, m4)
m3 should equal (mutable.Map(1 -> 500, 6 -> 125))
mergeStatsMap(m1, m3)
m1 should equal (mutable.Map("a" -> 1, "b" -> 2, 1 -> 500, 6 -> 125))
}
@Test
def testMergeNestedStatsMap = {
//stub
val m1 : mutable.Map[String, mutable.Map[String, mutable.Map[Any, Int]]] = mutable.Map("test" ->
mutable.Map("nested" -> mutable.Map("a" -> 1)))
val m2: Map[String, Map[String, Map[Any, Int]]] = Map("test" ->
Map("nested" -> Map("b" -> 2)))
mergeNestedStatsMap(m1, m2)
m1 should equal (mutable.Map("test" -> mutable.Map("nested" -> mutable.Map("a" -> 1, "b" -> 2))))
val m3 : mutable.Map[String, mutable.Map[String, mutable.Map[Any, Int]]] = mutable.Map("test" ->
mutable.Map("nestedd" -> mutable.Map(1 -> 500)))
val m4: Map[String, Map[String, Map[Any, Int]]] = Map("test" ->
Map("nestedd" -> Map(6 -> 125)))
mergeNestedStatsMap(m3, m4)
m3 should equal (mutable.Map("test" -> mutable.Map("nestedd" -> mutable.Map(1 -> 500, 6 -> 125))))
val m5 = m3.toMap.map(x => x._1 -> x._2.toMap.map(y => y._1 -> y._2.toMap))
mergeNestedStatsMap(m1, m5)
m1 should equal (mutable.Map("test" -> mutable.Map("nested" -> mutable.Map("a" -> 1, "b" -> 2),
"nestedd" -> mutable.Map(1 -> 500, 6 -> 125))))
}
@Test
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment