Esempio n. 1
0
        public void dataFilterQuirkyBeaconSignal()
        {
            int[] testArray1 = new int[SEQUENCE_SIZE_TEST_NUM] {
                419, 2003, 11764, 8000, 912, 1000, 45, 13227, 6636, 952
            };
            int[] testArray2 = new int[SEQUENCE_SIZE_TEST_NUM] {
                18520, 17, -4045, 1608, -250, -16874, 7113, -3987, -21, 500
            };

            dataFilterBeaconComposition test1 = new dataFilterBeaconComposition(dataFilterOrBeacon, dataCutOrQuirkyBeacon, dataFilterLargeMode);
            dataFilterBeaconComposition test2 = new dataFilterBeaconComposition(dataFilterOrBeacon, dataCutOrQuirkyBeacon, !dataFilterLargeMode);

            string expectedLarge = "";
            string expectedSmall = "";

            for (int i = 0; i < 48; i++)
            {
                expectedSmall += "WuB";
            }

            string actualLarge = test1.EmitScrambledSignal(testArray1);
            string actualSmall = test2.EmitScrambledSignal(testArray2);

            Assert.AreEqual(expectedLarge, actualLarge);
            Assert.AreEqual(expectedSmall, actualSmall);
        }
Esempio n. 2
0
        public void dataCutQuirkyBeaconScramble()
        {
            int[] testArray1 = new int[SEQUENCE_SIZE_TEST_NUM] {
                419, 2003, 11764, 8000, 912, 1000, 45, 13227, 6636, 952
            };
            int[] testArray2 = new int[SEQUENCE_SIZE_TEST_NUM] {
                18520, 17, -4045, 1608, -250, -16874, 7113, -3987, -21, 500
            };
            int[] testArray3 = new int[SEQUENCE_SIZE_TEST_NUM] {
                419, 88, 25, 11764, 912, 952, 5, 6, 7, 999
            };
            int[] testArray4 = new int[SEQUENCE_SIZE_TEST_NUM] {
                18520, -250, -16874, 21, -21, 75, 76, 115, 116, 224
            };

            dataFilterBeaconComposition test1 = new dataFilterBeaconComposition(dataCutOrQuirkyBeacon, dataCutOrQuirkyBeacon, dataFilterLargeMode);
            dataFilterBeaconComposition test2 = new dataFilterBeaconComposition(dataCutOrQuirkyBeacon, dataCutOrQuirkyBeacon, !dataFilterLargeMode);

            string expectedLarge = "WuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuB";
            string expectedSmall = "WuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuB";

            test1.EmitScrambledSignal(testArray1);
            test2.EmitScrambledSignal(testArray2);

            string actualLarge = test1.EmitScrambledSignal(testArray3);
            string actualSmall = test2.EmitScrambledSignal(testArray4);

            Assert.AreEqual(expectedLarge, actualLarge);
            Assert.AreEqual(expectedSmall, actualSmall);
        }
Esempio n. 3
0
        public void dataModQuirkyBeaconScramble()
        {
            int[] testArray1 = new int[SEQUENCE_SIZE_TEST_NUM] {
                419, 2003, 11764, 8000, 912, 1000, 45, 13227, 6636, 952
            };


            dataFilterBeaconComposition test1 = new dataFilterBeaconComposition(dataModOrStrobeBeacon, dataCutOrQuirkyBeacon, dataFilterLargeMode);
            dataFilterBeaconComposition test2 = new dataFilterBeaconComposition(dataModOrStrobeBeacon, dataCutOrQuirkyBeacon, !dataFilterLargeMode);

            string expectedLarge = "WuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuB";
            string expectedSmall = "WuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuBWuB";

            string actualLarge = test1.EmitScrambledSignal(testArray1);
            string actualSmall = test2.EmitScrambledSignal(testArray1);

            Assert.AreEqual(expectedLarge, actualLarge);
            Assert.AreEqual(expectedSmall, actualSmall);
        }
        public static void dataCutBeaconTest()
        {
            int[] testArray1 = new int[10] {
                -25, 18, 45, 226, 856, -3, 44, 21, 22, 900
            };
            int[] testArray2 = new int[10] {
                21, 23, 543, 34, 28, 1, 6, 21, 22, 198
            };
            int[] testArray3 = new int[10] {
                35, 15, 55, -55, 85, 92, 21, 22, 95, 12
            };
            int[] testArray4 = new int[10] {
                35, 15, 24, 1000, -1000, 999, -999, 21, 22, 5
            };
            int[] testArray5 = new int[10] {
                100, 50, 200, 150, 22, 21, 275, 957, 857, 999
            };


            dataFilterBeaconComposition[] DFB = new dataFilterBeaconComposition[TEST_ITERATIONS];

            for (int i = 0; i < TEST_ITERATIONS; i++)
            {
                if (i < MODE_CHANGE)
                {
                    DFB[i] = new dataFilterBeaconComposition(DATACUT_OR_QUIRKYBEACON, DATAFILTER_OR_BEACON, DATAFILTERLARGEMODE);
                }

                else
                {
                    DFB[i] = new dataFilterBeaconComposition(DATACUT_OR_QUIRKYBEACON, DATAFILTER_OR_BEACON, !DATAFILTERLARGEMODE);
                }
            }


            Console.WriteLine();
            Console.WriteLine("Now testing the functionality of dataCut");
            Console.WriteLine();

            for (int i = 0; i < TEST_ITERATIONS; i++)
            {
                int[] expectedScrambleArray;
                int[] expectedFilterArray;
                if (i == TEST_ITERATION1)
                {
                    DFB[i].simpleScramble(testArray1);
                    expectedScrambleArray = DFB[i].simpleScramble(testArray2);
                    Console.Write("Scrambled sequence 1: ");
                    for (int j = 0; j < expectedScrambleArray.Length; j++)
                    {
                        Console.Write(expectedScrambleArray[j]);
                        Console.Write(" ");
                    }
                }

                else if (i == TEST_ITERATION2)
                {
                    DFB[i].simpleScramble(testArray2);
                    expectedScrambleArray = DFB[i].simpleScramble(testArray3);
                    Console.Write("Scrambled sequence 2: ");
                    for (int j = 0; j < expectedScrambleArray.Length; j++)
                    {
                        Console.Write(expectedScrambleArray[j]);
                        Console.Write(" ");
                    }
                }

                else if (i == TEST_ITERATION3)
                {
                    DFB[i].simpleScramble(testArray3);
                    expectedScrambleArray = DFB[i].simpleScramble(testArray4);
                    Console.Write("Scrambled sequence 3: ");
                    for (int j = 0; j < expectedScrambleArray.Length; j++)
                    {
                        Console.Write(expectedScrambleArray[j]);
                        Console.Write(" ");
                    }
                }

                else if (i == TEST_ITERATION4)
                {
                    DFB[i].simpleScramble(testArray4);
                    expectedScrambleArray = DFB[i].simpleScramble(testArray5);
                    Console.Write("Scrambled sequence 4: ");
                    for (int j = 0; j < expectedScrambleArray.Length; j++)
                    {
                        Console.Write(expectedScrambleArray[j]);
                        Console.Write(" ");
                    }
                }

                else if (i == TEST_ITERATION5)
                {
                    DFB[i].simpleScramble(testArray1);
                    expectedScrambleArray = DFB[i].simpleScramble(testArray5);
                    Console.Write("Scrambled equence 5: ");
                    for (int j = 0; j < expectedScrambleArray.Length; j++)
                    {
                        Console.Write(expectedScrambleArray[j]);
                        Console.Write(" ");
                    }
                }

                expectedFilterArray = DFB[i].simpleFilter();
                Console.WriteLine();

                Console.Write("Filtered sequence " + (i + 1) + ": ");
                for (int j = 0; j < expectedFilterArray.Length; j++)
                {
                    Console.Write(expectedFilterArray[j]);
                    Console.Write(" ");
                }

                Console.WriteLine();
                Console.WriteLine();
            }

            Console.WriteLine();
            Console.WriteLine("Now testing the functionality of dataCut and Beacon combined");
            Console.WriteLine();

            for (int i = 0; i < TEST_ITERATIONS; i++)
            {
                if (i == TEST_ITERATION1)
                {
                    Console.WriteLine();
                    DFB[i].simpleScramble(testArray1);
                    Console.WriteLine("Scrambled signal 1: " + DFB[i].EmitScrambledSignal(testArray2));
                    Console.WriteLine("Filtered signal 1: " + DFB[i].EmitFilteredSignal());
                }


                else if (i == TEST_ITERATION2)
                {
                    Console.WriteLine();
                    DFB[i].simpleScramble(testArray2);
                    Console.WriteLine("Scrambled signal 2: " + DFB[i].EmitScrambledSignal(testArray3));
                    Console.WriteLine("Filtered signal 2: " + DFB[i].EmitFilteredSignal());
                }


                if (i == TEST_ITERATION3)
                {
                    Console.WriteLine();
                    DFB[i].simpleScramble(testArray3);
                    Console.WriteLine("Scrambled signal 3: " + DFB[i].EmitScrambledSignal(testArray4));
                    Console.WriteLine("Filtered signal 3: " + DFB[i].EmitFilteredSignal());
                }


                if (i == TEST_ITERATION4)
                {
                    Console.WriteLine();
                    DFB[i].simpleScramble(testArray4);
                    Console.WriteLine("Scrambled signal 4: " + DFB[i].EmitScrambledSignal(testArray5));
                    Console.WriteLine("Filtered signal 4: " + DFB[i].EmitFilteredSignal());
                }


                if (i == TEST_ITERATION5)
                {
                    Console.WriteLine();
                    DFB[i].simpleScramble(testArray5);
                    Console.WriteLine("Scrambled signal 5: " + DFB[i].EmitScrambledSignal(testArray1));
                    Console.WriteLine("Filtered signal 5: " + DFB[i].EmitFilteredSignal());
                }
            }

            Console.WriteLine();
        }
        public static void dataModQuirkyBeaconTest()
        {
            int[] testArray1 = new int[10] {
                -25, 18, 45, 226, 856, -3, 44, 21, 22, 900
            };
            int[] testArray2 = new int[10] {
                21, 23, 543, 34, 28, 1, 6, 200, 201, 198
            };
            int[] testArray3 = new int[10] {
                35, 15, 55, -55, 85, 92, 93, 94, 95, 12
            };
            int[] testArray4 = new int[10] {
                35, 15, 24, 1000, -1000, 999, -999, 28, 36, 5
            };
            int[] testArray5 = new int[10] {
                100, 50, 200, 150, 300, 350, 275, 957, 857, 999
            };


            dataFilterBeaconComposition[] DFB = new dataFilterBeaconComposition[TEST_ITERATIONS];

            for (int i = 0; i < TEST_ITERATIONS; i++)
            {
                if (i < MODE_CHANGE)
                {
                    DFB[i] = new dataFilterBeaconComposition(DATAMOD_OR_STROBEBEACON, DATACUT_OR_QUIRKYBEACON, DATAFILTERLARGEMODE);
                }

                else
                {
                    DFB[i] = new dataFilterBeaconComposition(DATAMOD_OR_STROBEBEACON, DATACUT_OR_QUIRKYBEACON, !DATAFILTERLARGEMODE);
                }
            }


            Console.WriteLine();
            Console.WriteLine("Now testing the functionality of dataMod and QuirkyBeacon combined...");
            Console.WriteLine();

            for (int i = 0; i < TEST_ITERATIONS; i++)
            {
                if (i == TEST_ITERATION1)
                {
                    Console.WriteLine();
                    Console.WriteLine("Scrambled signal 1: " + DFB[i].EmitScrambledSignal(testArray1));
                    Console.WriteLine("Filtered signal 1: " + DFB[i].EmitFilteredSignal());
                }


                else if (i == TEST_ITERATION2)
                {
                    Console.WriteLine();
                    Console.WriteLine("Scrambled signal 2: " + DFB[i].EmitScrambledSignal(testArray2));
                    Console.WriteLine("Filtered signal 2: " + DFB[i].EmitFilteredSignal());
                }


                if (i == TEST_ITERATION3)
                {
                    Console.WriteLine();
                    Console.WriteLine("Scrambled signal 3: " + DFB[i].EmitScrambledSignal(testArray3));
                    Console.WriteLine("Filtered signal 3: " + DFB[i].EmitFilteredSignal());
                }


                if (i == TEST_ITERATION4)
                {
                    Console.WriteLine();
                    Console.WriteLine("Scrambled signal 4: " + DFB[i].EmitScrambledSignal(testArray4));
                    Console.WriteLine("Filtered signal 4: " + DFB[i].EmitFilteredSignal());
                }


                if (i == TEST_ITERATION5)
                {
                    Console.WriteLine();
                    Console.WriteLine("Scrambled signal 5: " + DFB[i].EmitScrambledSignal(testArray5));
                    Console.WriteLine("Filtered signal 5: " + DFB[i].EmitFilteredSignal());
                }
            }

            Console.WriteLine();
        }