コード例 #1
0
        public void Test_StateTable_GetStateOfDefinitelyOccupied_2()
        {
            var input = Permutator.Run_v2_withoutConsideringWeekNumber(TestData
                                                                       .GetSlotsByName(TestData.Subjects.HighwayAndTransportation).ToArray());
            var expected = StateTable.ParseString_AsStateOfDefinitelyOccupied(
                "00000000000000000000001100000000~" +
                "00000000000000000000000000000000~" +
                "00000011110000000000000000000000~" +
                "00000000000000000000000000000000~" +
                "00000000000000000000000000000000~" +
                "00000000000000000000000000000000~" +
                "00000000000000000000000000000000"
                );
            var actual = StateTable.GetStateOfDefinitelyOccupied(input);

            for (int i = 0; i < 7; i++)
            {
                if (expected[i] != actual[i])
                {
                    string errorMessage = "Error at day = " + i + "\n";
                    errorMessage += "Expected = " + Convert.ToString(expected[i], 2) + "\n";
                    errorMessage += "Actual   = " + Convert.ToString(actual[i], 2);
                    Assert.Fail(errorMessage);
                }
            }
            Assert.Pass();
        }
コード例 #2
0
        public void Test_StateTable_GetStateOfDefinitelyOccupied_1()
        {
            var input = Permutator.Run_v2_withoutConsideringWeekNumber(TestData
                                                                       .GetSlotsByName(TestData.Subjects.AdvancedStructuralSteelDesign).ToArray());
            var expected = StateTable.ParseString_AsStateOfDefinitelyOccupied(
                "00000000000000111100000000000000~" +
                "00110000000000000000000000000000~" +
                "00000000000000000000000000000000~" +
                "00000000000000000000000000000000~" +
                "00000000000000000000000000000000~" +
                "00000000000000000000000000000000~" +
                "00000000000000000000000000000000"
                );
            var actual = StateTable.GetStateOfDefinitelyOccupied(input);

            Assert.IsTrue(actual.SequenceEqual(expected));
        }
コード例 #3
0
        public void Test_PermutateV4_Runv2_WithoutConsideringWeekNumber()
        {
            int expectedCount = 285696;
            var input         = new List <Slot>();

            input.AddRange(TestData.GetSlotsByName(TestData.Subjects.Hydrology));
            input.AddRange(TestData.GetSlotsByName(TestData.Subjects.StructuralAnalysisII));
            input.AddRange(TestData.GetSlotsByName(TestData.Subjects.HighwayAndTransportation));
            input.AddRange(TestData.GetSlotsByName(TestData.Subjects.FluidMechanicsII));
            input.AddRange(TestData.GetSlotsByName(TestData.Subjects.IntroductionToBuildingServices));
            var timer  = Stopwatch.StartNew();
            var result = Permutator.Run_v2_withoutConsideringWeekNumber(input.ToArray());

            timer.Stop();
            Console.WriteLine("Combination count : " + result.Count);
            Console.WriteLine("Elapsed time : " + timer.Elapsed.TotalSeconds + " s");
            Assert.True(result.Count == expectedCount);
        }