示例#1
0
        public void Test32()
        {
            // Arrange
            int[][] people = { new[] { 1, 1 }, new[] { 4, 1 }, new[] { 2, 2 }, new[] { 6, 3 }, new[] { 3, 4 }, new[] { 0, 5 } };

            // Act
            var(minX, minY) = GP22.GetMeetingLocation5(people);

            // Assert
            var distance = GP22.TotalDistance(people, minX, minY);

            Assert.AreEqual(18, distance);
        }
示例#2
0
        public void Test21()
        {
            // Arrange
            int[][] people = { new[] { 1, 1 }, new[] { 2, 3 }, new[] { 4, 2 }, new[] { 4, 4 } };

            // Act
            var(minX, minY) = GP22.GetMeetingLocation2(people);

            // Assert
            var distance = GP22.TotalDistance(people, minX, minY);

            Assert.AreEqual(9, distance);
        }
示例#3
0
        public void Test33()
        {
            // Arrange
            var random   = new Random(DateTime.Now.Millisecond);
            var nPeoples = random.Next(5, 100);
            var people   = Enumerable.Range(0, nPeoples).Select(i => new[] { random.Next(1, 100), random.Next(1, 100) })
                           .ToArray();

            // Act
            var(minX, minY) = GP22.GetMeetingLocation1(people);
            var expectedDistance = GP22.TotalDistance(people, minX, minY);

            (minX, minY) = GP22.GetMeetingLocation5(people);
            var distance = GP22.TotalDistance(people, minX, minY);

            // Assert
            Assert.AreEqual(expectedDistance, distance);
        }