Ejemplo n.º 1
0
        public dataFilterBeacon(uint dft, uint bt, uint prime, uint[] seq)
        {
            active = !(dft > 2 || bt > 2);
            if (!active)
            {
                dataFilterType = null;
                beaconType     = null;
            }

            if (dft == 0)
            {
                dataFilterType = new dataFilter(prime, seq);
            }
            else if (dft == 1)
            {
                dataFilterType = new dataMod(prime, seq);
            }
            else
            {
                dataFilterType = new dataCut(prime, seq);
            }

            if (bt == 0)
            {
                beaconType = new beacon(seq);
            }
            else if (bt == 1)
            {
                beaconType = new strobeBeacon(seq);
            }
            else
            {
                beaconType = new quirkyBeacon(seq);
            }
        }
        public void correctScrambleSequenceSmallMode()
        {
            int[] testArray1 = new int[10] {
                25, 18, 42, 100, -100, -5, 5, 9, 500, 2000
            };
            int[] expectedArray1 = new int[10] {
                25, 18, 9, 5, -100, -5, 100, 42, 500, 2000
            };
            int[] testArray2 = new int[5] {
                65, 24, 55, 98, 110
            };
            int[] expectedArray2 = new int[5] {
                55, 24, 65, 98, 110
            };
            int[] testArray3;

            dataFilter test1 = new dataFilter(false);

            testArray3 = test1.scramble(testArray1);


            for (int i = 0; i < 10; i++)
            {
                Assert.AreEqual(testArray3[i], expectedArray1[i], 0);
            }

            testArray3 = test1.scramble(testArray2);

            for (int i = 0; i < 5; i++)
            {
                Assert.AreEqual(testArray3[i], expectedArray2[i], 0);
            }
        }
        public void nullSequenceTest()
        {
            bool cmon     = true;
            int  sizeTest = 0;

            int[]      testArray;
            dataFilter test3 = new dataFilter(cmon);

            testArray = test3.filter();

            foreach (int i in testArray)
            {
                sizeTest++;
            }

            Assert.AreEqual(1, sizeTest, 0);
        }
Ejemplo n.º 4
0
        // Pre: None
        // Post: A dataFilter object will be instantiated.
        public void whoAmIDataFilter(int DFType, bool mode)
        {
            large = mode;

            if (DFType == 1)
            {
                DFComposite = new dataFilter(large);
            }

            else if (DFType == 2)
            {
                DFComposite = new dataMod(large);
            }

            else if (DFType == 3)
            {
                DFComposite = new dataCut(large);
            }
        }
        public void correctScrambleSizeLargeMode()
        {
            int[] testArray1 = new int[10] {
                25, 18, 42, 100, -100, -5, 5, 9, 500, 2000
            };
            int[]      testArray2;
            int        sizeCount    = 0;
            int        expectedSize = 10;
            dataFilter test2        = new dataFilter(true);

            testArray2 = test2.scramble(testArray1);

            foreach (int i in testArray2)
            {
                sizeCount++;
            }

            Assert.AreEqual(expectedSize, sizeCount, 0);
        }