Skip to content

Commit

Permalink
Merge pull request #6 from adamconkey/feature/issue-5_serialize_polygons
Browse files Browse the repository at this point in the history
Add basic JSON serialization and deserialization
  • Loading branch information
adamconkey authored Nov 1, 2024
2 parents fa28d1c + 83bf87d commit 23ea0d9
Show file tree
Hide file tree
Showing 9 changed files with 302 additions and 106 deletions.
67 changes: 57 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ edition = "2021"

[dependencies]

indexmap = "*"
indexmap = {version = "2.6.0", features = ["serde"]}
itertools = "*"
lazy_static = "1.5.0"
rstest = "*"
rstest = "0.23.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
unique_id = "*"
10 changes: 10 additions & 0 deletions resources/test/polygon_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"vertices": {
"a": {"x": 0, "y": 0, "id": "a"},
"b": {"x": 3, "y": 4, "id": "b"},
"c": {"x": 6, "y": 2, "id": "c"},
"d": {"x": 7, "y": 6, "id": "d"},
"e": {"x": 3, "y": 9, "id": "e"},
"f": {"x": -2, "y": 7, "id": "f"}
}
}
22 changes: 22 additions & 0 deletions resources/test/polygon_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"vertices": {
"0": {"x": 0, "y": 0, "id": "0"},
"1": {"x": 12, "y": 9, "id": "1"},
"2": {"x": 14, "y": 4, "id": "2"},
"3": {"x": 24, "y": 10, "id": "3"},
"4": {"x": 14, "y": 24, "id": "4"},
"5": {"x": 11, "y": 17, "id": "5"},
"6": {"x": 13, "y": 19, "id": "6"},
"7": {"x": 14, "y": 12, "id": "7"},
"8": {"x": 9, "y": 13, "id": "8"},
"9": {"x": 7, "y": 18, "id": "9"},
"10": {"x": 11, "y": 21, "id": "10"},
"11": {"x": 8, "y": 24, "id": "11"},
"12": {"x": 1, "y": 22, "id": "12"},
"13": {"x": 2, "y": 18, "id": "13"},
"14": {"x": 4, "y": 20, "id": "14"},
"15": {"x": 6, "y": 10, "id": "15"},
"16": {"x": -2, "y": 11, "id": "16"},
"17": {"x": 6, "y": 6, "id": "17"}
}
}
7 changes: 7 additions & 0 deletions resources/test/right_triangle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"vertices": {
"a": {"x": 0, "y": 0, "id": "a"},
"b": {"x": 3, "y": 0, "id": "b"},
"c": {"x": 0, "y": 4, "id": "c"}
}
}
8 changes: 8 additions & 0 deletions resources/test/square_4x4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"vertices": {
"a": {"x": 0, "y": 0, "id": "a"},
"b": {"x": 4, "y": 0, "id": "b"},
"c": {"x": 4, "y": 4, "id": "c"},
"d": {"x": 0, "y": 4, "id": "d"}
}
}
Loading

0 comments on commit 23ea0d9

Please sign in to comment.