Update to a working version of Scalariform

This commit is contained in:
Björn Antonsson 2016-06-02 14:06:57 +02:00
parent cae070bd93
commit c66ce62d63
616 changed files with 5966 additions and 5436 deletions

View file

@ -228,30 +228,30 @@ class ORSetSpec extends WordSpec with Matchers {
"ORSet unit test" must {
"verify subtractDots" in {
val dot = VersionVector(TreeMap(nodeA -> 3L, nodeB -> 2L, nodeD -> 14L, nodeG -> 22L))
val vvector = VersionVector(TreeMap(nodeA -> 4L, nodeB -> 1L, nodeC -> 1L, nodeD -> 14L, nodeE -> 5L, nodeF -> 2L))
val expected = VersionVector(TreeMap(nodeB -> 2L, nodeG -> 22L))
val dot = VersionVector(TreeMap(nodeA 3L, nodeB 2L, nodeD 14L, nodeG 22L))
val vvector = VersionVector(TreeMap(nodeA 4L, nodeB 1L, nodeC 1L, nodeD 14L, nodeE 5L, nodeF 2L))
val expected = VersionVector(TreeMap(nodeB 2L, nodeG 22L))
ORSet.subtractDots(dot, vvector) should be(expected)
}
"verify mergeCommonKeys" in {
val commonKeys: Set[String] = Set("K1", "K2")
val thisDot1 = VersionVector(TreeMap(nodeA -> 3L, nodeD -> 7L))
val thisDot2 = VersionVector(TreeMap(nodeB -> 5L, nodeC -> 2L))
val thisVvector = VersionVector(TreeMap(nodeA -> 3L, nodeB -> 5L, nodeC -> 2L, nodeD -> 7L))
val thisDot1 = VersionVector(TreeMap(nodeA 3L, nodeD 7L))
val thisDot2 = VersionVector(TreeMap(nodeB 5L, nodeC 2L))
val thisVvector = VersionVector(TreeMap(nodeA 3L, nodeB 5L, nodeC 2L, nodeD 7L))
val thisSet = new ORSet(
elementsMap = Map("K1" -> thisDot1, "K2" -> thisDot2),
elementsMap = Map("K1" thisDot1, "K2" thisDot2),
vvector = thisVvector)
val thatDot1 = VersionVector(nodeA, 3L)
val thatDot2 = VersionVector(nodeB, 6L)
val thatVvector = VersionVector(TreeMap(nodeA -> 3L, nodeB -> 6L, nodeC -> 1L, nodeD -> 8L))
val thatVvector = VersionVector(TreeMap(nodeA 3L, nodeB 6L, nodeC 1L, nodeD 8L))
val thatSet = new ORSet(
elementsMap = Map("K1" -> thatDot1, "K2" -> thatDot2),
elementsMap = Map("K1" thatDot1, "K2" thatDot2),
vvector = thatVvector)
val expectedDots = Map(
"K1" -> VersionVector(nodeA, 3L),
"K2" -> VersionVector(TreeMap(nodeB -> 6L, nodeC -> 2L)))
"K1" VersionVector(nodeA, 3L),
"K2" VersionVector(TreeMap(nodeB 6L, nodeC 2L)))
ORSet.mergeCommonKeys(commonKeys, thisSet, thatSet) should be(expectedDots)
}
@ -259,14 +259,14 @@ class ORSetSpec extends WordSpec with Matchers {
"verify mergeDisjointKeys" in {
val keys: Set[Any] = Set("K3", "K4", "K5")
val elements: Map[Any, VersionVector] = Map(
"K3" -> VersionVector(nodeA, 4L),
"K4" -> VersionVector(TreeMap(nodeA -> 3L, nodeD -> 8L)),
"K5" -> VersionVector(nodeA, 2L))
val vvector = VersionVector(TreeMap(nodeA -> 3L, nodeD -> 7L))
val acc: Map[Any, VersionVector] = Map("K1" -> VersionVector(nodeA, 3L))
"K3" VersionVector(nodeA, 4L),
"K4" VersionVector(TreeMap(nodeA 3L, nodeD 8L)),
"K5" VersionVector(nodeA, 2L))
val vvector = VersionVector(TreeMap(nodeA 3L, nodeD 7L))
val acc: Map[Any, VersionVector] = Map("K1" VersionVector(nodeA, 3L))
val expectedDots = acc ++ Map(
"K3" -> VersionVector(nodeA, 4L),
"K4" -> VersionVector(nodeD, 8L)) // "a" -> 3 removed, optimized to include only those unseen
"K3" VersionVector(nodeA, 4L),
"K4" VersionVector(nodeD, 8L)) // "a" -> 3 removed, optimized to include only those unseen
ORSet.mergeDisjointKeys(keys, elements, vvector, acc) should be(expectedDots)
}