Skip to content

Commit

Permalink
fix(plugin24): make board XML more intuitive
Browse files Browse the repository at this point in the history
  • Loading branch information
xeruf committed Mar 11, 2024
1 parent 4a05ed1 commit 032b4a3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions plugin/src/main/kotlin/sc/plugin2024/Segment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ val Segments.rectangleSize: Coordinates
@XStreamAlias("segment")
data class Segment(
@XStreamAsAttribute val direction: CubeDirection,
//@XStreamOmitField
// could be omitted but helpful since ships also come with cubecoords @XStreamOmitField
val center: CubeCoordinates,
@XStreamImplicit val fields: SegmentFields,
@XStreamImplicit(itemFieldName = "column") val fields: SegmentFields,
): PublicCloneable<Segment> {

val tip: CubeCoordinates
Expand Down
21 changes: 10 additions & 11 deletions plugin/src/test/kotlin/sc/plugin2024/BoardTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -164,38 +164,37 @@ class BoardTest: FunSpec({

context("XML Serialization of") {
test("few segments") {
// TODO column rather than field-array
val serializedSegment = """
<segment direction="RIGHT">
<center q="0" r="0" s="0"/>
<field-array>
<column>
<water/>
<water/>
<water/>
<water/>
<water/>
</field-array>
<field-array>
</column>
<column>
<water/>
<water/>
<water/>
<water/>
<water/>
</field-array>
<field-array>
</column>
<column>
<water/>
<water/>
<water/>
<water/>
<water/>
</field-array>
<field-array>
</column>
<column>
<water/>
<water/>
<water/>
<water/>
<water/>
</field-array>
</column>
</segment>"""
val serialized = """
<board nextDirection="RIGHT">$serializedSegment
Expand Down Expand Up @@ -236,13 +235,13 @@ class BoardTest: FunSpec({
<board nextDirection="UP_LEFT">
<segment direction="UP_LEFT">
<center q="1" r="1" s="-2"/>
<field-array>
<column>
<water/>
<goal/>
<island/>
<sandbank/>
<passenger direction="RIGHT" passenger="1"/>
</field-array>
</column>
</segment>
</board>"""
}
Expand Down

0 comments on commit 032b4a3

Please sign in to comment.