Пример #1
0
        public void ConstructorWithZeros(FormatFactory.Formats type)
        {
            type = FormatFactory.Formats.Skyline;
            var exploredMatrix  = FormatFactory.Convert(coordinationalMatrix, type);
            var backCoordMatrix = exploredMatrix.ConvertToCoordinationalMatrix();

            size    = 3;
            values  = new double[] { 1, 4, 5, 6, 2, 0, 8, 0, 3 };
            columns = new int[] { 0, 1, 2, 0, 1, 2, 0, 1, 2 };
            rows    = new int[] { 0, 0, 0, 1, 1, 1, 2, 2, 2 };

            coordinationalMatrix = new CoordinationalMatrix(rows, columns, values, size);

            Assert.True(new HashSet <(double, int, int)>(coordinationalMatrix).SetEquals(backCoordMatrix));
            //Assert.True((coordinationalMatrix).Equals(backCoordMatrix));



            //var formatFactory = new FormatFactory();
            //
            //foreach (var type in formatFactory.formats)
            //{
            //    var exploredMatrix = FormatFactory.Convert(coordinationalMatrix, type.Key);
            //    var backCoordMatrix = exploredMatrix.ConvertToCoordinationalMatrix();
            //    Assert.True(new HashSet<(double, int, int)>(coordinationalMatrix).SetEquals(backCoordMatrix));
            //}
        }
        public void Constructor(FormatFactory.Formats type)
        {
            var exploredMatrix  = FormatFactory.Convert(symmetricCoordinationalMatrix, type);
            var backCoordMatrix = exploredMatrix.ConvertToCoordinationalMatrix();

            Assert.True(new HashSet <(double, int, int)>(symmetricCoordinationalMatrix).SetEquals(backCoordMatrix));

            // var formatFactory = new FormatFactory();
            //
            // foreach (var type in formatFactory.formats)
            // {
            //     var exploredMatrix = FormatFactory.Convert(symmetricCoordinationalMatrix, type.Key);
            //     var backCoordMatrix = exploredMatrix.ConvertToCoordinationalMatrix();
            //     Assert.True(new HashSet<(double, int, int)>(symmetricCoordinationalMatrix).SetEquals(backCoordMatrix));
            // }
        }