Beispiel #1
0
        public void test_GenrateDeviceByIBBM()
        {
            //Arrange
            sydb.clear();
            List <LEU>    leulist = new List <LEU>();
            List <BEACON> blist   = new List <BEACON>();

            BMVFGen bvf = new BMVFGen(false, ref blist, ref leulist);  // initial

            //Act Assert
            Debug.Assert(false == bvf.GenrateDeviceByIBBM());

            //Arrange
            BFGen bf = new BFGen(".//input//validbeacons.csv", "", "", false, false);

            bf.Init();

            List <string> validleunames = new List <string>()
            {
                "E1D", "E2D", "E3D", "E1C", "E3D2", "E2D2", "E2D3", "E2C1", "E2C7"
            };

            GENERIC_SYSTEM_PARAMETERS.IMPLEMENTATION_BEACON_BLOCK_MODE ibbms = FileLoader.Load <GENERIC_SYSTEM_PARAMETERS.IMPLEMENTATION_BEACON_BLOCK_MODE>(".//input//IBBM.xml");
            sydb.ibbmInfoList.Clear();
            sydb.ibbmInfoList = ibbms.BM_Beacon;  // read all IBBM beacons

            //Act
            Debug.Assert(true == bvf.GenrateDeviceByIBBM());
            //Assert

            foreach (IBeaconInfo b in sydb.GetBeacons())
            {
                if (b.IsVariantBeacon() == true)
                {
                    Debug.Assert(blist.Exists(x => x.Name == b.Name));
                }
                else
                {
                    Debug.Assert(false == blist.Exists(x => x.Name == b.Name));
                }
            }

            leulist.ForEach(Print);

            Debug.Assert(validleunames.Count == leulist.Count());
            int leuid = 1;

            foreach (LEU l in leulist)
            {
                Debug.Assert(leuid == l.ID);
                Debug.Assert(l.Name == validleunames[leuid - 1]);
                ++leuid;
            }
        }
Beispiel #2
0
        public void test_GenerateBMBSDDBDisInfoNode()
        {
            List <LEU>    leulist = new List <LEU>();
            List <BEACON> blist   = new List <BEACON>();
            BMVFGen       bmvf    = new BMVFGen(false, ref blist, ref leulist);

            XmlVisitor beaconNodenull = XmlVisitor.Create("Beacon", null);

            Debug.Assert(false == bmvf.GenerateBMBSDDBDisInfoNode(null, ref beaconNodenull));

            Prepare.ReloadGlobalSydb(".//input//BMBDisSydb.xml");
            BFGen bf = new BFGen(".//input//BMBDisBeacons.csv", ".//input//BMBDisBeacons.xml", "", false, false);

            MethodHelper.InvokePrivateMethod <BFGen>(bf, "Init");
            bmvf.GenrateDeviceByIBBM();

            //the corresponding beacons are:
            //VB0102 VB0106 vb0101 vb0110 vb0111 vb0203 VB0609 vb1402 VB1303 ib1303 vb2002 fb1914 vb1705 VB0614 VB0601 VB0604
            string[] validdis = { "8.630", "5.910", "6.410", "5.340", "6.020", "6.060", "5.710", "5.550", "5.650", "5.650", "130.580", "44.740", "73.580", "3.230", "3.100", "6.000" };

            #region test the beacons of valid bmbdis
            {
                int beaconi = 0;
                foreach (var curdis in validdis)
                {
                    XmlVisitor beaconNode = XmlVisitor.Create("Beacon", null);
                    haschecked = false;
                    Debug.Assert(true == bmvf.GenerateBMBSDDBDisInfoNode(blist[beaconi], ref beaconNode));

                    //check BMBSDDB calculate and node generate
                    Debug.Assert(curdis == Prepare.getXmlNodeStr(beaconNode, "BMB_SDDB_distance"));

                    //check BeaconMessage use the right BMB_Dis
                    BeaconMessage bm = new BeaconMessage();
                    bm.GenerateMessage(blist[beaconi], 1, null);
                    Debug.Assert(bm.BMB_Distance_Unitcm() == blist[beaconi].BMB_Distance_cm);

                    ++beaconi;
                }
            }
            #endregion

            #region test the beacons of invalid bmbdis
            {//IB0302 FB1916
                int errBeaconi = validdis.Length;
                for (; errBeaconi < blist.Count; errBeaconi++)
                {
                    Debug.Assert(false == bmvf.GenerateBMBSDDBDisInfoNode(blist[errBeaconi], ref beaconNodenull));
                }
            }
            #endregion
        }
Beispiel #3
0
        void test_generate()
        {
            List <LEU>    leulist = new List <LEU>();
            List <BEACON> blist   = new List <BEACON>();
            BMVFGen       bmvf    = new BMVFGen(false, ref blist, ref leulist);

            sydb.clear();
            Debug.Assert(false == bmvf.Generate(".//output"));//lack load data, so generate return false

            Prepare.ReloadGlobalSydb(".//input//BMVF_FromZJ.xml");
            BFGen bf = new BFGen(".//input//BMVF_FromZJ.csv", "", "", false, false);

            MethodHelper.InvokePrivateMethod <BFGen>(bf, "Init");

            Debug.Assert(true == bmvf.Generate(".//output"));  // generate BMVF file.
            Debug.Assert(true == File.Exists(".//output//BMV//block_mode_variants_file.xml"));
        }
Beispiel #4
0
 public static bool GenerateBMBSDDBDisInfoNode(this BMVFGen instance, BEACON b, ref XmlVisitor node)
 {
     return((bool)MethodHelper.InvokePrivateMethod <BMVFGen>(instance, "GenerateBMBSDDBDisInfoNode", new object[] { b, node }));
 }
Beispiel #5
0
        private void Generate()
        {
            try
            {
                beaconList.Clear();
                leuList.Clear();
                SyDB.GetInstance().clear();

                if (false == clearOutputDir())
                {
                    return;
                }
                //log is updating
                {
                    IDataGen.toolVer = this.Text;
                    GENERIC_SYSTEM_PARAMETERS sydb = FileLoader.Load <GENERIC_SYSTEM_PARAMETERS>(this.textBoxSyDB.Text);
                    SyDB.GetInstance().LoadData(sydb);

                    IDataGen.sydbFile = this.textBoxSyDB.Text;//todo will delete
                }

                {
                    IDataGen gen         = null;
                    string   compilepath = currentRunDir + "\\compiler\\CompilerBaliseV4000\\main\\compile.exe";
                    gen = new BFGen(this.textBoxLayout.Text, this.textBoxBoundaryBeacon.Text, compilepath, this.radioButtoniTC.Checked, this.checkBoxGenBin.Checked);
                    ((BFGen)gen).genPro += new BFGen.GenProess(GenProess);
                    if (false == gen.Generate(this.textBoxOutput.Text))
                    {
                        return;
                    }
                }

                {
                    IDataGen gen = null;
                    gen = new BMVFGen(this.radioButtoniTC.Checked && this.Upstream_path_considered.Checked,
                                      ref beaconList,
                                      ref leuList,
                                      this.textBox_UpstreamFile.Text);

                    if (false == gen.Generate(this.textBoxOutput.Text))
                    {
                        return;
                    }
                }

                {
                    IDataGen gen = null;
                    gen = new LEURFGen(ref beaconList, ref leuList);
                    if (false == gen.Generate(this.textBoxOutput.Text))
                    {
                        return;
                    }
                }

                {
                    IDataGen gen       = null;
                    string   LEURFFile = this.textBoxOutput.Text + "\\LEU\\LEU_Result_Filtered_Values.xml";

                    gen = new LEUXmlGen(leuList, LEURFFile, currentRunDir, this.radioButtoniTC.Checked, this.checkBoxGenBin.Checked);
                    ((LEUXmlGen)gen).genPro += new LEUXmlGen.GenProess(GenProess);
                    if (false == gen.Generate(this.textBoxOutput.Text))
                    {
                        return;
                    }
                }
            }
            finally
            {
                IsBusy = false;
            }
        }
Beispiel #6
0
 public static bool GenrateDeviceByIBBM(this BMVFGen instance)
 {
     return((bool)MethodHelper.InvokePrivateMethod <BMVFGen>(instance, "GenrateDeviceByIBBM"));
 }