-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to latest version and some cleanups.
- Update to latest versions of dependencies - Add upickle to benchmarks - Some tweaks to proto serialization (caching size, utf8, etc.)
- Loading branch information
Showing
21 changed files
with
364 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
target/ | ||
.bloop/ | ||
.metals/ | ||
_site/ | ||
.idea/ | ||
.bsp/ | ||
_site/ | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
compliance/src/main/scala/sauerkraut/format/testing/FieldTests.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package sauerkraut | ||
package format | ||
package testing | ||
|
||
import org.junit.Test | ||
import sauerkraut.core.{Buildable, Writer, given} | ||
import scala.collection.mutable.ArrayBuffer | ||
|
||
object FieldTests: | ||
// Nested structures with non-standard field numbers | ||
case class SimpleMessage(value: Int @Field(2), message: String @Field(1)) | ||
derives Writer, Buildable | ||
case class LargerMessage( | ||
messages: ArrayBuffer[SimpleMessage] @Field(1), | ||
otherNums: ArrayBuffer[Double] @Field(2), | ||
ints: ArrayBuffer[Long] @Field(3) | ||
) derives Writer, Buildable | ||
|
||
/** Compliance tests that check serialization using @Field annotation. */ | ||
trait FieldTests extends ComplianceTestBase: | ||
@Test def testFieldOutOfOrder(): Unit = | ||
import FieldTests.SimpleMessage | ||
roundTrip(SimpleMessage(231415325, "A test of out of order")) | ||
@Test def testNestedStructureWithFieldNumbers(): Unit = | ||
import FieldTests.{LargerMessage, SimpleMessage} | ||
roundTrip( | ||
LargerMessage( | ||
messages = ArrayBuffer( | ||
SimpleMessage(1124312542, "This is a test of simple byte serialization for us all"), | ||
SimpleMessage(0, ""), | ||
SimpleMessage(-1, "ANother string")), | ||
otherNums = ArrayBuffer(1.0, -0.000001, 1000000000000000.0101010), | ||
ints = ArrayBuffer(1,2,3,4,5,-1,-2,-4,1425,0) | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.