package day25 import ( "testing" ) func TestReadFileExample(t *testing.T) { filename := "example" g := ReadGraphFile(filename) t.Logf("read graph %+v", g) } func TestRemoveEdge(t *testing.T) { filename := "example" g := ReadGraphFile(filename) t.Logf("read graph %+v", g) g.RemoveEdge("bvb", "hfx") t.Logf("after removing bvb-hfv %+v", g) } func TestRunFindCycle(t *testing.T) { filename := "example" g := ReadGraphFile(filename) g.DoThreeRemovals() } func TestCreateExampleMermaid(t *testing.T) { filename := "example" g := ReadGraphFile(filename) g.SaveAsMermaid("example-graph.mmd") } func TestComponentOnInitial(t *testing.T) { // should be all nodes filename := "example" g := ReadGraphFile(filename) comp := g.ComponentFrom("bvb") t.Logf("got component %+v", comp) if comp.Cardinality() != len(g.Nodes) { t.Errorf("should have same size!") } } func TestComponentOnMini(t *testing.T) { // should be all nodes filename := "example2" g := ReadGraphFile(filename) comp := g.ComponentFrom("jqt") t.Logf("got component %+v", comp) if comp.Cardinality() == len(g.Nodes) { t.Errorf("should have different size!") } } func TestRemoveAllCycles(t *testing.T) { filename := "example" g := ReadGraphFile(filename) g.SaveAsMermaid("example-before-removing.mmd") edges := g.RemoveAllCycles() t.Logf("removed edges %+v", edges) g.SaveAsMermaid("example-after-removing.mmd") }