From b479caa291e26f40ae8c7c9d312efa7fe5bd9f3e Mon Sep 17 00:00:00 2001 From: ragnar Date: Sat, 11 Nov 2023 18:26:47 +0100 Subject: [PATCH] scalafmt --- .../container/AddWinsLastWriterWinsMap.scala | 2 +- .../main/scala/replication/webapp/HTML.scala | 11 ++- .../main/scala/replication/fbdc/FbdcCli.scala | 1 - .../deltaAntiEntropy/tests/AWSetTest.scala | 6 +- .../deltaAntiEntropy/tests/EWFlagTest.scala | 9 +- .../deltaAntiEntropy/tests/GCounterTest.scala | 4 +- .../deltaAntiEntropy/tests/GListTest.scala | 4 +- .../deltaAntiEntropy/tests/GSetTest.scala | 4 +- .../tests/MultiVersionRegisterTest.scala | 4 +- .../deltaAntiEntropy/tests/ORMapTest.scala | 3 +- .../tests/PNCounterTest.scala | 4 +- .../tests/ResettableCounterTest.scala | 6 +- .../deltaAntiEntropy/tests/TowPSetTest.scala | 4 +- .../main/scala/replication/DataManager.scala | 4 +- .../scala/replication/JsoniterCodecs.scala | 4 +- .../scala/example/RecursiveComposition.scala | 4 +- .../src/main/scala/todo/Codecs.scala | 1 - .../src/main/scala/todo/TodoAppUI.scala | 2 +- .../src/main/scala/api/Filter.scala | 1 - .../src/main/scala/api/Fold.scala | 1 - .../src/main/scala/api/Map1.scala | 1 - .../src/main/scala/api/Map2.scala | 1 - .../src/main/scala/api2/GraphCompiler.scala | 5 +- .../scala/clangast/expr/CDeclRefExpr.scala | 1 - .../main/scala/clangast/types/CEnumType.scala | 1 - .../main/scala/compiler/MacroCompiler.scala | 1 - .../StandardReactiveMacroCompiler.scala | 10 +- .../lattices/delta/DeltaMergeBench.scala | 1 - .../delta/crdt/LWWRegisterBench.scala | 2 +- .../src/main/scala/kofre/base/Lattice.scala | 2 +- .../main/scala/kofre/datatypes/Epoche.scala | 2 +- .../scala/kofre/datatypes/GrowOnlyList.scala | 2 +- .../scala/kofre/datatypes/GrowOnlySet.scala | 4 +- .../rga/DeltaLatticeSequence.scala | 7 +- .../datatypes/contextual/AddWinsSet.scala | 4 +- .../datatypes/contextual/EnableWinsFlag.scala | 2 +- .../datatypes/contextual/ReplicatedList.scala | 2 +- .../main/scala/kofre/syntax/DeltaBuffer.scala | 4 +- .../scala/kofre/syntax/DeltaContextOps.scala | 10 +- .../main/scala/kofre/time/ArrayRanges.scala | 2 +- .../test/scala/test/kofre/DataGenerator.scala | 2 +- .../src/test/scala/test/kofre/IdHack.scala | 1 - .../kofre/baseproperties/HasDotsChecks.scala | 3 +- .../LatticePropertyChecks.scala | 12 ++- .../test/kofre/bespoke/CausalStoreTest.scala | 1 - .../kofre/bespoke/DecomposeManualTests.scala | 97 ++++++++++++------- .../scala/test/kofre/bespoke/DottedTest.scala | 24 ++--- .../bespoke/MultiVersionRegisterTest.scala | 4 +- .../test/kofre/bespoke/OpGraphTest.scala | 2 +- .../kofre/bespoke/ReplicatedListTest.scala | 15 +-- .../test/kofre/containers/ContainerTest.scala | 29 +++--- .../kofre/corestructs/ArrayRangesTest.scala | 2 +- .../test/kofre/corestructs/CompactTest.scala | 3 +- .../test/kofre/corestructs/DotFunTest.scala | 8 +- .../scala/rescala/operator/EventBundle.scala | 2 - .../scala/rescala/scheduler/TopoBundle.scala | 3 +- .../scala/rescala/scheduler/Twoversion.scala | 2 +- build.sbt | 4 +- project/RescalaDependencies.scala | 9 +- 59 files changed, 192 insertions(+), 174 deletions(-) diff --git a/Modules/Example EncryptedTodoFx/src/main/scala/encrdtlib/container/AddWinsLastWriterWinsMap.scala b/Modules/Example EncryptedTodoFx/src/main/scala/encrdtlib/container/AddWinsLastWriterWinsMap.scala index 44c1aef63..ac9d54e9d 100644 --- a/Modules/Example EncryptedTodoFx/src/main/scala/encrdtlib/container/AddWinsLastWriterWinsMap.scala +++ b/Modules/Example EncryptedTodoFx/src/main/scala/encrdtlib/container/AddWinsLastWriterWinsMap.scala @@ -38,5 +38,5 @@ class AddWinsLastWriterWinsMap[K, V]( } object AddWinsLastWriterWinsMap { - type LatticeType[K, V] = AddWinsMapLattice[K, LastWriterWins[V]] + type LatticeType[K, V] = AddWinsMapLattice[K, LastWriterWins[V]] } diff --git a/Modules/Example Replication/js/src/main/scala/replication/webapp/HTML.scala b/Modules/Example Replication/js/src/main/scala/replication/webapp/HTML.scala index 54bb46255..f391e5cde 100644 --- a/Modules/Example Replication/js/src/main/scala/replication/webapp/HTML.scala +++ b/Modules/Example Replication/js/src/main/scala/replication/webapp/HTML.scala @@ -61,10 +61,13 @@ object HTML { else List( td(button("disconnect", onclick := leftClickHandler(rr.disconnect()))), - td(button("request", onclick := leftClickHandler{ - dataManager.requestMissingFrom(rr) - () - })), + td(button( + "request", + onclick := leftClickHandler { + dataManager.requestMissingFrom(rr) + () + } + )), td(table( dataManager.contextOf(rr).map(dotsToRows).asModifierL )) diff --git a/Modules/Example Replication/jvm/src/main/scala/replication/fbdc/FbdcCli.scala b/Modules/Example Replication/jvm/src/main/scala/replication/fbdc/FbdcCli.scala index d8f45225e..02a2c96f5 100644 --- a/Modules/Example Replication/jvm/src/main/scala/replication/fbdc/FbdcCli.scala +++ b/Modules/Example Replication/jvm/src/main/scala/replication/fbdc/FbdcCli.scala @@ -14,7 +14,6 @@ case class CliConnections( // Argument(_.text("add random data on a time").valueName("milliseconds")) ) - class FbdcCli(settings: CliConnections) { val exData = new FbdcExampleData() diff --git a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/AWSetTest.scala b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/AWSetTest.scala index 261e156ca..d1e8ab61d 100644 --- a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/AWSetTest.scala +++ b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/AWSetTest.scala @@ -260,10 +260,10 @@ class AWSetTest extends munit.ScalaCheckSuite { } property("convergence") { forAll { - (addedA: List[Int], removedA: List[Int], addedB: List[Int], removedB: List[Int],networkGen: NetworkGenerator) => + (addedA: List[Int], removedA: List[Int], addedB: List[Int], removedB: List[Int], networkGen: NetworkGenerator) => val network = networkGen.make() - val aea = new AntiEntropy[AddWinsSet[Int]]("a", network, mutable.Buffer("b")) - val aeb = new AntiEntropy[AddWinsSet[Int]]("b", network, mutable.Buffer("a")) + val aea = new AntiEntropy[AddWinsSet[Int]]("a", network, mutable.Buffer("b")) + val aeb = new AntiEntropy[AddWinsSet[Int]]("b", network, mutable.Buffer("a")) val setaAdded = addedA.foldLeft(AntiEntropyContainer[AddWinsSet[Int]](aea)) { case (set, e) => set.add(using set.replicaID)(e) diff --git a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/EWFlagTest.scala b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/EWFlagTest.scala index 85d38a16f..8b35f69dc 100644 --- a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/EWFlagTest.scala +++ b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/EWFlagTest.scala @@ -134,17 +134,16 @@ class EWFlagTest extends munit.ScalaCheckSuite { property("convergence") { forAll { (enableA: Short, opsA: List[Boolean], opsB: List[Boolean], networkGen: NetworkGenerator) => val network = networkGen.make() - val aea = new AntiEntropy[EnableWinsFlag]("a", network, mutable.Buffer("b")) - val aeb = new AntiEntropy[EnableWinsFlag]("b", network, mutable.Buffer("a")) - + val aea = new AntiEntropy[EnableWinsFlag]("a", network, mutable.Buffer("b")) + val aeb = new AntiEntropy[EnableWinsFlag]("b", network, mutable.Buffer("a")) val fa0 = opsA.foldLeft(AntiEntropyContainer[EnableWinsFlag](aea)) { case (f, false) => f.disable() - case (f, true) => f.enable(using f.replicaID)() + case (f, true) => f.enable(using f.replicaID)() } val fb0 = opsB.foldLeft(AntiEntropyContainer[EnableWinsFlag](aeb)) { case (f, false) => f.disable() - case (f, true) => f.enable(using f.replicaID)() + case (f, true) => f.enable(using f.replicaID)() } AntiEntropy.sync(aea, aeb) diff --git a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/GCounterTest.scala b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/GCounterTest.scala index 4ea5d2890..05153c0a4 100644 --- a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/GCounterTest.scala +++ b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/GCounterTest.scala @@ -69,8 +69,8 @@ class GCounterTest extends munit.ScalaCheckSuite { property("convergence") { forAll { (incA: Short, incB: Short, networkGen: NetworkGenerator) => val network = networkGen.make() - val aea = new AntiEntropy[GrowOnlyCounter]("a", network, mutable.Buffer("b")) - val aeb = new AntiEntropy[GrowOnlyCounter]("b", network, mutable.Buffer("a")) + val aea = new AntiEntropy[GrowOnlyCounter]("a", network, mutable.Buffer("b")) + val aeb = new AntiEntropy[GrowOnlyCounter]("b", network, mutable.Buffer("a")) val ca0 = (0 until incA.toInt).foldLeft(AntiEntropyContainer[GrowOnlyCounter](aea)) { case (c, _) => c.inc()(using c.replicaID) diff --git a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/GListTest.scala b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/GListTest.scala index a2cc08838..173024523 100644 --- a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/GListTest.scala +++ b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/GListTest.scala @@ -136,8 +136,8 @@ class GListTest extends munit.ScalaCheckSuite { property("convergence") { forAll { (base: List[Int], insertedA: List[Int], insertedB: List[Int], networkGen: NetworkGenerator) => val network = networkGen.make() - val aea = new AntiEntropy[GrowOnlyList[Int]]("a", network, mutable.Buffer("b")) - val aeb = new AntiEntropy[GrowOnlyList[Int]]("b", network, mutable.Buffer("a")) + val aea = new AntiEntropy[GrowOnlyList[Int]]("a", network, mutable.Buffer("b")) + val aeb = new AntiEntropy[GrowOnlyList[Int]]("b", network, mutable.Buffer("a")) val la0 = base.reverse.foldLeft(AntiEntropyContainer[GrowOnlyList[Int]](aea)) { case (l, e) => l.insertGL(0, e) diff --git a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/GSetTest.scala b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/GSetTest.scala index 0ff0ac1bc..26f6a4a16 100644 --- a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/GSetTest.scala +++ b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/GSetTest.scala @@ -87,8 +87,8 @@ class GSetTest extends munit.ScalaCheckSuite { property("convergence") { forAll { (insertedA: List[Int], insertedB: List[Int], networkGen: NetworkGenerator) => val network = networkGen.make() - val aea = new AntiEntropy[GrowOnlySet[Int]]("a", network, mutable.Buffer("b")) - val aeb = new AntiEntropy[GrowOnlySet[Int]]("b", network, mutable.Buffer("a")) + val aea = new AntiEntropy[GrowOnlySet[Int]]("a", network, mutable.Buffer("b")) + val aeb = new AntiEntropy[GrowOnlySet[Int]]("b", network, mutable.Buffer("a")) val sa0 = insertedA.foldLeft(AntiEntropyContainer[GrowOnlySet[Int]](aea)) { case (set, e) => set.insert(e) diff --git a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/MultiVersionRegisterTest.scala b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/MultiVersionRegisterTest.scala index 12f8c0e61..6bad89d56 100644 --- a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/MultiVersionRegisterTest.scala +++ b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/MultiVersionRegisterTest.scala @@ -119,8 +119,8 @@ class MultiVersionRegisterTest extends munit.ScalaCheckSuite { forAll { (valuesA: List[Int], nClearA: Short, valuesB: List[Int], nClearB: Short, networkGen: NetworkGenerator) => val network = networkGen.make() - val aea = new AntiEntropy[MultiVersionRegister[Int]]("a", network, mutable.Buffer("b")) - val aeb = new AntiEntropy[MultiVersionRegister[Int]]("b", network, mutable.Buffer("a")) + val aea = new AntiEntropy[MultiVersionRegister[Int]]("a", network, mutable.Buffer("b")) + val aeb = new AntiEntropy[MultiVersionRegister[Int]]("b", network, mutable.Buffer("a")) val opsA = Random.shuffle(valuesA.indices ++ List.fill(nClearA.toInt)(-1)) val opsB = Random.shuffle(valuesB.indices ++ List.fill(nClearB.toInt)(-1)) diff --git a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/ORMapTest.scala b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/ORMapTest.scala index fd7b40381..47f375c75 100644 --- a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/ORMapTest.scala +++ b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/ORMapTest.scala @@ -73,7 +73,8 @@ class ORMapTest extends munit.ScalaCheckSuite { val queryResult = removed.queryKey(k).elements assertEquals( - queryResult, empty.elements, + queryResult, + empty.elements, s"Querying a removed key should produce the same result as querying an empty CRDT, but $queryResult does not equal ${empty.elements}" ) } diff --git a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/PNCounterTest.scala b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/PNCounterTest.scala index 60f53127f..d4bbb8da4 100644 --- a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/PNCounterTest.scala +++ b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/PNCounterTest.scala @@ -89,8 +89,8 @@ class PosNegCounterTest extends munit.ScalaCheckSuite { property("convergence") { forAll { (incA: Byte, decA: Byte, incB: Byte, decB: Byte, networkGen: NetworkGenerator) => val network = networkGen.make() - val aea = new AntiEntropy[PosNegCounter]("a", network, mutable.Buffer("b")) - val aeb = new AntiEntropy[PosNegCounter]("b", network, mutable.Buffer("a")) + val aea = new AntiEntropy[PosNegCounter]("a", network, mutable.Buffer("b")) + val aeb = new AntiEntropy[PosNegCounter]("b", network, mutable.Buffer("a")) val incedA = (0 until incA.toInt).foldLeft(AntiEntropyContainer[PosNegCounter](aea)) { case (c, _) => c.inc()(using c.replicaID) diff --git a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/ResettableCounterTest.scala b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/ResettableCounterTest.scala index 822fce9de..9fa5af2cf 100644 --- a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/ResettableCounterTest.scala +++ b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/ResettableCounterTest.scala @@ -202,12 +202,12 @@ class ResettableCounterTest extends munit.ScalaCheckSuite { nOpsB1: (Byte, Byte, Byte, Byte), nOpsA2: (Byte, Byte, Byte, Byte), nOpsB2: (Byte, Byte, Byte, Byte), - networkGen: NetworkGenerator + networkGen: NetworkGenerator ) => { val network = networkGen.make() - val aea = new AntiEntropy[ResettableCounter]("a", network, mutable.Buffer("b")) - val aeb = new AntiEntropy[ResettableCounter]("b", network, mutable.Buffer("a")) + val aea = new AntiEntropy[ResettableCounter]("a", network, mutable.Buffer("b")) + val aeb = new AntiEntropy[ResettableCounter]("b", network, mutable.Buffer("a")) val opsA1 = Random.shuffle(List.fill(nOpsA1._1.toInt)(0) ++ List.fill(nOpsA1._2.toInt)(1) ++ List.fill( nOpsA1._3.toInt diff --git a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/TowPSetTest.scala b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/TowPSetTest.scala index 5c7094c13..883cf58b9 100644 --- a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/TowPSetTest.scala +++ b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/TowPSetTest.scala @@ -108,8 +108,8 @@ class TowPSetTest extends munit.ScalaCheckSuite { forAll { (insertA: List[Int], removeA: List[Int], insertB: List[Int], removeB: List[Int], networkGen: NetworkGenerator) => val network = networkGen.make() - val aea = new AntiEntropy[TwoPhaseSet[Int]]("a", network, mutable.Buffer("b")) - val aeb = new AntiEntropy[TwoPhaseSet[Int]]("b", network, mutable.Buffer("a")) + val aea = new AntiEntropy[TwoPhaseSet[Int]]("a", network, mutable.Buffer("b")) + val aeb = new AntiEntropy[TwoPhaseSet[Int]]("b", network, mutable.Buffer("a")) val insertedA = insertA.foldLeft(AntiEntropyContainer[TwoPhaseSet[Int]](aea)) { case (s, e) => s.insert(e) diff --git a/Modules/Example Replication/shared/src/main/scala/replication/DataManager.scala b/Modules/Example Replication/shared/src/main/scala/replication/DataManager.scala index 7c8a74964..637d510be 100644 --- a/Modules/Example Replication/shared/src/main/scala/replication/DataManager.scala +++ b/Modules/Example Replication/shared/src/main/scala/replication/DataManager.scala @@ -100,7 +100,7 @@ class DataManager[State: JsonValueCodec: DottedLattice: Bottom: HasDots]( Binding[Dots => Unit]("requestMissing") val pushStateBinding: PushBinding[TransferState] = - given JsonValueCodec[TransferState] = JsonCodecMaker.make + given JsonValueCodec[TransferState] = JsonCodecMaker.make @unused given IdenticallyTransmittable[TransferState] = IdenticallyTransmittable[TransferState]() Binding[TransferState => Unit]("pushState") @@ -137,7 +137,7 @@ class DataManager[State: JsonValueCodec: DottedLattice: Bottom: HasDots]( deltas } registry.remotes.foreach { remote => - //val ctx = contexts.now.getOrElse(remote, Dots.empty) + // val ctx = contexts.now.getOrElse(remote, Dots.empty) pushDeltas(deltas.view, remote) } diff --git a/Modules/Example Replication/shared/src/main/scala/replication/JsoniterCodecs.scala b/Modules/Example Replication/shared/src/main/scala/replication/JsoniterCodecs.scala index e796dcad8..ca6196eb8 100644 --- a/Modules/Example Replication/shared/src/main/scala/replication/JsoniterCodecs.scala +++ b/Modules/Example Replication/shared/src/main/scala/replication/JsoniterCodecs.scala @@ -5,7 +5,9 @@ import com.github.plokhotnyuk.jsoniter_scala.macros.{CodecMakerConfig, JsonCodec import kofre.base.Uid import kofre.datatypes.alternatives.ResettableCounter import kofre.datatypes.contextual.{AddWinsSet, EnableWinsFlag, MultiVersionRegister, ObserveRemoveMap, ReplicatedList} -import kofre.datatypes.{Epoche, GrowOnlyCounter, GrowOnlyList, GrowOnlyMap, GrowOnlySet, LastWriterWins, PosNegCounter, TwoPhaseSet} +import kofre.datatypes.{ + Epoche, GrowOnlyCounter, GrowOnlyList, GrowOnlyMap, GrowOnlySet, LastWriterWins, PosNegCounter, TwoPhaseSet +} import kofre.dotted.Dotted import kofre.datatypes.experiments.AuctionInterface.AuctionData import kofre.time.{ArrayRanges, Dot, Dots, Time} diff --git a/Modules/Example Replication/shared/src/test/scala/example/RecursiveComposition.scala b/Modules/Example Replication/shared/src/test/scala/example/RecursiveComposition.scala index 041985d8c..f8dc7e57b 100644 --- a/Modules/Example Replication/shared/src/test/scala/example/RecursiveComposition.scala +++ b/Modules/Example Replication/shared/src/test/scala/example/RecursiveComposition.scala @@ -21,7 +21,7 @@ class RecursiveCompositionTest extends munit.FunSuite { val exampleComposition: Component = Container( List( Label("Do you Accept?"), - Container ( + Container( List( Button("Yes"), Button("Ok") @@ -31,7 +31,7 @@ class RecursiveCompositionTest extends munit.FunSuite { ) test("composition is serializable") { - val bytes = writeToArray(exampleComposition) + val bytes = writeToArray(exampleComposition) val roundtripped = readFromArray[Component](bytes) assertEquals(roundtripped, exampleComposition) } diff --git a/Modules/Example Todolist/src/main/scala/todo/Codecs.scala b/Modules/Example Todolist/src/main/scala/todo/Codecs.scala index 0182dee0c..6c0af6c66 100644 --- a/Modules/Example Todolist/src/main/scala/todo/Codecs.scala +++ b/Modules/Example Todolist/src/main/scala/todo/Codecs.scala @@ -11,7 +11,6 @@ import kofre.time.Dot import loci.transmitter.IdenticallyTransmittable import rescala.extra.replication.DeltaFor - object Codecs { implicit val taskRefCodec: JsonValueCodec[TaskRef] = JsonCodecMaker.make diff --git a/Modules/Example Todolist/src/main/scala/todo/TodoAppUI.scala b/Modules/Example Todolist/src/main/scala/todo/TodoAppUI.scala index 178b639ef..7a7533b14 100644 --- a/Modules/Example Todolist/src/main/scala/todo/TodoAppUI.scala +++ b/Modules/Example Todolist/src/main/scala/todo/TodoAppUI.scala @@ -46,7 +46,7 @@ class TodoAppUI(val storagePrefix: String) { } val taskrefs = TaskReferences(toggleAll.event, storagePrefix) - val taskOps = new TaskOps(taskrefs, replicaId) + val taskOps = new TaskOps(taskrefs, replicaId) val deltaEvt = Evt[Dotted[ReplicatedList[TaskRef]]]() diff --git a/Modules/Graph-Compiler/src/main/scala/api/Filter.scala b/Modules/Graph-Compiler/src/main/scala/api/Filter.scala index d060c69c0..4fbf1c15e 100644 --- a/Modules/Graph-Compiler/src/main/scala/api/Filter.scala +++ b/Modules/Graph-Compiler/src/main/scala/api/Filter.scala @@ -5,7 +5,6 @@ import clangast.decl.CFunctionDecl import clangast.types.CType import compiler.MacroCompiler - case class Filter[V](input: Event[V], cType: WithContext[CType], f: WithContext[CFunctionDecl]) extends Event[V] { override def inputs: List[ReSource] = List(input) diff --git a/Modules/Graph-Compiler/src/main/scala/api/Fold.scala b/Modules/Graph-Compiler/src/main/scala/api/Fold.scala index bbb054990..20141ad51 100644 --- a/Modules/Graph-Compiler/src/main/scala/api/Fold.scala +++ b/Modules/Graph-Compiler/src/main/scala/api/Fold.scala @@ -5,7 +5,6 @@ import clangast.expr.CExpr import clangast.types.CType import compiler.MacroCompiler - case class Fold[V](init: WithContext[CExpr], cType: WithContext[CType], lines: List[FLine[_, V]]) extends Event[V] { override def inputs: List[ReSource] = lines.map(_.input) diff --git a/Modules/Graph-Compiler/src/main/scala/api/Map1.scala b/Modules/Graph-Compiler/src/main/scala/api/Map1.scala index 5de323e2c..a5021dfed 100644 --- a/Modules/Graph-Compiler/src/main/scala/api/Map1.scala +++ b/Modules/Graph-Compiler/src/main/scala/api/Map1.scala @@ -5,7 +5,6 @@ import clangast.decl.CFunctionDecl import clangast.types.{CType, CVoidType} import compiler.MacroCompiler - case class Map1[A, R](input: Event[A], cType: WithContext[CType], f: WithContext[CFunctionDecl]) extends Event[R] { override def inputs: List[ReSource] = List(input) diff --git a/Modules/Graph-Compiler/src/main/scala/api/Map2.scala b/Modules/Graph-Compiler/src/main/scala/api/Map2.scala index 9609f6a62..55c253e0d 100644 --- a/Modules/Graph-Compiler/src/main/scala/api/Map2.scala +++ b/Modules/Graph-Compiler/src/main/scala/api/Map2.scala @@ -5,7 +5,6 @@ import clangast.decl.CFunctionDecl import clangast.types.CType import compiler.MacroCompiler - case class Map2[A, B, R](l: Event[A], r: Event[B], cType: WithContext[CType], f: WithContext[CFunctionDecl]) extends Event[R] { override def inputs: List[ReSource] = List(l, r) diff --git a/Modules/Graph-Compiler/src/main/scala/api2/GraphCompiler.scala b/Modules/Graph-Compiler/src/main/scala/api2/GraphCompiler.scala index c238a2450..4239b9ef1 100644 --- a/Modules/Graph-Compiler/src/main/scala/api2/GraphCompiler.scala +++ b/Modules/Graph-Compiler/src/main/scala/api2/GraphCompiler.scala @@ -4,7 +4,9 @@ import clangast.* import clangast.given import clangast.decl.* import clangast.expr.* -import clangast.expr.binaryop.{CAndExpr, CAssignmentExpr, CEqualsExpr, CGreaterThanExpr, CLessThanExpr, CNotEqualsExpr, COrExpr} +import clangast.expr.binaryop.{ + CAndExpr, CAssignmentExpr, CEqualsExpr, CGreaterThanExpr, CLessThanExpr, CNotEqualsExpr, COrExpr +} import clangast.expr.unaryop.CNotExpr import clangast.stmt.* import clangast.stubs.{CJSONH, DyadH, StdBoolH, StdLibH} @@ -314,7 +316,6 @@ class GraphCompiler(using Quotes)( val stillUsed = otherConds ++ otherConds.flatMap(reactiveInputs) val released = toRelease.filterNot(stillUsed.contains) - @nowarn val serialization = CEmptyStmt :: sameCond.collect[CStmt] { case e: CompiledEvent if jsonVars.contains(e) => diff --git a/Modules/Graph-Compiler/src/main/scala/clangast/expr/CDeclRefExpr.scala b/Modules/Graph-Compiler/src/main/scala/clangast/expr/CDeclRefExpr.scala index 636185bf0..5ec6dae95 100644 --- a/Modules/Graph-Compiler/src/main/scala/clangast/expr/CDeclRefExpr.scala +++ b/Modules/Graph-Compiler/src/main/scala/clangast/expr/CDeclRefExpr.scala @@ -1,6 +1,5 @@ package clangast.expr - import scala.quoted.{Expr, Quotes} case class CDeclRefExpr(declName: String) extends CExpr { diff --git a/Modules/Graph-Compiler/src/main/scala/clangast/types/CEnumType.scala b/Modules/Graph-Compiler/src/main/scala/clangast/types/CEnumType.scala index 749288779..a045f9c84 100644 --- a/Modules/Graph-Compiler/src/main/scala/clangast/types/CEnumType.scala +++ b/Modules/Graph-Compiler/src/main/scala/clangast/types/CEnumType.scala @@ -1,6 +1,5 @@ package clangast.types - import scala.quoted.{Expr, Quotes} case class CEnumType(declName: String) extends CType { diff --git a/Modules/Graph-Compiler/src/main/scala/compiler/MacroCompiler.scala b/Modules/Graph-Compiler/src/main/scala/compiler/MacroCompiler.scala index 233c246a2..79a153a9b 100644 --- a/Modules/Graph-Compiler/src/main/scala/compiler/MacroCompiler.scala +++ b/Modules/Graph-Compiler/src/main/scala/compiler/MacroCompiler.scala @@ -5,7 +5,6 @@ import clangast.expr.CExpr import clangast.types.CType import clangast.{CASTNode, WithContext} - trait MacroCompiler { inline def compileTree(inline t: Any): WithContext[CASTNode] diff --git a/Modules/Graph-Compiler/src/main/scala/compiler/StandardReactiveMacroCompiler.scala b/Modules/Graph-Compiler/src/main/scala/compiler/StandardReactiveMacroCompiler.scala index c59115bbd..2f9041436 100644 --- a/Modules/Graph-Compiler/src/main/scala/compiler/StandardReactiveMacroCompiler.scala +++ b/Modules/Graph-Compiler/src/main/scala/compiler/StandardReactiveMacroCompiler.scala @@ -11,16 +11,16 @@ object StandardReactiveMacroCompiler extends ReactiveMacroCompiler { export impl.* override inline def compileTree(inline t: Any): WithContext[CASTNode] = - ${ compileTreeCode('{t}) } + ${ compileTreeCode('{ t }) } override inline def compileExpr(inline e: Any): WithContext[CExpr] = - ${ compileExprCode('{e}) } + ${ compileExprCode('{ e }) } override inline def compileFun(inline f: AnyRef): WithContext[CFunctionDecl] = - ${ compileFunCode('{f}) } + ${ compileFunCode('{ f }) } override inline def compileAnonFun(inline f: AnyRef): WithContext[CFunctionDecl] = - ${ compileAnonFunCode('{f}) } + ${ compileAnonFunCode('{ f }) } override inline def compileType[T]: WithContext[CType] = ${ compileTypeCode[T] } @@ -29,5 +29,5 @@ object StandardReactiveMacroCompiler extends ReactiveMacroCompiler { ${ valNameCode } override inline def compileGraph(inline appName: String)(inline graph: Any): Unit = - ${ compileGraphCode('{appName})('{graph}) } + ${ compileGraphCode('{ appName })('{ graph }) } } diff --git a/Modules/Microbenchmarks/src/main/scala/benchmarks/lattices/delta/DeltaMergeBench.scala b/Modules/Microbenchmarks/src/main/scala/benchmarks/lattices/delta/DeltaMergeBench.scala index ef7fe66d2..483c4e660 100644 --- a/Modules/Microbenchmarks/src/main/scala/benchmarks/lattices/delta/DeltaMergeBench.scala +++ b/Modules/Microbenchmarks/src/main/scala/benchmarks/lattices/delta/DeltaMergeBench.scala @@ -8,7 +8,6 @@ import kofre.base.Uid.asId import kofre.datatypes.contextual.ReplicatedList import java.util.concurrent.TimeUnit - @BenchmarkMode(Array(Mode.Throughput)) @OutputTimeUnit(TimeUnit.MILLISECONDS) @Warmup(iterations = 3, time = 1000, timeUnit = TimeUnit.MILLISECONDS) diff --git a/Modules/Microbenchmarks/src/main/scala/benchmarks/lattices/delta/crdt/LWWRegisterBench.scala b/Modules/Microbenchmarks/src/main/scala/benchmarks/lattices/delta/crdt/LWWRegisterBench.scala index cf6097508..c77348f9b 100644 --- a/Modules/Microbenchmarks/src/main/scala/benchmarks/lattices/delta/crdt/LWWRegisterBench.scala +++ b/Modules/Microbenchmarks/src/main/scala/benchmarks/lattices/delta/crdt/LWWRegisterBench.scala @@ -14,7 +14,7 @@ import java.util.concurrent.TimeUnit @State(Scope.Thread) class LWWRegisterBench { - var full: NamedDeltaBuffer[LastWriterWins[Int]] = _ + var full: NamedDeltaBuffer[LastWriterWins[Int]] = _ @Setup def setup(): Unit = { diff --git a/Modules/RDTs/src/main/scala/kofre/base/Lattice.scala b/Modules/RDTs/src/main/scala/kofre/base/Lattice.scala index d83d9328b..b026bbe65 100644 --- a/Modules/RDTs/src/main/scala/kofre/base/Lattice.scala +++ b/Modules/RDTs/src/main/scala/kofre/base/Lattice.scala @@ -172,7 +172,7 @@ object Lattice { override def decompose(a: T): Iterable[T] = val ordinal = sm.ordinal(a) - val res = lat(ordinal).decompose(a) + val res = lat(ordinal).decompose(a) // When `a` decomposes into nothing, it is no longer possible to distinguish which alternative of the sum we are dealing with. That is fine when the ordinal is 0 because then we have reached the bottom case for the sum type, but in all other cases we must keep enough information around to figure out the ordinal. if ordinal != 0 && res.isEmpty then Iterable(a) diff --git a/Modules/RDTs/src/main/scala/kofre/datatypes/Epoche.scala b/Modules/RDTs/src/main/scala/kofre/datatypes/Epoche.scala index 7ca585e28..e0dbc654b 100644 --- a/Modules/RDTs/src/main/scala/kofre/datatypes/Epoche.scala +++ b/Modules/RDTs/src/main/scala/kofre/datatypes/Epoche.scala @@ -16,7 +16,7 @@ object Epoche { given hasDots[E: HasDots: Bottom]: HasDots[Epoche[E]] = new { extension (dotted: Epoche[E]) - def dots: Dots = dotted.value.dots + def dots: Dots = dotted.value.dots def removeDots(dots: Dots): Option[Epoche[E]] = dotted.value.removeDots(dots).map(nv => dotted.copy(value = nv)) } diff --git a/Modules/RDTs/src/main/scala/kofre/datatypes/GrowOnlyList.scala b/Modules/RDTs/src/main/scala/kofre/datatypes/GrowOnlyList.scala index b045c83de..452df8fc8 100644 --- a/Modules/RDTs/src/main/scala/kofre/datatypes/GrowOnlyList.scala +++ b/Modules/RDTs/src/main/scala/kofre/datatypes/GrowOnlyList.scala @@ -28,7 +28,7 @@ object GrowOnlyList { def empty[E]: GrowOnlyList[E] = GrowOnlyList(Map.empty) - given bottomInstance[E]: Bottom[GrowOnlyList[E]] = Bottom.derived + given bottomInstance[E]: Bottom[GrowOnlyList[E]] = Bottom.derived given hasDots[E: HasDots]: HasDots[GrowOnlyList[E]] = HasDots.noDots given Lattice[E]: Lattice[GrowOnlyList[E]] = diff --git a/Modules/RDTs/src/main/scala/kofre/datatypes/GrowOnlySet.scala b/Modules/RDTs/src/main/scala/kofre/datatypes/GrowOnlySet.scala index 43560b7c3..a43dc156e 100644 --- a/Modules/RDTs/src/main/scala/kofre/datatypes/GrowOnlySet.scala +++ b/Modules/RDTs/src/main/scala/kofre/datatypes/GrowOnlySet.scala @@ -10,8 +10,8 @@ object GrowOnlySet { def empty[E]: GrowOnlySet[E] = Set.empty - given bottomInstance[E]: Bottom[GrowOnlySet[E]] = Bottom.setBottom - given lattice[E]: Lattice[GrowOnlySet[E]] = Lattice.setLattice + given bottomInstance[E]: Bottom[GrowOnlySet[E]] = Bottom.setBottom + given lattice[E]: Lattice[GrowOnlySet[E]] = Lattice.setLattice extension [C, E](container: C) def growOnlySet: syntax[C, E] = syntax(container) diff --git a/Modules/RDTs/src/main/scala/kofre/datatypes/alternatives/rga/DeltaLatticeSequence.scala b/Modules/RDTs/src/main/scala/kofre/datatypes/alternatives/rga/DeltaLatticeSequence.scala index 1b29259b3..0740c1cbe 100644 --- a/Modules/RDTs/src/main/scala/kofre/datatypes/alternatives/rga/DeltaLatticeSequence.scala +++ b/Modules/RDTs/src/main/scala/kofre/datatypes/alternatives/rga/DeltaLatticeSequence.scala @@ -110,9 +110,9 @@ object DeltaSequence { extension (value: DeltaSequence[A]) def dots: Dots = value.vertices.dots override def removeDots(dots: Dots): Option[DeltaSequence[A]] = - HasDots.apply[AddWinsSet[Vertex]].removeDots(value.vertices)(dots).map { nv => - value.copy(vertices = nv) - } + HasDots.apply[AddWinsSet[Vertex]].removeDots(value.vertices)(dots).map { nv => + value.copy(vertices = nv) + } } given deltaSequenceLattice[A]: Lattice[DeltaSequence[A]] = @@ -145,6 +145,5 @@ object DeltaSequence { ) } - } } diff --git a/Modules/RDTs/src/main/scala/kofre/datatypes/contextual/AddWinsSet.scala b/Modules/RDTs/src/main/scala/kofre/datatypes/contextual/AddWinsSet.scala index af7de0a72..986d26dba 100644 --- a/Modules/RDTs/src/main/scala/kofre/datatypes/contextual/AddWinsSet.scala +++ b/Modules/RDTs/src/main/scala/kofre/datatypes/contextual/AddWinsSet.scala @@ -17,8 +17,8 @@ object AddWinsSet { given bottom[E]: Bottom[AddWinsSet[E]] with { override def empty: AddWinsSet[E] = AddWinsSet.empty } - given lattice[E]: Lattice[AddWinsSet[E]] = Lattice.derived - given asCausalContext[E]: HasDots[AddWinsSet[E]] = HasDots.derived + given lattice[E]: Lattice[AddWinsSet[E]] = Lattice.derived + given asCausalContext[E]: HasDots[AddWinsSet[E]] = HasDots.derived extension [C, E](container: C) def addWinsSet: syntax[C, E] = syntax(container) diff --git a/Modules/RDTs/src/main/scala/kofre/datatypes/contextual/EnableWinsFlag.scala b/Modules/RDTs/src/main/scala/kofre/datatypes/contextual/EnableWinsFlag.scala index 5db6982dc..3aad77209 100644 --- a/Modules/RDTs/src/main/scala/kofre/datatypes/contextual/EnableWinsFlag.scala +++ b/Modules/RDTs/src/main/scala/kofre/datatypes/contextual/EnableWinsFlag.scala @@ -14,7 +14,7 @@ case class EnableWinsFlag(inner: DotSet) derives Bottom object EnableWinsFlag { - given lattice: Lattice[EnableWinsFlag] = Lattice.derived + given lattice: Lattice[EnableWinsFlag] = Lattice.derived given hasDotsEWF: HasDots[EnableWinsFlag] = HasDots.derived val empty: EnableWinsFlag = EnableWinsFlag(DotSet.empty) diff --git a/Modules/RDTs/src/main/scala/kofre/datatypes/contextual/ReplicatedList.scala b/Modules/RDTs/src/main/scala/kofre/datatypes/contextual/ReplicatedList.scala index a0ce57c73..c067609aa 100644 --- a/Modules/RDTs/src/main/scala/kofre/datatypes/contextual/ReplicatedList.scala +++ b/Modules/RDTs/src/main/scala/kofre/datatypes/contextual/ReplicatedList.scala @@ -24,7 +24,7 @@ import kofre.time.{Dot, Dots} * * This implementation was modeled after the RGA proposed by Roh et al. in "Replicated abstract data types: Building blocks * for collaborative applications", see [[https://www.sciencedirect.com/science/article/pii/S0743731510002716?casa_token=lQaLin7aEvcAAAAA:Esc3h3WvkFHUcvhalTPPvV5HbJge91D4-2jyKiSlz8GBDjx31l4xvfH8DIstmQ973PVi46ckXHg here]] - * However, since then the implementation was changed significantly, thus it may be a different or even a novel strategy by now. + * However, since then the implementation was changed significantly, thus it may be a different or even a novel strategy by now. */ case class ReplicatedList[E](order: Epoche[GrowOnlyList[Dot]], meta: DotFun[LastWriterWins[E]]) object ReplicatedList { diff --git a/Modules/RDTs/src/main/scala/kofre/syntax/DeltaBuffer.scala b/Modules/RDTs/src/main/scala/kofre/syntax/DeltaBuffer.scala index 038937a9a..b1556b9e6 100644 --- a/Modules/RDTs/src/main/scala/kofre/syntax/DeltaBuffer.scala +++ b/Modules/RDTs/src/main/scala/kofre/syntax/DeltaBuffer.scala @@ -74,7 +74,9 @@ object DeltaBufferContainer extends DeltaBufferContainer.LowPrio { } trait LowPrio { - given nestedPlainPermissions[L](using pm: PermMutate[DeltaBuffer[Dotted[L]], L]): PermMutate[DeltaBufferContainer[Dotted[L]], L] = new { + given nestedPlainPermissions[L](using + pm: PermMutate[DeltaBuffer[Dotted[L]], L] + ): PermMutate[DeltaBufferContainer[Dotted[L]], L] = new { override def mutate(c: DeltaBufferContainer[Dotted[L]], delta: L): DeltaBufferContainer[Dotted[L]] = c.result = pm.mutate(c.result, delta) c diff --git a/Modules/RDTs/src/main/scala/kofre/syntax/DeltaContextOps.scala b/Modules/RDTs/src/main/scala/kofre/syntax/DeltaContextOps.scala index 5ebf8da20..3039cb820 100644 --- a/Modules/RDTs/src/main/scala/kofre/syntax/DeltaContextOps.scala +++ b/Modules/RDTs/src/main/scala/kofre/syntax/DeltaContextOps.scala @@ -13,7 +13,9 @@ import scala.annotation.implicitNotFound * No matter the concrete container, they should all offer the same API to the underlying lattice. */ -@implicitNotFound("Requires query permission. If the syntax is incorrect, try specifying it explicitly:\n container: »${C}«\n syntax for: »${L}«") +@implicitNotFound( + "Requires query permission. If the syntax is incorrect, try specifying it explicitly:\n container: »${C}«\n syntax for: »${L}«" +) trait PermQuery[C, L]: def query(c: C): L object PermQuery: @@ -36,9 +38,9 @@ object ReplicaId: extension (id: ReplicaId) def uid: Uid = id def apply(id: Uid): ReplicaId = id inline given fromId: Conversion[Uid, ReplicaId] = identity - def predefined(s: String): ReplicaId = ReplicaId.fromId(Uid.predefined(s)) - def unwrap(id: ReplicaId): Uid = id - def gen(): ReplicaId = Uid.gen() + def predefined(s: String): ReplicaId = ReplicaId.fromId(Uid.predefined(s)) + def unwrap(id: ReplicaId): Uid = id + def gen(): ReplicaId = Uid.gen() @implicitNotFound( "Requires context mutation permission.\nUnsure how to extract context from »${C}«\nto modify »${L}«" diff --git a/Modules/RDTs/src/main/scala/kofre/time/ArrayRanges.scala b/Modules/RDTs/src/main/scala/kofre/time/ArrayRanges.scala index a48741edd..4ea8b8eab 100644 --- a/Modules/RDTs/src/main/scala/kofre/time/ArrayRanges.scala +++ b/Modules/RDTs/src/main/scala/kofre/time/ArrayRanges.scala @@ -144,7 +144,7 @@ class ArrayRanges( (rstart, rend) val curStart = selection._1 - var minEnd = selection._2 + var minEnd = selection._2 def mergeOverlapping(): Boolean = var res = false diff --git a/Modules/RDTs/src/test/scala/test/kofre/DataGenerator.scala b/Modules/RDTs/src/test/scala/test/kofre/DataGenerator.scala index 98cdc75bf..66a31f526 100644 --- a/Modules/RDTs/src/test/scala/test/kofre/DataGenerator.scala +++ b/Modules/RDTs/src/test/scala/test/kofre/DataGenerator.scala @@ -23,7 +23,7 @@ object DataGenerator { } object ExampleData: given Conversion[String, ExampleData] = ed => ExampleData(Set(ed)) - given hasDots: HasDots[ExampleData] = HasDots.noDots + given hasDots: HasDots[ExampleData] = HasDots.noDots given Arbitrary[ExampleData] = Arbitrary: Gen.oneOf(List("Anne", "Ben", "Chris", "Erin", "Julina", "Lynn", "Sara", "Taylor")).map(name => diff --git a/Modules/RDTs/src/test/scala/test/kofre/IdHack.scala b/Modules/RDTs/src/test/scala/test/kofre/IdHack.scala index 653857459..9c5c5c159 100644 --- a/Modules/RDTs/src/test/scala/test/kofre/IdHack.scala +++ b/Modules/RDTs/src/test/scala/test/kofre/IdHack.scala @@ -8,5 +8,4 @@ implicit def idFromString(s: String): kofre.base.Uid = kofre.base.Uid.predefined given munit.Compare[kofre.base.Uid, String] = new Compare[Uid, String]: override def isEqual(obtained: Uid, expected: String): Boolean = Uid.unwrap(obtained) == expected - val isGithubCi: Boolean = (Option(System.getenv("GITHUB_WORKFLOW")).exists(_.nonEmpty)) diff --git a/Modules/RDTs/src/test/scala/test/kofre/baseproperties/HasDotsChecks.scala b/Modules/RDTs/src/test/scala/test/kofre/baseproperties/HasDotsChecks.scala index 24a8ecfd9..85db415fa 100644 --- a/Modules/RDTs/src/test/scala/test/kofre/baseproperties/HasDotsChecks.scala +++ b/Modules/RDTs/src/test/scala/test/kofre/baseproperties/HasDotsChecks.scala @@ -37,8 +37,7 @@ abstract class HasDotsChecks[A: Arbitrary: HasDots] extends munit.ScalaCheckSuit forAll: (a: A) => a.removeDots(a.dots) match case Some(value) => assertEquals(value.dots, Dots.empty) - case None => // good - + case None => // good } } diff --git a/Modules/RDTs/src/test/scala/test/kofre/baseproperties/LatticePropertyChecks.scala b/Modules/RDTs/src/test/scala/test/kofre/baseproperties/LatticePropertyChecks.scala index 4001e517a..95d0ddc33 100644 --- a/Modules/RDTs/src/test/scala/test/kofre/baseproperties/LatticePropertyChecks.scala +++ b/Modules/RDTs/src/test/scala/test/kofre/baseproperties/LatticePropertyChecks.scala @@ -5,7 +5,9 @@ import kofre.datatypes.alternatives.{MultiValueRegister, ObserveRemoveSet} import kofre.datatypes.contextual.{CausalQueue, ReplicatedList} import kofre.datatypes.experiments.AutomergyOpGraphLWW.OpGraph import kofre.datatypes.experiments.CausalStore -import kofre.datatypes.{GrowOnlyCounter, GrowOnlyList, GrowOnlyMap, LastWriterWins, PosNegCounter, TwoPhaseSet, contextual} +import kofre.datatypes.{ + GrowOnlyCounter, GrowOnlyList, GrowOnlyMap, LastWriterWins, PosNegCounter, TwoPhaseSet, contextual +} import kofre.dotted.{DotFun, DotMap, DotSet, Dotted, HasDots} import kofre.time.{Dots, Time, VectorClock} import org.scalacheck.Prop.* @@ -43,8 +45,12 @@ class ReplicatedListChecks extends LatticePropertyChecks[Dotted[ReplicatedLis class LWWTupleChecks extends LatticePropertyChecks[(Option[LastWriterWins[Int]], Option[LastWriterWins[Int]])] -abstract class LatticePropertyChecks[A](expensive: Boolean = false)(using arbitrary: Arbitrary[A], lattice: Lattice[A], bottomOpt: BottomOpt[A], shrink: Shrink[A]) - extends OrderTests(using Lattice.latticeOrder)(total = false) { +abstract class LatticePropertyChecks[A](expensive: Boolean = false)(using + arbitrary: Arbitrary[A], + lattice: Lattice[A], + bottomOpt: BottomOpt[A], + shrink: Shrink[A] +) extends OrderTests(using Lattice.latticeOrder)(total = false) { override def munitIgnore: Boolean = expensive && isGithubCi diff --git a/Modules/RDTs/src/test/scala/test/kofre/bespoke/CausalStoreTest.scala b/Modules/RDTs/src/test/scala/test/kofre/bespoke/CausalStoreTest.scala index 18e6a32d4..1d181668f 100644 --- a/Modules/RDTs/src/test/scala/test/kofre/bespoke/CausalStoreTest.scala +++ b/Modules/RDTs/src/test/scala/test/kofre/bespoke/CausalStoreTest.scala @@ -51,7 +51,6 @@ class CausalStoreTest extends munit.FunSuite { )) ) - val ab = a merge b val bc = b merge c diff --git a/Modules/RDTs/src/test/scala/test/kofre/bespoke/DecomposeManualTests.scala b/Modules/RDTs/src/test/scala/test/kofre/bespoke/DecomposeManualTests.scala index 947b00e06..ea06ee785 100644 --- a/Modules/RDTs/src/test/scala/test/kofre/bespoke/DecomposeManualTests.scala +++ b/Modules/RDTs/src/test/scala/test/kofre/bespoke/DecomposeManualTests.scala @@ -113,7 +113,8 @@ class DecomposeManualTests extends munit.ScalaCheckSuite { val merged_diff_delta_2: Option[Dotted[EnableWinsFlag]] = Lattice[Dotted[EnableWinsFlag]].diff(merged, delta_2) assertEquals(merged_diff_delta_2, None, "delta_2 should be contained in merged") - val decomposed: Seq[Dotted[EnableWinsFlag]] = Lattice[Dotted[EnableWinsFlag]].decompose(merged).toSeq.sortBy(_.data.inner.repr.internal.keys.headOption) + val decomposed: Seq[Dotted[EnableWinsFlag]] = + Lattice[Dotted[EnableWinsFlag]].decompose(merged).toSeq.sortBy(_.data.inner.repr.internal.keys.headOption) // EnableWinsFlag does not decompose, only returns the value. // Dotted decomposes context and value. As context is completely covered by EnableWinsFlag, no additional entry for context. assertEquals(decomposed.size, 1) @@ -139,7 +140,6 @@ class DecomposeManualTests extends munit.ScalaCheckSuite { val val_1: Dotted[EnableWinsFlag] = delta_1 assertEquals(val_1.data.read, true) - val delta_2: Dotted[EnableWinsFlag] = val_1.disable() assertEquals(delta_2.context.internal.size, 1) assertEquals(delta_2.context.max(r1.uid), Some(Dot(r1.uid, 0))) @@ -149,7 +149,6 @@ class DecomposeManualTests extends munit.ScalaCheckSuite { val val_2: Dotted[EnableWinsFlag] = val_1 merge delta_2 assertEquals(val_2.data.read, false) - val delta_3: Dotted[EnableWinsFlag] = val_2.enable(using r2)() assertEquals(delta_3.context.internal.size, 1) assertEquals(delta_3.context.toSet, Set(Dot(r2.uid, 0))) // it's a delta - r1 dot not here, only r2 @@ -159,7 +158,8 @@ class DecomposeManualTests extends munit.ScalaCheckSuite { val val_3: Dotted[EnableWinsFlag] = val_2 merge delta_3 assertEquals(val_3.data.read, true) - val decomposed: Seq[Dotted[EnableWinsFlag]] = Lattice[Dotted[EnableWinsFlag]].decompose(val_3).toSeq.sortBy(_.data.inner.repr.internal.keys.headOption) + val decomposed: Seq[Dotted[EnableWinsFlag]] = + Lattice[Dotted[EnableWinsFlag]].decompose(val_3).toSeq.sortBy(_.data.inner.repr.internal.keys.headOption) // Dotted decomposes context and value - one entry for EnableWinsFlag with their Dot and one entry with remaining context assertEquals(decomposed.size, 2) @@ -187,19 +187,24 @@ class DecomposeManualTests extends munit.ScalaCheckSuite { val merged: Dotted[MultiVersionRegister[Int]] = Lattice[Dotted[MultiVersionRegister[Int]]].merge(delta_1, delta_2) assertEquals(merged.read, Set(1, 2)) - val delta_1_diff_delta_2: Option[Dotted[MultiVersionRegister[Int]]] = Lattice[Dotted[MultiVersionRegister[Int]]].diff(delta_1, delta_2) + val delta_1_diff_delta_2: Option[Dotted[MultiVersionRegister[Int]]] = + Lattice[Dotted[MultiVersionRegister[Int]]].diff(delta_1, delta_2) assertEquals(delta_1_diff_delta_2, Some(delta_2), "delta_2 is not contained in delta_1") - val delta_2_diff_delta_1: Option[Dotted[MultiVersionRegister[Int]]] = Lattice[Dotted[MultiVersionRegister[Int]]].diff(delta_2, delta_1) + val delta_2_diff_delta_1: Option[Dotted[MultiVersionRegister[Int]]] = + Lattice[Dotted[MultiVersionRegister[Int]]].diff(delta_2, delta_1) assertEquals(delta_2_diff_delta_1, Some(delta_1), "delta_1 is not contained in delta_2") - val merged_diff_delta_1: Option[Dotted[MultiVersionRegister[Int]]] = Lattice[Dotted[MultiVersionRegister[Int]]].diff(merged, delta_1) + val merged_diff_delta_1: Option[Dotted[MultiVersionRegister[Int]]] = + Lattice[Dotted[MultiVersionRegister[Int]]].diff(merged, delta_1) assertEquals(merged_diff_delta_1, None, "delta_1 should be contained in merged") - val merged_diff_delta_2: Option[Dotted[MultiVersionRegister[Int]]] = Lattice[Dotted[MultiVersionRegister[Int]]].diff(merged, delta_2) + val merged_diff_delta_2: Option[Dotted[MultiVersionRegister[Int]]] = + Lattice[Dotted[MultiVersionRegister[Int]]].diff(merged, delta_2) assertEquals(merged_diff_delta_2, None, "delta_2 should be contained in merged") - val decomposed: Seq[Dotted[MultiVersionRegister[Int]]] = Lattice[Dotted[MultiVersionRegister[Int]]].decompose(merged).toSeq.sortBy(_.data.read.headOption) + val decomposed: Seq[Dotted[MultiVersionRegister[Int]]] = + Lattice[Dotted[MultiVersionRegister[Int]]].decompose(merged).toSeq.sortBy(_.data.read.headOption) // MultiVersionRegister decomposes every version assertEquals(decomposed.size, 2) assertEquals(decomposed(0).read, Set(1)) @@ -224,16 +229,20 @@ class DecomposeManualTests extends munit.ScalaCheckSuite { val merged: Dotted[LastWriterWins[Int]] = Lattice[Dotted[LastWriterWins[Int]]].merge(delta_1, delta_2) assertEquals(merged.read, 2) - val delta_1_diff_delta_2: Option[Dotted[LastWriterWins[Int]]] = Lattice[Dotted[LastWriterWins[Int]]].diff(delta_1, delta_2) + val delta_1_diff_delta_2: Option[Dotted[LastWriterWins[Int]]] = + Lattice[Dotted[LastWriterWins[Int]]].diff(delta_1, delta_2) assertEquals(delta_1_diff_delta_2, Some(delta_2), "delta_2 is not contained in delta_1") - val delta_2_diff_delta_1: Option[Dotted[LastWriterWins[Int]]] = Lattice[Dotted[LastWriterWins[Int]]].diff(delta_2, delta_1) + val delta_2_diff_delta_1: Option[Dotted[LastWriterWins[Int]]] = + Lattice[Dotted[LastWriterWins[Int]]].diff(delta_2, delta_1) assertEquals(delta_2_diff_delta_1, None, "delta_1 happened before delta_2 - delta_1 is obsolete") - val merged_diff_delta_1: Option[Dotted[LastWriterWins[Int]]] = Lattice[Dotted[LastWriterWins[Int]]].diff(merged, delta_1) + val merged_diff_delta_1: Option[Dotted[LastWriterWins[Int]]] = + Lattice[Dotted[LastWriterWins[Int]]].diff(merged, delta_1) assertEquals(merged_diff_delta_1, None, "delta_1 should be contained in merged") - val merged_diff_delta_2: Option[Dotted[LastWriterWins[Int]]] = Lattice[Dotted[LastWriterWins[Int]]].diff(merged, delta_2) + val merged_diff_delta_2: Option[Dotted[LastWriterWins[Int]]] = + Lattice[Dotted[LastWriterWins[Int]]].diff(merged, delta_2) assertEquals(merged_diff_delta_2, None, "delta_2 should be contained in merged") val decomposed: Seq[Dotted[LastWriterWins[Int]]] = Lattice[Dotted[LastWriterWins[Int]]].decompose(merged).toSeq @@ -271,7 +280,8 @@ class DecomposeManualTests extends munit.ScalaCheckSuite { val merged_diff_delta_2: Option[GrowOnlySet[Int]] = Lattice[GrowOnlySet[Int]].diff(merged, delta_2) assertEquals(merged_diff_delta_2, None, "delta_2 should be contained in merged") - val decomposed: Seq[GrowOnlySet[Int]] = Lattice[GrowOnlySet[Int]].decompose(merged).toSeq.sortBy(_.elements.headOption) + val decomposed: Seq[GrowOnlySet[Int]] = + Lattice[GrowOnlySet[Int]].decompose(merged).toSeq.sortBy(_.elements.headOption) // GrowOnlySet decomposes every entry assertEquals(decomposed.size, 2) assertEquals(decomposed(0).elements, Set(1)) @@ -291,12 +301,13 @@ class DecomposeManualTests extends munit.ScalaCheckSuite { override def empty: String = "" } - val emptyMap: Dotted[GrowOnlyMap[Int, LastWriterWins[String]]] = Dotted(Bottom[GrowOnlyMap[Int, LastWriterWins[String]]].empty) + val emptyMap: Dotted[GrowOnlyMap[Int, LastWriterWins[String]]] = + Dotted(Bottom[GrowOnlyMap[Int, LastWriterWins[String]]].empty) assertEquals(emptyMap.context.internal, Map.empty) - val k1: Int = 1 - val v1: String = "one" - val e1 = LastWriterWins.now("") + val k1: Int = 1 + val v1: String = "one" + val e1 = LastWriterWins.now("") val delta_1: Dotted[GrowOnlyMap[Int, LastWriterWins[String]]] = emptyMap.mutateKeyNamedCtx(k1, e1)(_.write(v1)) assertEquals(delta_1.context.internal, Map.empty) assertEquals(delta_1.data.keySet, Set(1)) @@ -304,33 +315,39 @@ class DecomposeManualTests extends munit.ScalaCheckSuite { // delta_1 and delta_2 are in parallel - val k2: Int = 2 - val v2: String = "two" - val e2 = LastWriterWins.now("") + val k2: Int = 2 + val v2: String = "two" + val e2 = LastWriterWins.now("") val delta_2: Dotted[GrowOnlyMap[Int, LastWriterWins[String]]] = emptyMap.mutateKeyNamedCtx(k2, e2)(_.write(v2)) assertEquals(delta_2.context.internal, Map.empty) assertEquals(delta_2.data.keySet, Set(2)) assertEquals(delta_2.data.get(2).map(_.payload), Some("two")) - val merged: Dotted[GrowOnlyMap[Int, LastWriterWins[String]]] = Lattice[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]].merge(delta_1, delta_2) + val merged: Dotted[GrowOnlyMap[Int, LastWriterWins[String]]] = + Lattice[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]].merge(delta_1, delta_2) assertEquals(merged.context.internal, Map.empty) assertEquals(merged.data.keySet, Set(1, 2)) assertEquals(merged.data.get(1).map(_.payload), Some("one")) assertEquals(merged.data.get(2).map(_.payload), Some("two")) - val delta_1_diff_delta_2: Option[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]] = Lattice[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]].diff(delta_1, delta_2) + val delta_1_diff_delta_2: Option[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]] = + Lattice[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]].diff(delta_1, delta_2) assertEquals(delta_1_diff_delta_2, Some(delta_2), "delta_2 is not contained in delta_1") - val delta_2_diff_delta_1: Option[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]] = Lattice[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]].diff(delta_2, delta_1) + val delta_2_diff_delta_1: Option[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]] = + Lattice[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]].diff(delta_2, delta_1) assertEquals(delta_2_diff_delta_1, Some(delta_1), "delta_1 is not contained in delta_2") - val merged_diff_delta_1: Option[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]] = Lattice[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]].diff(merged, delta_1) + val merged_diff_delta_1: Option[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]] = + Lattice[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]].diff(merged, delta_1) assertEquals(merged_diff_delta_1, None, "delta_1 should be contained in merged") - val merged_diff_delta_2: Option[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]] = Lattice[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]].diff(merged, delta_2) + val merged_diff_delta_2: Option[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]] = + Lattice[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]].diff(merged, delta_2) assertEquals(merged_diff_delta_2, None, "delta_2 should be contained in merged") - val decomposed: Seq[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]] = Lattice[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]].decompose(merged).toSeq.sortBy(_.data.keys.headOption) + val decomposed: Seq[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]] = + Lattice[Dotted[GrowOnlyMap[Int, LastWriterWins[String]]]].decompose(merged).toSeq.sortBy(_.data.keys.headOption) // GrowOnlyMap decomposes every entry. // LastWriterWins does not decompose, only returns the value. // Dotted decomposes context and value, but as LWW is not contextual, the context is empty and there is no additional entry for it. @@ -348,8 +365,8 @@ class DecomposeManualTests extends munit.ScalaCheckSuite { val emptyMap: Dotted[GrowOnlyMap[Int, EnableWinsFlag]] = Dotted(Bottom[GrowOnlyMap[Int, EnableWinsFlag]].empty) - val k1: Int = 1 - val e1 = EnableWinsFlag.empty + val k1: Int = 1 + val e1 = EnableWinsFlag.empty val delta_1: Dotted[GrowOnlyMap[Int, EnableWinsFlag]] = emptyMap.mutateKeyNamedCtx(k1, e1)(_.enable(using r1)()) assertEquals(delta_1.context.internal.size, 1) assertEquals(delta_1.context.max(r1.uid), Some(Dot(r1.uid, 0))) @@ -358,15 +375,16 @@ class DecomposeManualTests extends munit.ScalaCheckSuite { // delta_1 and delta_2 are in parallel - val k2: Int = 2 - val e2 = EnableWinsFlag.empty + val k2: Int = 2 + val e2 = EnableWinsFlag.empty val delta_2: Dotted[GrowOnlyMap[Int, EnableWinsFlag]] = emptyMap.mutateKeyNamedCtx(k2, e2)(_.enable(using r2)()) assertEquals(delta_2.context.internal.size, 1) assertEquals(delta_2.context.max(r2.uid), Some(Dot(r2.uid, 0))) assertEquals(delta_2.data.keySet, Set(2)) assertEquals(delta_2.data.get(2).map(_.read), Some(true)) - val merged: Dotted[GrowOnlyMap[Int, EnableWinsFlag]] = Lattice[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]].merge(delta_1, delta_2) + val merged: Dotted[GrowOnlyMap[Int, EnableWinsFlag]] = + Lattice[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]].merge(delta_1, delta_2) assertEquals(merged.context.internal.size, 2) assertEquals(merged.context.max(r1.uid), Some(Dot(r1.uid, 0))) assertEquals(merged.context.max(r2.uid), Some(Dot(r2.uid, 0))) @@ -374,19 +392,24 @@ class DecomposeManualTests extends munit.ScalaCheckSuite { assertEquals(merged.data.get(1).map(_.read), Some(true)) assertEquals(merged.data.get(2).map(_.read), Some(true)) - val delta_1_diff_delta_2: Option[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]] = Lattice[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]].diff(delta_1, delta_2) + val delta_1_diff_delta_2: Option[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]] = + Lattice[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]].diff(delta_1, delta_2) assertEquals(delta_1_diff_delta_2, Some(delta_2), "delta_2 is not contained in delta_1") - val delta_2_diff_delta_1: Option[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]] = Lattice[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]].diff(delta_2, delta_1) + val delta_2_diff_delta_1: Option[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]] = + Lattice[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]].diff(delta_2, delta_1) assertEquals(delta_2_diff_delta_1, Some(delta_1), "delta_1 is not contained in delta_2") - val merged_diff_delta_1: Option[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]] = Lattice[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]].diff(merged, delta_1) + val merged_diff_delta_1: Option[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]] = + Lattice[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]].diff(merged, delta_1) assertEquals(merged_diff_delta_1, None, "delta_1 should be contained in merged") - val merged_diff_delta_2: Option[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]] = Lattice[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]].diff(merged, delta_2) + val merged_diff_delta_2: Option[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]] = + Lattice[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]].diff(merged, delta_2) assertEquals(merged_diff_delta_2, None, "delta_2 should be contained in merged") - val decomposed: Seq[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]] = Lattice[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]].decompose(merged).toSeq.sortBy(_.data.keys.headOption) + val decomposed: Seq[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]] = + Lattice[Dotted[GrowOnlyMap[Int, EnableWinsFlag]]].decompose(merged).toSeq.sortBy(_.data.keys.headOption) // GrowOnlyMap decomposes every entry and the context. // EnableWinsFlag is contextual. Every entry has its own required context. // The complete context is covered by the entries. diff --git a/Modules/RDTs/src/test/scala/test/kofre/bespoke/DottedTest.scala b/Modules/RDTs/src/test/scala/test/kofre/bespoke/DottedTest.scala index 9c2d19093..8b01fae09 100644 --- a/Modules/RDTs/src/test/scala/test/kofre/bespoke/DottedTest.scala +++ b/Modules/RDTs/src/test/scala/test/kofre/bespoke/DottedTest.scala @@ -10,17 +10,17 @@ class DottedTest extends munit.FunSuite { test("AuctionData can be in Dotted") { val auction: Dotted[AuctionData] = Dotted.empty - assert(auction.data.bids == Set.empty) + assert(auction.data.bids == Set.empty) assert(auction.data.status == AuctionInterface.Open) assert(auction.data.winner == None) val added = auction.bid("First", 1) - assert(added.data.bids == Set(Bid("First", 1))) + assert(added.data.bids == Set(Bid("First", 1))) assert(added.data.status == AuctionInterface.Open) assert(added.data.winner == None) val closed = added merge added.close() - assert(closed.data.bids == Set(Bid("First", 1))) + assert(closed.data.bids == Set(Bid("First", 1))) assert(closed.data.status == AuctionInterface.Closed) assert(closed.data.winner == Some("First")) } @@ -28,17 +28,17 @@ class DottedTest extends munit.FunSuite { test("AuctionData can be in DeltaBuffer") { val auction: DeltaBuffer[AuctionData] = DeltaBuffer(AuctionData.empty) - assert(auction.state.bids == Set.empty) + assert(auction.state.bids == Set.empty) assert(auction.state.status == AuctionInterface.Open) assert(auction.state.winner == None) val added = auction.bid("First", 1) - assert(added.state.bids == Set(Bid("First", 1))) + assert(added.state.bids == Set(Bid("First", 1))) assert(added.state.status == AuctionInterface.Open) assert(added.state.winner == None) val closed = added.close() - assert(closed.state.bids == Set(Bid("First", 1))) + assert(closed.state.bids == Set(Bid("First", 1))) assert(closed.state.status == AuctionInterface.Closed) assert(closed.state.winner == Some("First")) } @@ -46,17 +46,17 @@ class DottedTest extends munit.FunSuite { test("Dotted[AuctionData] can be in DeltaBuffer") { val auction: DeltaBuffer[Dotted[AuctionData]] = DeltaBuffer(Dotted.empty) - assert(auction.state.data.bids == Set.empty) + assert(auction.state.data.bids == Set.empty) assert(auction.state.data.status == AuctionInterface.Open) assert(auction.state.data.winner == None) val added = auction.bid("First", 1) - assert(added.state.data.bids == Set(Bid("First", 1))) + assert(added.state.data.bids == Set(Bid("First", 1))) assert(added.state.data.status == AuctionInterface.Open) assert(added.state.data.winner == None) val closed = added.close() - assert(closed.state.data.bids == Set(Bid("First", 1))) + assert(closed.state.data.bids == Set(Bid("First", 1))) assert(closed.state.data.status == AuctionInterface.Closed) assert(closed.state.data.winner == Some("First")) } @@ -82,17 +82,17 @@ class DottedTest extends munit.FunSuite { test("Dotted[AuctionData] can be in DeltaBufferContainer") { val auction: DeltaBufferContainer[Dotted[AuctionData]] = DeltaBufferContainer(DeltaBuffer(Dotted.empty)) - assert(auction.result.state.data.bids == Set.empty) + assert(auction.result.state.data.bids == Set.empty) assert(auction.result.state.data.status == AuctionInterface.Open) assert(auction.result.state.data.winner == None) val added = auction.bid("First", 1) - assert(added.result.state.data.bids == Set(Bid("First", 1))) + assert(added.result.state.data.bids == Set(Bid("First", 1))) assert(added.result.state.data.status == AuctionInterface.Open) assert(added.result.state.data.winner == None) val closed = added.close() - assert(closed.result.state.data.bids == Set(Bid("First", 1))) + assert(closed.result.state.data.bids == Set(Bid("First", 1))) assert(closed.result.state.data.status == AuctionInterface.Closed) assert(closed.result.state.data.winner == Some("First")) } diff --git a/Modules/RDTs/src/test/scala/test/kofre/bespoke/MultiVersionRegisterTest.scala b/Modules/RDTs/src/test/scala/test/kofre/bespoke/MultiVersionRegisterTest.scala index ca400446b..164adf2bb 100644 --- a/Modules/RDTs/src/test/scala/test/kofre/bespoke/MultiVersionRegisterTest.scala +++ b/Modules/RDTs/src/test/scala/test/kofre/bespoke/MultiVersionRegisterTest.scala @@ -15,8 +15,8 @@ class MultiVersionRegisterTest extends munit.FunSuite { val a = Dotted(MultiVersionRegister.empty[String]) - val alice = Uid.predefined("alice") - val bob = Uid.predefined("bob") + val alice = Uid.predefined("alice") + val bob = Uid.predefined("bob") val charlie = Uid.predefined("charlie") val b = a.write(using alice)("hi") diff --git a/Modules/RDTs/src/test/scala/test/kofre/bespoke/OpGraphTest.scala b/Modules/RDTs/src/test/scala/test/kofre/bespoke/OpGraphTest.scala index 4f70416d2..f8a8fc4ed 100644 --- a/Modules/RDTs/src/test/scala/test/kofre/bespoke/OpGraphTest.scala +++ b/Modules/RDTs/src/test/scala/test/kofre/bespoke/OpGraphTest.scala @@ -25,7 +25,7 @@ class OpGraphTest extends munit.FunSuite { assertEquals(r1r2.values, List("bye!", "hi!")) val deletion = r1r2.del() - val deleted = r1r2 merge deletion + val deleted = r1r2 merge deletion assertEquals(deleted.values, List()) diff --git a/Modules/RDTs/src/test/scala/test/kofre/bespoke/ReplicatedListTest.scala b/Modules/RDTs/src/test/scala/test/kofre/bespoke/ReplicatedListTest.scala index 23ad8e4df..d2e1243e2 100644 --- a/Modules/RDTs/src/test/scala/test/kofre/bespoke/ReplicatedListTest.scala +++ b/Modules/RDTs/src/test/scala/test/kofre/bespoke/ReplicatedListTest.scala @@ -47,22 +47,23 @@ class ReplicatedListTest extends munit.FunSuite { val mergedOrder = v2.data.order.value merge v3d.data.order.value val mergedLists: ReplicatedList[String] = v3d.data merge v2.data - val v3 = v2 merge v3d + val v3 = v2 merge v3d - assertEquals(v3.data.order.value.inner.get(GrowOnlyList.Node.Head), mergedLists.order.value.inner.get(GrowOnlyList.Node.Head)) + assertEquals( + v3.data.order.value.inner.get(GrowOnlyList.Node.Head), + mergedLists.order.value.inner.get(GrowOnlyList.Node.Head) + ) assertEquals(v3.data, mergedLists) - assertEquals(mergedLists.order.value.toList, List(Dot(aid,0), Dot(aid,1))) - assertEquals(mergedOrder.toList, List(Dot(aid,0), Dot(aid,1))) - assertEquals(v3.data.order.value.toList, List(Dot(aid,0), Dot(aid,1))) - + assertEquals(mergedLists.order.value.toList, List(Dot(aid, 0), Dot(aid, 1))) + assertEquals(mergedOrder.toList, List(Dot(aid, 0), Dot(aid, 1))) + assertEquals(v3.data.order.value.toList, List(Dot(aid, 0), Dot(aid, 1))) assertEquals(v3.toList, List("10", "20")) val v4 = v3 merge v3.insert(using aid)(1, "30") - assertEquals(v4.toList, List("10", "30", "20")) } diff --git a/Modules/RDTs/src/test/scala/test/kofre/containers/ContainerTest.scala b/Modules/RDTs/src/test/scala/test/kofre/containers/ContainerTest.scala index d8af229ed..241a638e2 100644 --- a/Modules/RDTs/src/test/scala/test/kofre/containers/ContainerTest.scala +++ b/Modules/RDTs/src/test/scala/test/kofre/containers/ContainerTest.scala @@ -31,7 +31,7 @@ class ContainerTest extends munit.FunSuite { test("Dotted can contain contextual EnableWinsFlag") { val flag: Dotted[EnableWinsFlag] = Dotted.empty - given ReplicaId = "me".asId + given ReplicaId = "me".asId assertEquals(flag.read, false) @@ -70,7 +70,6 @@ class ContainerTest extends munit.FunSuite { // END EnableWinsFlag - // START AddWinsSet test("Dotted can contain contextual AddWinsSet[String]") { @@ -119,7 +118,6 @@ class ContainerTest extends munit.FunSuite { // END AddWinsSet - // START LastWriterWins test("Dotted can contain non-contextual LastWriterWins[String]") { @@ -172,7 +170,6 @@ class ContainerTest extends munit.FunSuite { // END LastWriterWins - // START AuctionData test("plain AuctionData without container returns deltas") { @@ -204,17 +201,17 @@ class ContainerTest extends munit.FunSuite { test("Dotted can contain plain AuctionData") { val auction: Dotted[AuctionData] = Dotted.empty - assertEquals(auction.data.bids, Set.empty) + assertEquals(auction.data.bids, Set.empty) assertEquals(auction.data.status, AuctionInterface.Open) assertEquals(auction.data.winner, None) val added = auction.bid("First", 1) - assertEquals(added.data.bids, Set(Bid("First", 1))) + assertEquals(added.data.bids, Set(Bid("First", 1))) assertEquals(added.data.status, AuctionInterface.Open) assertEquals(added.data.winner, None) val closed = added merge added.close() - assertEquals(closed.data.bids, Set(Bid("First", 1))) + assertEquals(closed.data.bids, Set(Bid("First", 1))) assertEquals(closed.data.status, AuctionInterface.Closed) assertEquals(closed.data.winner, Some("First")) } @@ -222,17 +219,17 @@ class ContainerTest extends munit.FunSuite { test("Dotted DeltaBuffer can contain plain AuctionData") { val auction: DeltaBuffer[AuctionData] = DeltaBuffer(AuctionData.empty) - assertEquals(auction.state.bids, Set.empty) + assertEquals(auction.state.bids, Set.empty) assertEquals(auction.state.status, AuctionInterface.Open) assertEquals(auction.state.winner, None) val added = auction.bid("First", 1) - assertEquals(added.state.bids, Set(Bid("First", 1))) + assertEquals(added.state.bids, Set(Bid("First", 1))) assertEquals(added.state.status, AuctionInterface.Open) assertEquals(added.state.winner, None) val closed = added.close() - assertEquals(closed.state.bids, Set(Bid("First", 1))) + assertEquals(closed.state.bids, Set(Bid("First", 1))) assertEquals(closed.state.status, AuctionInterface.Closed) assertEquals(closed.state.winner, Some("First")) } @@ -240,17 +237,17 @@ class ContainerTest extends munit.FunSuite { test("Dotted DeltaBuffer can contain plain AuctionData") { val auction: DeltaBuffer[Dotted[AuctionData]] = DeltaBuffer(Dotted.empty) - assertEquals(auction.state.data.bids, Set.empty) + assertEquals(auction.state.data.bids, Set.empty) assertEquals(auction.state.data.status, AuctionInterface.Open) assertEquals(auction.state.data.winner, None) val added = auction.bid("First", 1) - assertEquals(added.state.data.bids, Set(Bid("First", 1))) + assertEquals(added.state.data.bids, Set(Bid("First", 1))) assertEquals(added.state.data.status, AuctionInterface.Open) assertEquals(added.state.data.winner, None) val closed = added.close() - assertEquals(closed.state.data.bids, Set(Bid("First", 1))) + assertEquals(closed.state.data.bids, Set(Bid("First", 1))) assertEquals(closed.state.data.status, AuctionInterface.Closed) assertEquals(closed.state.data.winner, Some("First")) } @@ -258,17 +255,17 @@ class ContainerTest extends munit.FunSuite { test("Dotted DeltaBufferContainer can contain plain AuctionData") { val auction: DeltaBufferContainer[Dotted[AuctionData]] = DeltaBufferContainer(DeltaBuffer(Dotted.empty)) - assertEquals(auction.result.state.data.bids, Set.empty) + assertEquals(auction.result.state.data.bids, Set.empty) assertEquals(auction.result.state.data.status, AuctionInterface.Open) assertEquals(auction.result.state.data.winner, None) auction.bid("First", 1) - assertEquals(auction.result.state.data.bids, Set(Bid("First", 1))) + assertEquals(auction.result.state.data.bids, Set(Bid("First", 1))) assertEquals(auction.result.state.data.status, AuctionInterface.Open) assertEquals(auction.result.state.data.winner, None) auction.close() - assertEquals(auction.result.state.data.bids, Set(Bid("First", 1))) + assertEquals(auction.result.state.data.bids, Set(Bid("First", 1))) assertEquals(auction.result.state.data.status, AuctionInterface.Closed) assertEquals(auction.result.state.data.winner, Some("First")) } diff --git a/Modules/RDTs/src/test/scala/test/kofre/corestructs/ArrayRangesTest.scala b/Modules/RDTs/src/test/scala/test/kofre/corestructs/ArrayRangesTest.scala index 5d443d9a3..832e9996a 100644 --- a/Modules/RDTs/src/test/scala/test/kofre/corestructs/ArrayRangesTest.scala +++ b/Modules/RDTs/src/test/scala/test/kofre/corestructs/ArrayRangesTest.scala @@ -262,7 +262,7 @@ class ArrayRangesTest extends munit.ScalaCheckSuite { assertEquals(leftSet.intersect(rightSet), leftSet, s"left: $left\nright: $right") assertEquals(leftSet.union(rightSet), rightSet) - assertEquals(lr.disjunct(rr), leftSet.intersect(rightSet).isEmpty ) + assertEquals(lr.disjunct(rr), leftSet.intersect(rightSet).isEmpty) } } diff --git a/Modules/RDTs/src/test/scala/test/kofre/corestructs/CompactTest.scala b/Modules/RDTs/src/test/scala/test/kofre/corestructs/CompactTest.scala index fbb3117f5..c5a173378 100644 --- a/Modules/RDTs/src/test/scala/test/kofre/corestructs/CompactTest.scala +++ b/Modules/RDTs/src/test/scala/test/kofre/corestructs/CompactTest.scala @@ -6,11 +6,10 @@ import kofre.time.{ArrayRanges, Dot, Dots, Time} import org.scalacheck.Prop.* import test.kofre.DataGenerator.* - class CompactTest extends munit.ScalaCheckSuite { test("basic compact test") { - val a1 = Uid.gen() + val a1 = Uid.gen() val left = Dotted(Set("a"), Dots.empty.add(Dot(a1, 1))) val middle = Dotted(Set("c"), Dots.empty.add(Dot(a1, 2))) diff --git a/Modules/RDTs/src/test/scala/test/kofre/corestructs/DotFunTest.scala b/Modules/RDTs/src/test/scala/test/kofre/corestructs/DotFunTest.scala index 8e9bbd898..8004a0e48 100644 --- a/Modules/RDTs/src/test/scala/test/kofre/corestructs/DotFunTest.scala +++ b/Modules/RDTs/src/test/scala/test/kofre/corestructs/DotFunTest.scala @@ -110,11 +110,11 @@ class DotFunTest extends munit.ScalaCheckSuite { } test("deletions are larger") { - val ia = Uid.gen() - val ib = Uid.gen() + val ia = Uid.gen() + val ib = Uid.gen() val someDot = Dot(ia, 1) - val left = Dotted(DotFun(Map(someDot -> 10)), Dots.single(someDot)) - val right = Dotted(DotFun.empty[Int], Dots.single(someDot)) + val left = Dotted(DotFun(Map(someDot -> 10)), Dots.single(someDot)) + val right = Dotted(DotFun.empty[Int], Dots.single(someDot)) assert(left <= right) diff --git a/Modules/Reactives/shared/src/main/scala/rescala/operator/EventBundle.scala b/Modules/Reactives/shared/src/main/scala/rescala/operator/EventBundle.scala index 9dfc9dfd3..de5abd8db 100644 --- a/Modules/Reactives/shared/src/main/scala/rescala/operator/EventBundle.scala +++ b/Modules/Reactives/shared/src/main/scala/rescala/operator/EventBundle.scala @@ -264,11 +264,9 @@ trait EventBundle extends FoldBundle { val res = block(using evt) CBR(evt, res) - case class CBR[T, R](event: Event[T], data: R) opaque type Accepts[T] = Evt[T] - /** The callback available within `fromCallback` */ def handle[T](using cbt: Accepts[T], scheduler: Scheduler[BundleState])(v: T): Unit = cbt.fire(v) diff --git a/Modules/Reactives/shared/src/main/scala/rescala/scheduler/TopoBundle.scala b/Modules/Reactives/shared/src/main/scala/rescala/scheduler/TopoBundle.scala index 295603e28..d2bee8560 100644 --- a/Modules/Reactives/shared/src/main/scala/rescala/scheduler/TopoBundle.scala +++ b/Modules/Reactives/shared/src/main/scala/rescala/scheduler/TopoBundle.scala @@ -1,8 +1,7 @@ package rescala.scheduler import rescala.core.{ - AccessHandler, AdmissionTicket, Initializer, Observation, ReSource, ReadAs, ReevTicket, SchedulerImpl, - Transaction + AccessHandler, AdmissionTicket, Initializer, Observation, ReSource, ReadAs, ReevTicket, SchedulerImpl, Transaction } import scala.collection.mutable.{ArrayBuffer, ListBuffer} diff --git a/Modules/Reactives/shared/src/main/scala/rescala/scheduler/Twoversion.scala b/Modules/Reactives/shared/src/main/scala/rescala/scheduler/Twoversion.scala index d88d0e93a..6f35ea1e8 100644 --- a/Modules/Reactives/shared/src/main/scala/rescala/scheduler/Twoversion.scala +++ b/Modules/Reactives/shared/src/main/scala/rescala/scheduler/Twoversion.scala @@ -29,7 +29,7 @@ trait Twoversion { owner = token } def base(token: Token): V = current - def get(token: Token): V = { if (token eq owner) update else current } + def get(token: Token): V = { if (token eq owner) update else current } def commit(r: V => V): Unit = { if (update != null) current = r(update) diff --git a/build.sbt b/build.sbt index f9bceed23..0412ad944 100644 --- a/build.sbt +++ b/build.sbt @@ -62,7 +62,7 @@ lazy val rescala = crossProject(JVMPlatform, JSPlatform, NativePlatform).in(file ) lazy val reswing = project.in(file("Modules/Swing")) - .settings(scalaVersion_3, noPublish, RescalaDependencies.scalaSwing) + .settings(scalaVersion_3, noPublish, RescalaDependencies.scalaSwing) .dependsOn(rescala.jvm) lazy val rescalafx = project.in(file("Modules/Javafx")) @@ -102,7 +102,7 @@ lazy val aead = crossProject(JSPlatform, JVMPlatform).in(file("Modules/Aead")) Dependencies.munitCheck, ) .jvmSettings( - RescalaDependencies.tink + RescalaDependencies.tink ) .jsConfigure(_.enablePlugins(ScalablyTypedConverterPlugin)) .jsSettings( diff --git a/project/RescalaDependencies.scala b/project/RescalaDependencies.scala index f7a115df9..475a49e23 100644 --- a/project/RescalaDependencies.scala +++ b/project/RescalaDependencies.scala @@ -7,14 +7,14 @@ import Settings.{`is 3`, `is 2.11`} object RescalaDependencies { val scalatest = libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.17" % Test - val circe = libraryDependencies ++= Seq("core", "generic", "parser").map(n => "io.circe" %%% s"circe-$n" % "0.14.3") + val circe = libraryDependencies ++= Seq("core", "generic", "parser").map(n => "io.circe" %%% s"circe-$n" % "0.14.3") val scalaReflectProvided = libraryDependencies ++= (if (`is 3`(scalaVersion.value)) None else Some(scalaOrganization.value % "scala-reflect" % scalaVersion.value % "provided")) val scalatestpluscheck = libraryDependencies += (if (`is 2.11`(scalaVersion.value)) - "org.scalatestplus" %%% "scalacheck-1-15" % "3.2.4.0-M1" % "test" - else "org.scalatestplus" %%% "scalacheck-1-17" % "3.2.17.0" % "test") + "org.scalatestplus" %%% "scalacheck-1-15" % "3.2.4.0-M1" % "test" + else "org.scalatestplus" %%% "scalacheck-1-17" % "3.2.17.0" % "test") val retypecheck = libraryDependencies += ( if (`is 3`(scalaVersion.value)) None else Some("io.github.scala-loci" %% "retypecheck" % "0.10.0") @@ -30,9 +30,8 @@ object RescalaDependencies { ) } - // warning, maven/coursier seems to think tere is a version 1.8.0, but that is not officially released - val tink = libraryDependencies +="com.google.crypto.tink" % "tink" % "1.7.0" + val tink = libraryDependencies += "com.google.crypto.tink" % "tink" % "1.7.0" val scalaSwing = libraryDependencies += "org.scala-lang.modules" %% "scala-swing" % "3.0.0"