예제 #1
0
        public void testCheckAvailability2()
        {
            EONTable ET = new EONTable();

            short frequencyIn  = 1;
            short bandIN       = 63;
            short frequencyOut = 0;
            short bandOut      = 64;

            EONTableRowIN  rowIn  = new EONTableRowIN(frequencyIn, bandIN);
            EONTableRowOut rowOut = new EONTableRowOut(frequencyOut, bandOut);

            //Pasma powinny byc teraz wolne
            Assert.IsTrue(ET.CheckAvailability(frequencyIn, bandIN, "in"));
            Assert.IsTrue(ET.CheckAvailability(frequencyOut, bandOut, "out"));
            Assert.IsTrue(ET.CheckAvailability(rowIn));
            Assert.IsTrue(ET.CheckAvailability(rowOut));

            ET.addRow(rowIn);
            ET.addRow(rowOut);

            //Po dodaniu pasma powinny byc zajete
            Assert.IsFalse(ET.CheckAvailability(frequencyIn, bandIN, "in"));
            Assert.IsFalse(ET.CheckAvailability(frequencyOut, bandOut, "out"));
            Assert.IsFalse(ET.CheckAvailability(rowIn));
            Assert.IsFalse(ET.CheckAvailability(rowOut));
        }
예제 #2
0
        public void testFindFrequency()
        {
            EONTable ET = new EONTable();

            //zapychamy łącze od 0 do 31
            ET.addRow(new EONTableRowIN(0, 32));
            ET.addRow(new EONTableRowIN(35, 29));

            Assert.IsTrue(ET.CheckAvailability(new EONTableRowIN(32, 3)));

            Assert.AreEqual(32, ET.FindFreeFrequency(3, "in"));
            Assert.AreEqual(-1, ET.FindFreeFrequency(4, "in"));

            //zapychamy łącze od 0 do 31
            ET.addRow(new EONTableRowOut(0, 32));
            ET.addRow(new EONTableRowOut(35, 29));

            Assert.IsTrue(ET.CheckAvailability(new EONTableRowOut(32, 3)));

            Assert.AreEqual(32, ET.FindFreeFrequency(3, "out"));
            Assert.AreEqual(-1, ET.FindFreeFrequency(4, "out"));
        }