예제 #1
0
        public void LocateAllScanners()
        {
            var sut = new NavigationSystem(SAMPLE_COORDINATES);

            sut.CalculateDistances();
            sut.FindPossibleIntersectingBeacons();

            Assert.Collection(sut.GetScannerPositions(),
                              p0 => Assert.Equal((0, 0, 0), p0),
                              p1 => Assert.Equal((68, -1246, -43), p1),
                              p2 => Assert.Equal((1105, -1205, 1229), p2),
                              p3 => Assert.Equal((-92, -2380, -20), p3),
                              p4 => Assert.Equal((-20, -1133, 1061), p4));
        }
예제 #2
0
        public void LocateScannersAroundScanner0_WhenThereAreThreeScanners()
        {
            const string data = @"--- scanner 0 ---
404,-588,-901
528,-643,409
-838,591,734
390,-675,-793
-537,-823,-458
-485,-357,347
-345,-311,381
-661,-816,-575
-876,649,763
-618,-824,-621
553,345,-567
474,580,667
-447,-329,318
-584,868,-557
544,-627,-890
564,392,-477
455,729,728
-892,524,684
-689,845,-530
423,-701,434
7,-33,-71
630,319,-379
443,580,662
-789,900,-551
459,-707,401

--- scanner 1 ---
686,422,578
605,423,415
515,917,-361
-336,658,858
95,138,22
-476,619,847
-340,-569,-846
567,-361,727
-460,603,-452
669,-402,600
729,430,532
-500,-761,534
-322,571,750
-466,-666,-811
-429,-592,574
-355,545,-477
703,-491,-529
-328,-685,520
413,935,-424
-391,539,-444
586,-435,557
-364,-763,-893
807,-499,-711
755,-354,-619
553,889,-390

--- scanner 4 ---
727,592,562
-293,-554,779
441,611,-461
-714,465,-776
-743,427,-804
-660,-479,-426
832,-632,460
927,-485,-438
408,393,-506
466,436,-512
110,16,151
-258,-428,682
-393,719,612
-211,-452,876
808,-476,-593
-575,615,604
-485,667,467
-680,325,-822
-627,-443,-432
872,-547,-609
833,512,582
807,604,487
839,-516,451
891,-625,532
-652,-548,-490
30,-46,-14";

            var sut = new NavigationSystem(data);

            sut.CalculateDistances();
            sut.FindPossibleIntersectingBeacons();

            Assert.Collection(sut.GetScannerPositions(),
                              p1 => Assert.Equal((0, 0, 0), p1),
                              p2 => Assert.Equal((68, -1246, -43), p2),
                              p3 => Assert.Equal((-20, -1133, 1061), p3));
        }
예제 #3
0
        public void LocateScannersAroundScanner0_WhenThereAreTwoScanners()
        {
            const string data = @"--- scanner 0 ---
404,-588,-901
528,-643,409
-838,591,734
390,-675,-793
-537,-823,-458
-485,-357,347
-345,-311,381
-661,-816,-575
-876,649,763
-618,-824,-621
553,345,-567
474,580,667
-447,-329,318
-584,868,-557
544,-627,-890
564,392,-477
455,729,728
-892,524,684
-689,845,-530
423,-701,434
7,-33,-71
630,319,-379
443,580,662
-789,900,-551
459,-707,401

--- scanner 1 ---
686,422,578
605,423,415
515,917,-361
-336,658,858
95,138,22
-476,619,847
-340,-569,-846
567,-361,727
-460,603,-452
669,-402,600
729,430,532
-500,-761,534
-322,571,750
-466,-666,-811
-429,-592,574
-355,545,-477
703,-491,-529
-328,-685,520
413,935,-424
-391,539,-444
586,-435,557
-364,-763,-893
807,-499,-711
755,-354,-619
553,889,-390";

            var sut = new NavigationSystem(data);

            sut.CalculateDistances();
            sut.FindPossibleIntersectingBeacons();

            Assert.Collection(sut.GetScannerPositions(),
                              p1 => Assert.Equal((0, 0, 0), p1),
                              p2 => Assert.Equal((68, -1246, -43), p2));
        }