public void SaveInfoTreeTest() { var generator = new FullProgramGenerator <MathProgram, double>(); var tree = new InformationTree <MathProgram>(); for (var i = 0; i < NUM_PROGS; i++) { var prog = generator.Generate(MathPrimitiveSets.Default, MAX_DEPTH); tree.AddProgram(prog); Console.WriteLine(prog); } var fullPath = Path.GetFullPath("."); var imgPath = Path.Combine(fullPath, $"{INFO_FILE_NAME}.dot.png"); File.Delete(imgPath); var dotPath = tree.ToGraphvizFile(fullPath, INFO_FILE_NAME, GraphvizImageType.Png, WAIT_TIMEOUT); Console.WriteLine(imgPath); Assert.IsTrue(File.Exists(dotPath), $"Dot file with information tree should exist in {dotPath}"); Assert.IsTrue(new FileInfo(dotPath).Length > 0, "Dot file size should be > 0 bytes."); Assert.IsTrue(File.Exists(imgPath), $"Image file with information tree should exist in {imgPath}"); Assert.IsTrue(new FileInfo(imgPath).Length > 0, "Image size should be > 0 bytes."); #if !DEBUG File.Delete(dotPath); File.Delete(imgPath); #endif }
public void SaveInfoTreeTest() { var prog = new FullProgramGenerator <MathProgram, double>().Generate(MathPrimitiveSets.Default, 4); Console.WriteLine(prog); var tree = new InformationTree <MathProgram>(); tree.AddProgram(prog); var fullPath = Path.Combine(Path.GetFullPath("."), INFO_FILE_NAME); File.Delete(fullPath); tree.ToD3JsonFile(fullPath); Console.WriteLine(fullPath); Assert.IsTrue(File.Exists(fullPath), $"Image file with information tree should exist in {fullPath}."); Assert.IsTrue(new FileInfo(fullPath).Length > 0, "Image size should be > 0 bytes."); #if !DEBUG File.Delete(fullPath); #endif }