From 7b52f3b64002b5736bcdd4c871bd7d8f82e9d1f3 Mon Sep 17 00:00:00 2001 From: James Bowden <jbowden@caltech.edu> Date: Sun, 19 Feb 2023 17:07:32 -0800 Subject: [PATCH] add more wheel graph tests! --- .../caltech/cs2/project06/DSaturTests.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tests/edu/caltech/cs2/project06/DSaturTests.java b/tests/edu/caltech/cs2/project06/DSaturTests.java index 36093bc..5a2a579 100644 --- a/tests/edu/caltech/cs2/project06/DSaturTests.java +++ b/tests/edu/caltech/cs2/project06/DSaturTests.java @@ -157,12 +157,14 @@ public class DSaturTests { checkValidNColoring(g, K); } - @Test @Tag("B") - @DisplayName("Test DSatur on wheel graph (guaranteed optimal)") - public void testWheel() { - int K = 6; - NodeGraph g = new NodeGraph(K + 1); + @DisplayName("Test DSatur on various wheel graphs (guaranteed optimal)") + @ParameterizedTest(name = "Test DSatur on wheel graph with {0} vertices") + @CsvSource({"6","7","8","9","10","25","100","501","1000"}) + public void testWheel(int T) { + // K is number of outer vertices + int K = T-1; + NodeGraph g = new NodeGraph(T); for (int i = 0; i < K + 1; i++) { g.addEdge(i % K, (i + 1) % K); } @@ -171,7 +173,13 @@ public class DSaturTests { } DSatur.color(g); - checkValidNColoring(g, 3); + int maxColors; + if (K % 2 == 0){ + maxColors = 3; + } else { + maxColors = 4; + } + checkValidNColoring(g, maxColors); } @Tag("B") -- GitLab