Ejemplo n.º 1
0
        public void CallLookUp()
        {
            List <Hit> result;
            int        expected;

            _PrefixFileParser = new PrefixFileParser();
            _PrefixFileParser.ParsePrefixFile("");
            _CallLookUp = new CallLookUp(_PrefixFileParser);

            // Add calls where mask ends with '.' ie: KG4AA and as compare KG4AAA
            string[] testCallSigns = new string[16] {
                "TX9", "TX4YKP/R", "/KH0PR", "W6OP/4", "OEM3SGU/3", "AM70URE/8", "5N31/OK3CLA", "BV100", "BY1PK/VE6LB",
                "VE6LB/BY1PK", "DC3RJ/P/W3", "RAEM", "AJ3M/BY1RX", "4D71/N0NM", "OEM3SGU", "KG4AA"
            };                                                                                         //, "4X130RISHON", "9N38", "AX3GAMES", "DA2MORSE", "DB50FIRAC", "DL50FRANCE", "FBC5AGB", "FBC5NOD", "FBC5YJ", "FBC6HQP", "GB50RSARS", "HA80MRASZ", "HB9STEVE", "HG5FIRAC", "HG80MRASZ", "II050SCOUT", "IP1METEO", "J42004A", "J42004Q", "LM1814", "LM2T70Y", "LM9L40Y", "LM9L40Y/P", "OEM2BZL", "OEM3SGU", "OEM3SGU/3", "OEM6CLD", "OEM8CIQ", "OM2011GOOOLY", "ON1000NOTGER", "ON70REDSTAR", "PA09SHAPE", "PA65VERON", "PA90CORUS", "PG50RNARS", "PG540BUFFALO", "S55CERKNO", "TM380", "TYA11", "U5ARTEK/A", "V6T1", "VI2AJ2010", "VI2FG30", "VI4WIP50", "VU3DJQF1", "VX31763", "WD4", "XUF2B", "YI9B4E", "YO1000LEANY", "ZL4RUGBY", "ZS9MADIBA" };
            int[] testResult = new int[16] {
                0, 7, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1
            };

            for (int counter = 0; counter <= testCallSigns.Length - 1; counter++)
            {
                result   = _CallLookUp.LookUpCall(testCallSigns[counter]).ToList();
                expected = testResult[counter];

                Assert.AreEqual(expected, result.Count());
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constuctor.
        /// </summary>
        public CallLookupPanel()
        {
            InitializeComponent();

            PrefixFileParser = new PrefixFileParser();
            PrefixFileParser.ParsePrefixFile("");
            CallLookUp = new CallLookUp(PrefixFileParser);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Parse the prefix file.
        /// </summary>
        private void ParsePrefixFile()
        {
            stopwatch = Stopwatch.StartNew();

            _PrefixFileParser.ParsePrefixFile(TextBoxPrefixFilePath.Text);

            Console.WriteLine("Load Time: " + stopwatch.ElapsedMilliseconds + "ms");

            UpdateCursor();

            _CallLookUp = new CallLookUp(_PrefixFileParser)
            {
                MergeHits = CheckBoxMergeHits.Checked
            };
        }
Ejemplo n.º 4
0
        public void CallLookUpEx()
        {
            List <Hit> result;

            (double dxcc, string entity)expected;
            bool isMatchFound;

            _PrefixFileParser = new PrefixFileParser();
            _PrefixFileParser.ParsePrefixFile("");
            _CallLookUp = new CallLookUp(_PrefixFileParser);

            // Add calls where mask ends with '.' ie: KG4AA and as compare KG4AAA

            foreach (var key in goodDataCheck.Keys)
            {
                isMatchFound = false;
                result       = _CallLookUp.LookUpCall(key).ToList();

                switch (result.Count)
                {
                case 0:
                    Assert.IsTrue(badDataCheck.ContainsKey(key));
                    break;

                case 1:
                    if (result[0].Kind == PrefixKind.Province)
                    {
                        expected = (result[0].DXCC, result[0].Province);
                        Assert.AreEqual(goodDataCheck[key], expected);     //W6OP/3B7
                    }
                    else
                    {
                        expected = (result[0].DXCC, result[0].Country);
                        Assert.AreEqual(goodDataCheck[key], expected);
                    }
                    break;

                default:     // multiple hits
                    foreach (Hit hit in result)
                    {
                        if (hit.Kind == PrefixKind.Province)
                        {
                            expected = (hit.DXCC, hit.Province);
                            if (expected == goodDataCheck[key])
                            {
                                isMatchFound = true;
                            }
                        }
                        else
                        {
                            expected = (hit.DXCC, hit.Country);
                            if (expected == goodDataCheck[key])
                            {
                                isMatchFound = true;
                            }
                        }
                    }

                    Assert.IsTrue(isMatchFound);
                    break;
                }
            }
        }
Ejemplo n.º 5
0
        public void CallLookUpBatch()
        {
            List <Hit>    result;
            List <string> callSigns = new List <string>();

            (double dxcc, string entity)expected;
            bool isMatchFound;

            _PrefixFileParser = new PrefixFileParser();
            _PrefixFileParser.ParsePrefixFile("");
            _CallLookUp = new CallLookUp(_PrefixFileParser);

            foreach (var key in goodDataCheck.Keys)
            {
                callSigns.Add(key);
            }

            List <Hit> hitList = _CallLookUp.LookUpCall(callSigns).ToList();

            foreach (var hit in hitList)
            {
                isMatchFound = false;
                result       = hitList; // _CallLookUp.LookUpCall(key).ToList();

                switch (result.Count)
                {
                case 0:
                    Assert.IsTrue(badDataCheck.ContainsKey(hit.CallSign));
                    break;

                case 1:
                    if (result[0].Kind == PrefixKind.Province)
                    {
                        expected = (result[0].DXCC, result[0].Province);
                        Assert.AreEqual(goodDataCheck[hit.CallSign], expected);     //W6OP/3B7
                    }
                    else
                    {
                        expected = (result[0].DXCC, result[0].Country);
                        Assert.AreEqual(goodDataCheck[hit.CallSign], expected);
                    }
                    break;

                default:     // multiple hits
                    foreach (Hit hit2 in result)
                    {
                        if (hit2.Kind == PrefixKind.Province)
                        {
                            expected = (hit2.DXCC, hit2.Province);
                            if (expected == goodDataCheck[hit2.CallSign])
                            {
                                isMatchFound = true;
                            }
                        }
                        else
                        {
                            expected = (hit2.DXCC, hit2.Country);
                            if (expected == goodDataCheck[hit2.CallSign])
                            {
                                isMatchFound = true;
                            }
                        }
                    }

                    Assert.IsTrue(isMatchFound);
                    break;
                }
            }
        }