From 6c417de958d9a15d44263ac97a1c51cfefbff98b Mon Sep 17 00:00:00 2001 From: Kah Goh Date: Fri, 19 Jun 2026 21:11:52 +0800 Subject: [PATCH 1/2] Update dot dsl exercise --- exercises/practice/dot-dsl/.meta/tests.toml | 90 +++++++++++++++++++ .../dot-dsl/src/test/java/GraphTest.java | 41 +++++++-- 2 files changed, 125 insertions(+), 6 deletions(-) create mode 100644 exercises/practice/dot-dsl/.meta/tests.toml diff --git a/exercises/practice/dot-dsl/.meta/tests.toml b/exercises/practice/dot-dsl/.meta/tests.toml new file mode 100644 index 000000000..bb285760c --- /dev/null +++ b/exercises/practice/dot-dsl/.meta/tests.toml @@ -0,0 +1,90 @@ +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. + +[3a50c618-2571-466b-9ee9-346d9943912e] +description = "empty graph" + +[5067feea-e49b-4a9d-865e-4502d6b0540c] +description = "graph with one node" + +[b66cf871-88c6-489a-b0b9-7c79b6819c45] +description = "graph with one node with attribute" + +[f7841da3-c0f8-4541-b594-21b626a764d2] +description = "graph with one edge" + +[bbee70e1-6b0d-4f3a-bd4e-41cd2cfc0e39] +description = "graph with one attribute" + +[ac736158-6684-418d-93d5-7b284e43294e] +description = "graph with comments" +comment = "Not possible to create scenario in test" +include = false + +[69068da9-7690-4d4d-a728-f5c2bf132a33] +description = "graph with nodes, edges, and attributes" + +[f6c53993-3937-4959-bcde-dc16411113ae] +description = "multiple edges on one line" + +[b853dfc1-1f05-45aa-bc98-b0fc6b57529b] +description = "only 1 edge between nodes" +include = false + +[bdc0fdac-aa46-457f-8385-65736ccdc1c7] +description = "malformed input" +comment = "Not possible to create the scenario in test" +include = false + +[f5c4f77d-359c-434a-9c33-b9eb795bafdd] +description = "malformed edge" +comment = "Not possible to create the scenario in test" +include = false + +[2238f6b8-20bb-489f-8ca0-084d1771d758] +description = "malformed edge 2" +comment = "Not possible to create the scenario in test" +include = false + +[4e3a4386-9e80-4315-b70f-253a06a2234e] +description = "invalid edge type" +comment = "Not possible to create the scenario in test" +include = false + +[793adce3-bd19-4458-ac41-c989f7f8d9db] +description = "multiple edges missing a node" +comment = "Not possible to create the scenario in test" +include = false + +[e2930b2c-3a03-4d8f-abe9-78a125a915a7] +description = "multiple edges missing a connector" +comment = "Not possible to create the scenario in test" +include = false + +[55d3f722-f9f1-46e1-b308-da61607952ab] +description = "empty attribute" +comment = "Not possible to create the scenario in test" +include = false + +[4ee2a9c3-54b1-4825-bd58-2b78c2c53953] +description = "malformed attribute" +comment = "Not possible to create the scenario in test" +include = false + +[382a13c8-6419-4286-8dd2-eac708f3e2a8] +description = "empty attribute name" +comment = "Not possible to create the scenario in test" +include = false + +[a6f9e6ab-8c3e-4475-a9fe-5dd061cadec6] +description = "non-alphanumeric node name" +comment = "Not possible to create the scenario in test" +include = false diff --git a/exercises/practice/dot-dsl/src/test/java/GraphTest.java b/exercises/practice/dot-dsl/src/test/java/GraphTest.java index 34c9c0a56..d82c0a22e 100644 --- a/exercises/practice/dot-dsl/src/test/java/GraphTest.java +++ b/exercises/practice/dot-dsl/src/test/java/GraphTest.java @@ -31,8 +31,8 @@ public void testGraphWithOneNode() { @Test @Disabled - @DisplayName("graph with one node with keywords") - public void testGraphWithOneNodeWithKeywords() { + @DisplayName("graph with one node with attribute") + public void testGraphWithOneNodeWithAttribute() { Graph graph = new Graph().node("a", Map.of("color", "green")); assertThat(graph.getNodes()) @@ -55,8 +55,8 @@ public void testGraphWithOneEdge() { @Test @Disabled - @DisplayName("graph with one edge with keywords") - public void testGraphWithOneEdgeWithKeywords() { + @DisplayName("graph with one edge with attribute") + public void testGraphWithOneEdgeWithAttribute() { Graph graph = new Graph().edge("a", "b", Map.of("color", "blue")); assertThat(graph.getNodes()).isEmpty(); @@ -78,8 +78,8 @@ public void testGraphWithOneAttribute() { @Test @Disabled - @DisplayName("graph with attributes") - public void testGraphWithAttributes() { + @DisplayName("graph with nodes, edges, and attributes") + public void testGraphWithNodesEdgesAndAttributes() { Graph graph = new Graph(Map.of("foo", "1", "title", "Testing Attrs", "bar", "true")) .node("a", Map.of("color", "green")) .node("c") @@ -102,4 +102,33 @@ public void testGraphWithAttributes() { .containsExactlyInAnyOrderEntriesOf( Map.of("foo", "1", "title", "Testing Attrs", "bar", "true")); } + + @Test + @Disabled + @DisplayName("multiple edges on one line") + public void testMultipleEdgesOnOneLine() { + Graph graph = new Graph() + .node("a") + .node("b") + .node("c") + .node("d") + .edge("a", "b", Map.of("style", "dotted")) + .edge("b", "c", Map.of("style", "dotted")) + .edge("c", "d", Map.of("style", "dotted")); + + assertThat(graph.getNodes()).containsExactlyInAnyOrder( + new Node("a"), + new Node("b"), + new Node("c"), + new Node("d") + ); + + assertThat(graph.getEdges()) + .containsExactlyInAnyOrder( + new Edge("a", "b", Map.of("style", "dotted")), + new Edge("b", "c", Map.of("style", "dotted")), + new Edge("c", "d", Map.of("style", "dotted")) + ); + assertThat(graph.getAttributes()).isEmpty(); + } } From 3a57f368e59a3d2ed538e684dc044a85986eae1f Mon Sep 17 00:00:00 2001 From: Kah Goh Date: Fri, 19 Jun 2026 21:24:24 +0800 Subject: [PATCH 2/2] Fix formating --- .../practice/dot-dsl/src/test/java/GraphTest.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/exercises/practice/dot-dsl/src/test/java/GraphTest.java b/exercises/practice/dot-dsl/src/test/java/GraphTest.java index d82c0a22e..93a6df747 100644 --- a/exercises/practice/dot-dsl/src/test/java/GraphTest.java +++ b/exercises/practice/dot-dsl/src/test/java/GraphTest.java @@ -2,6 +2,7 @@ import static org.assertj.core.api.Assertions.assertThat; import java.util.Map; + import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -95,7 +96,7 @@ public void testGraphWithNodesEdgesAndAttributes() { assertThat(graph.getEdges()) .containsExactlyInAnyOrder( - new Edge("a", "b", Map.of("color", "blue")), + new Edge("a", "b", Map.of("color", "blue")), new Edge("b", "c")); assertThat(graph.getAttributes()) @@ -124,11 +125,11 @@ public void testMultipleEdgesOnOneLine() { ); assertThat(graph.getEdges()) - .containsExactlyInAnyOrder( - new Edge("a", "b", Map.of("style", "dotted")), - new Edge("b", "c", Map.of("style", "dotted")), - new Edge("c", "d", Map.of("style", "dotted")) - ); + .containsExactlyInAnyOrder( + new Edge("a", "b", Map.of("style", "dotted")), + new Edge("b", "c", Map.of("style", "dotted")), + new Edge("c", "d", Map.of("style", "dotted")) + ); assertThat(graph.getAttributes()).isEmpty(); } }