コード例 #1
0
        // [Test, TestCaseSource(typeof(TestCaseFactory), "ClusterImplicitCases")]
        public void CorrectClusterCounts(string inputFile, string outputFile)
        {
            (var info, var graph) = ImplicitClusterLoader.LoadData(inputFile);
            var count    = ImplicitClusterLoader.CountClusters(info, graph);
            var expected = File.ReadLines(outputFile).WhereNotNull().Select(int.Parse).First();

            Assert.AreEqual(expected, count);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            (var count, var data) = ExplicitClusterLoader.LoadData("cluster1_data.txt");
            var spacing = ExplicitClusterLoader.CalculateSpacing(count, data);

            Console.WriteLine($"Explicit problem - max cluster spacing: {spacing}");

            (var info, var data2) = ImplicitClusterLoader.LoadData("cluster2_data.txt");
            var count2 = ImplicitClusterLoader.CountClusters(info, data2);

            Console.WriteLine($"Implicit problem - count needed for 3-spacing: {count2}");
        }