format source with scalafmt
This commit is contained in:
parent
0f40491d42
commit
ce404e4f53
1669 changed files with 43208 additions and 35404 deletions
|
|
@ -20,12 +20,12 @@ class GCounterSpec extends WordSpec with Matchers {
|
|||
"be able to increment each node's record by one" in {
|
||||
val c1 = GCounter()
|
||||
|
||||
val c2 = c1 increment node1
|
||||
val c3 = c2 increment node1
|
||||
val c2 = c1.increment(node1)
|
||||
val c3 = c2.increment(node1)
|
||||
|
||||
val c4 = c3 increment node2
|
||||
val c5 = c4 increment node2
|
||||
val c6 = c5.resetDelta increment node2
|
||||
val c4 = c3.increment(node2)
|
||||
val c5 = c4.increment(node2)
|
||||
val c6 = c5.resetDelta.increment(node2)
|
||||
|
||||
c6.state(node1) should be(2)
|
||||
c6.state(node2) should be(3)
|
||||
|
|
@ -41,12 +41,12 @@ class GCounterSpec extends WordSpec with Matchers {
|
|||
"be able to increment each node's record by arbitrary delta" in {
|
||||
val c1 = GCounter()
|
||||
|
||||
val c2 = c1 increment (node1, 3)
|
||||
val c3 = c2 increment (node1, 4)
|
||||
val c2 = c1.increment(node1, 3)
|
||||
val c3 = c2.increment(node1, 4)
|
||||
|
||||
val c4 = c3 increment (node2, 2)
|
||||
val c5 = c4 increment (node2, 7)
|
||||
val c6 = c5 increment node2
|
||||
val c4 = c3.increment(node2, 2)
|
||||
val c5 = c4.increment(node2, 7)
|
||||
val c6 = c5.increment(node2)
|
||||
|
||||
c6.state(node1) should be(7)
|
||||
c6.state(node2) should be(10)
|
||||
|
|
@ -55,12 +55,12 @@ class GCounterSpec extends WordSpec with Matchers {
|
|||
"be able to summarize the history to the correct aggregated value" in {
|
||||
val c1 = GCounter()
|
||||
|
||||
val c2 = c1 increment (node1, 3)
|
||||
val c3 = c2 increment (node1, 4)
|
||||
val c2 = c1.increment(node1, 3)
|
||||
val c3 = c2.increment(node1, 4)
|
||||
|
||||
val c4 = c3 increment (node2, 2)
|
||||
val c5 = c4 increment (node2, 7)
|
||||
val c6 = c5 increment node2
|
||||
val c4 = c3.increment(node2, 2)
|
||||
val c5 = c4.increment(node2, 7)
|
||||
val c6 = c5.increment(node2)
|
||||
|
||||
c6.state(node1) should be(7)
|
||||
c6.state(node2) should be(10)
|
||||
|
|
@ -71,11 +71,11 @@ class GCounterSpec extends WordSpec with Matchers {
|
|||
"be able to have its history correctly merged with another GCounter 1" in {
|
||||
// counter 1
|
||||
val c11 = GCounter()
|
||||
val c12 = c11 increment (node1, 3)
|
||||
val c13 = c12 increment (node1, 4)
|
||||
val c14 = c13 increment (node2, 2)
|
||||
val c15 = c14 increment (node2, 7)
|
||||
val c16 = c15 increment node2
|
||||
val c12 = c11.increment(node1, 3)
|
||||
val c13 = c12.increment(node1, 4)
|
||||
val c14 = c13.increment(node2, 2)
|
||||
val c15 = c14.increment(node2, 7)
|
||||
val c16 = c15.increment(node2)
|
||||
|
||||
c16.state(node1) should be(7)
|
||||
c16.state(node2) should be(10)
|
||||
|
|
@ -83,24 +83,24 @@ class GCounterSpec extends WordSpec with Matchers {
|
|||
|
||||
// counter 2
|
||||
val c21 = GCounter()
|
||||
val c22 = c21 increment (node1, 2)
|
||||
val c23 = c22 increment (node1, 2)
|
||||
val c24 = c23 increment (node2, 3)
|
||||
val c25 = c24 increment (node2, 2)
|
||||
val c26 = c25 increment node2
|
||||
val c22 = c21.increment(node1, 2)
|
||||
val c23 = c22.increment(node1, 2)
|
||||
val c24 = c23.increment(node2, 3)
|
||||
val c25 = c24.increment(node2, 2)
|
||||
val c26 = c25.increment(node2)
|
||||
|
||||
c26.state(node1) should be(4)
|
||||
c26.state(node2) should be(6)
|
||||
c26.value should be(10)
|
||||
|
||||
// merge both ways
|
||||
val merged1 = c16 merge c26
|
||||
val merged1 = c16.merge(c26)
|
||||
merged1.state(node1) should be(7)
|
||||
merged1.state(node2) should be(10)
|
||||
merged1.value should be(17)
|
||||
merged1.delta should ===(None)
|
||||
|
||||
val merged2 = c26 merge c16
|
||||
val merged2 = c26.merge(c16)
|
||||
merged2.state(node1) should be(7)
|
||||
merged2.state(node2) should be(10)
|
||||
merged2.value should be(17)
|
||||
|
|
@ -110,11 +110,11 @@ class GCounterSpec extends WordSpec with Matchers {
|
|||
"be able to have its history correctly merged with another GCounter 2" in {
|
||||
// counter 1
|
||||
val c11 = GCounter()
|
||||
val c12 = c11 increment (node1, 2)
|
||||
val c13 = c12 increment (node1, 2)
|
||||
val c14 = c13 increment (node2, 2)
|
||||
val c15 = c14 increment (node2, 7)
|
||||
val c16 = c15 increment node2
|
||||
val c12 = c11.increment(node1, 2)
|
||||
val c13 = c12.increment(node1, 2)
|
||||
val c14 = c13.increment(node2, 2)
|
||||
val c15 = c14.increment(node2, 7)
|
||||
val c16 = c15.increment(node2)
|
||||
|
||||
c16.state(node1) should be(4)
|
||||
c16.state(node2) should be(10)
|
||||
|
|
@ -122,23 +122,23 @@ class GCounterSpec extends WordSpec with Matchers {
|
|||
|
||||
// counter 1
|
||||
val c21 = GCounter()
|
||||
val c22 = c21 increment (node1, 3)
|
||||
val c23 = c22 increment (node1, 4)
|
||||
val c24 = c23 increment (node2, 3)
|
||||
val c25 = c24 increment (node2, 2)
|
||||
val c26 = c25 increment node2
|
||||
val c22 = c21.increment(node1, 3)
|
||||
val c23 = c22.increment(node1, 4)
|
||||
val c24 = c23.increment(node2, 3)
|
||||
val c25 = c24.increment(node2, 2)
|
||||
val c26 = c25.increment(node2)
|
||||
|
||||
c26.state(node1) should be(7)
|
||||
c26.state(node2) should be(6)
|
||||
c26.value should be(13)
|
||||
|
||||
// merge both ways
|
||||
val merged1 = c16 merge c26
|
||||
val merged1 = c16.merge(c26)
|
||||
merged1.state(node1) should be(7)
|
||||
merged1.state(node2) should be(10)
|
||||
merged1.value should be(17)
|
||||
|
||||
val merged2 = c26 merge c16
|
||||
val merged2 = c26.merge(c16)
|
||||
merged2.state(node1) should be(7)
|
||||
merged2.state(node2) should be(10)
|
||||
merged2.value should be(17)
|
||||
|
|
@ -146,8 +146,8 @@ class GCounterSpec extends WordSpec with Matchers {
|
|||
|
||||
"have support for pruning" in {
|
||||
val c1 = GCounter()
|
||||
val c2 = c1 increment node1
|
||||
val c3 = c2 increment node2
|
||||
val c2 = c1.increment(node1)
|
||||
val c3 = c2.increment(node2)
|
||||
c2.modifiedByNodes should ===(Set(node1))
|
||||
c2.needPruningFrom(node1) should be(true)
|
||||
c2.needPruningFrom(node2) should be(false)
|
||||
|
|
@ -162,7 +162,7 @@ class GCounterSpec extends WordSpec with Matchers {
|
|||
c4.needPruningFrom(node1) should be(false)
|
||||
c4.value should be(2)
|
||||
|
||||
val c5 = (c4 increment node1).pruningCleanup(node1)
|
||||
val c5 = c4.increment(node1).pruningCleanup(node1)
|
||||
c5.modifiedByNodes should ===(Set(node2))
|
||||
c5.needPruningFrom(node1) should be(false)
|
||||
c4.value should be(2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue