public void test_overlapAPI() { Prepare.ReloadGlobalSydb(".//input//overlapsSydb_FromHHHT2.xml"); ObjOverlap ovelap = new ObjOverlap(null, null); Debug.Assert(true == ovelap.GeneratePath(null)); Debug.Assert(ovelap.GetSigname() == "Null"); Dictionary <string, string[]> validoverlaps = new Dictionary <string, string[]>() { //overlap //dstSig //ibbm //variant num //olpathInfo { "O_S0101", new string[] { "S0101", "VB0101", "0", "" } }, { "O_S0102", new string[] { "S0102", "VB0102", "0", "" } }, { "O_S0103", new string[] { "S0103", "VB0103", "0", "S0103" } }, { "O_S0107", new string[] { "S0107", "VB0107", "2", "S0107|P0101-N S0107|P0101-R" } }, { "O_S0107_N", new string[] { "S0107", "VB0107", "2", "S0107|P0101-N" } }, { "O_S0107_R", new string[] { "S0107", "VB0107", "2", "S0107|P0101-R" } }, { "O_S0107_NOIN", new string[] { "S0107", "VB0107E", "2", "S0107|P0101-R" } }, { "O_X0109", new string[] { "X0109", "VB0109", "6", "X0109|P0105-R|P0103-R|P0102-R" } }, { "O_S0304", new string[] { "S0304", "VB0304", "4", "S0304|P0302-N|P0602-N S0304|P0302-N|P0602-R" } }, { "O_S0304_NOIN", new string[] { "S0304", "VB0304E", "4", "S0304|P0302-N|P0602-R" } }, { "O_S1101_N", new string[] { "S1101", "VB1101", "4", "S1101|P1101-N|P1103-N" } }, { "O_S1101_R", new string[] { "S1101", "VB1101", "2", "S1101|P1101-R" } }, { "O_S0608", new string[] { "S0608", "VB0608", "6", "S0608|P0606-N|P0608-N|P0610-R S0608|P0606-R" } } }; #region check for valid ovelap { foreach (var ol in sydb.overlapInfoList) { if (validoverlaps.ContainsKey(ol.Name)) { string signame = validoverlaps[ol.Name][0]; GENERIC_SYSTEM_PARAMETERS.SIGNALS.SIGNAL sig = (GENERIC_SYSTEM_PARAMETERS.SIGNALS.SIGNAL)Sys.GetNode(signame,sydb.signalInfoList.Cast <Node>().ToList()); ObjOverlap overlap = new ObjOverlap(ol,sig); Debug.Assert(overlap.GetSigname() == signame); GENERIC_SYSTEM_PARAMETERS.IMPLEMENTATION_BEACON_BLOCK_MODE.BM_BEACON inb = (GENERIC_SYSTEM_PARAMETERS.IMPLEMENTATION_BEACON_BLOCK_MODE.BM_BEACON)Sys.GetNode(validoverlaps[ol.Name][1],sydb.ibbmInfoList.Cast <Node>().ToList()); Debug.Assert(true == overlap.GeneratePath(inb)); Debug.Assert(validoverlaps[ol.Name][3] == Prepare.getXmlNodeStr(overlap.GetXmlNode(),"/Path/@NAME")); List <Variant> vlist = new List <Variant>(); Debug.Assert(true == overlap.CalVariants(vlist)); Debug.Assert(vlist.Count.ToString() == validoverlaps[ol.Name][2]); haschecked = true; } } Debug.Assert(haschecked == true); haschecked = false; } #endregion }
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 }