Exemplo n.º 1
0
        public void Crew_AllocatesGeneralist()
        {
            // This one ends up just going through the slot-assignment process twice
            var generalist = new StubSkilledCrewman("food", 5, "tech", 5);
            var part1      = new StubCrewRequirement("food", 1);
            var part2      = new StubCrewRequirement("food", 4);
            var part3      = new StubCrewRequirement("tech", 1);
            var part4      = new StubCrewRequirement("tech", 1);

            // Note the order is important - if we put the single-assignments up first, it would just go
            // through once
            AssertAssignsAll(bio1, generalist, sci1, eng1, part1, part2, part3, part4);
        }
Exemplo n.º 2
0
        public void Crew_Pathological()
        {
            // The categorization scheme should work for any sensible means of defining crew capabilities.
            // But there's code in there that will unstick the algorithm, at the expensive of maybe not coming
            // up with an ideal crew assignment.
            var crew1 = new StubSkilledCrewman("part1", 1, "part2", 1);
            var crew2 = new StubSkilledCrewman("part2", 1, "part3", 1);
            var crew3 = new StubSkilledCrewman("part3", 1, "part1", 1);
            var part1 = new StubCrewRequirement("part1", 1);
            var part2 = new StubCrewRequirement("part2", 1);
            var part3 = new StubCrewRequirement("part3", 1);

            // TODO: HUH?  How did this work in the past?  3 crew given but requires 6!
            AssertAssignsAll(crew1, crew2, crew3, part1, part2, part3);
        }
Exemplo n.º 3
0
        public void Crew_AllocatesGeneralist_CombinesCategories()
        {
            // This one forces things so that it does the single-assignments and then
            // discoveres there's just one category
            var generalist1 = new StubSkilledCrewman("food", 5, "tech", 5);
            var generalist2 = new StubSkilledCrewman("food", 5, "tech", 5);
            var part1       = new StubCrewRequirement("food", 1)
            {
                CapacityRequired = 2f
            };
            var part2 = new StubCrewRequirement("tech", 1)
            {
                CapacityRequired = 2f
            };

            AssertAssignsAll(sci1, eng1, generalist1, generalist2, part1, part2);
        }