Example #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();
        }
Example #2
0
        public void Test_StateTable_Filter_1()
        {
            var input      = TestData.GetSlotsByName(TestData.Subjects.AdvancedStructuralSteelDesign);
            var inputState = StateTable.ParseString_AsStateOfDefinitelyOccupied(
                "11111111111111111111111111111111~" +
                "11111111111111111111111111111111~" +
                "11111111111111111111111111111111~" +
                "11111111111111111111111111111111~" +
                "11111111111111111111111111111111~" +
                "11111111111111111111111111111111~" +
                "11111111111111111111111111111111"
                );
            var expectedCount = 0;
            var actualCount   = StateTable.Filter(input, inputState).Count;

            Assert.AreEqual(expectedCount, actualCount);
        }
Example #3
0
        public void Test_StateTable_ParseString_2()
        {
            string input =
                "10000000000000000000000000000000~" +
                "10000000000000000000000000000000~" +
                "10000000000000000000000000000000~" +
                "10000000000000000000000000000000~" +
                "10000000000000000000000000000000~" +
                "10000000000000000000000000000000~" +
                "10000000000000000000000000000000";
            var expected = new int[7] {
                1, 1, 1, 1, 1, 1, 1
            };
            var actual = StateTable.ParseString_AsStateOfDefinitelyOccupied(input);

            Assert.IsTrue(actual.SequenceEqual(expected));
        }
Example #4
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));
        }
Example #5
0
        public void Test_StateTable_Filter_ShouldRemoveRelatedSlots()
        {
            var input = new List <Slot> {
                TestData.GetSlot(309), TestData.GetSlot(311)
            };
            var inputState = StateTable.ParseString_AsStateOfDefinitelyOccupied(
                "00000011110000000000000000000000~" +
                "00000000000000000000000000000000~" +
                "00000000000000000000000000000000~" +
                "00000000000000000000000000000000~" +
                "00000000000000000000000000000000~" +
                "00000000000000000000000000000000~" +
                "00000000000000000000000000000000"
                );
            var expectedCount = 0;
            var actualCount   = StateTable.Filter(input, inputState).Count;

            Assert.AreEqual(expectedCount, actualCount);
        }