Beispiel #1
0
        private Bin SoftBinParser(List <TestResult> items, bool FirstOrLast = true)
        {
            Bin softBin = new Bin();

            if (items.Any(x => x.PFFlag == false))
            {
                TestResult item;
                if (FirstOrLast)
                {
                    item = items.First(x => x.PFFlag == false);
                }
                else
                {
                    item = items.Last(x => x.PFFlag == false);
                }
                TestLimit limit = limits.First(x => x.TestNumber == item.TestNumber.ToString());
                softBin.BinName = limit.SoftBinName;
                softBin.BinNum  = (ushort)limit.SoftBinNumber;
                softBin.BinPF   = (limit.SoftBinPF == BinPassFail.Pass.ToDescription()) ? BinPassFail.Pass : (limit.SoftBinPF == BinPassFail.Fail.ToDescription()) ? BinPassFail.Fail : BinPassFail.Unknown;
            }
            else
            {
                TestLimit limit = limits.First(x => x.TestNumber == ALLPASS);
                softBin.BinName = limit.SoftBinName;
                softBin.BinNum  = (ushort)limit.SoftBinNumber;
                softBin.BinPF   = BinPassFail.Pass;
            }
            return(softBin);
        }
Beispiel #2
0
        private Bin HardBinParser(Bin softBin)
        {
            Bin       hardBin = new Bin();
            TestLimit limit   = limits.First(x => x.SoftBinNumber == softBin.BinNum);

            hardBin.BinName = limit.HardBinName;
            hardBin.BinNum  = (ushort)limit.HardBinNumber;
            hardBin.BinPF   = (limit.HardBinPF == BinPassFail.Pass.ToDescription()) ? BinPassFail.Pass : (limit.HardBinPF == BinPassFail.Fail.ToDescription()) ? BinPassFail.Fail : BinPassFail.Unknown;
            return(hardBin);
        }
Beispiel #3
0
        public Tuple <List <TestLimit>, List <Limit> > BuildCSVStream(string _type, string _readPath)
        {
            List <TestLimit> limits       = new List <TestLimit>();
            List <Limit>     Limitsheader = new List <Limit>();
            bool             HeaderCheck  = true;

            using (StreamReader r = new StreamReader(_readPath))
            {
                string _limits = "Seed";

                do
                {
                    Regex CSVParser = new Regex(",(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))");

                    string[] x = CSVParser.Split(_limits);

                    if (x.Length > 1)
                    {
                        if (x[0] != "Test Number" && HeaderCheck)
                        {
                            Limit limitheader = new Limit();
                            limitheader.Header = x[0];
                            limitheader.Limits = x[1];
                            Limitsheader.Add(limitheader);
                            HeaderCheck = true;
                        }
                        else
                        {
                            HeaderCheck = false;
                        }

                        if (HeaderCheck == false && x[0] != "Test Number")
                        {
                            TestLimit limit = new TestLimit();
                            limit.TestNumber    = x[0];
                            limit.TestName      = x[1];
                            limit.Units         = x[2];
                            limit.HardBinNumber = Convert.ToInt32(x[3]);
                            limit.HardBinName   = x[4];
                            limit.HardBinPF     = x[5];
                            limit.SoftBinNumber = Convert.ToInt32(x[6]);
                            limit.SoftBinName   = x[7];
                            limit.SoftBinPF     = x[8];
                            limit.FTLower       = x[9];
                            limit.FTUpper       = x[10];
                            limit.QALower       = x[11];
                            limit.QAUpper       = x[12];
                            limit.Offset1       = x[13];
                            limits.Add(limit);
                        }
                    }
                } while ((_limits = r.ReadLine()) != null);
            }
            return(Tuple.Create(limits, Limitsheader));
        }
Beispiel #4
0
        private List <DisplayTestResult> ResultParser(List <AppResult> appResults, string functionName, double duration)
        {
            //ATENTION:
            //APS100, application will always give a fixed length of result, which is same as the site number
            //MT1600, application may adjust the legnth of result based on actionOnFail settings

            var grpAppResults = appResults.GroupBy(x => x.TestNumber);

            foreach (var item in grpAppResults)
            {
                if (item.ToList().Count > 1)
                {
                    throw new Exception(string.Format("System error: test item {0} is duplicated in program, please contact the developer!", item.Key));
                }
            }

            List <DisplayTestResult> list = new List <DisplayTestResult>();

            foreach (var item in appResults)
            {
                if (item.TestResult.Count != siteNum)
                {
                    throw new Exception(string.Format("System error: site number is not matching between program({0}) and program({1}), please contact the developer!", item.TestResult.Count, siteNum));
                }

                TestLimit limit = limits.First(x => x.TestNumber == item.TestNumber.ToString());
                if (limit != null)
                {
                    if (isAllFailed() && workMode != FlowWorkMode.ContinueOnFail)
                    {
                        break;
                    }

                    DisplayTestResult tr = new DisplayTestResult();
                    tr.TestNumber = uint.Parse(limit.TestNumber);
                    tr.TestName   = limit.TestName;
                    tr.Unit       = limit.Units;
                    tr.FTLower    = double.Parse(limit.FTLower);
                    tr.FTUpper    = double.Parse(limit.FTUpper);
                    tr.QALower    = double.Parse(limit.QALower);
                    tr.QAUpper    = double.Parse(limit.QAUpper);
                    tr.Offset     = double.Parse(limit.Offset1);
                    tr.Factor     = UnitParser(limit.Units);
                    for (int i = 0; i < item.TestResult.Count; i++)
                    {
                        if (actionOnFail[i] || workMode == FlowWorkMode.ContinueOnFail ||
                            (isAllFailed() && workMode == FlowWorkMode.StopOnAllFail))
                        {
                            tr.Results.Add(item.TestResult[i]);
                            double disVal = item.TestResult[i] * Math.Pow(10, tr.Factor) + tr.Offset;
                            tr.DisplayResults.Add(string.Format("{0:N6}", disVal));
                            tr.PFFlags.Add((tr.FTLower <= disVal) && (disVal <= tr.FTUpper));
                        }
                        else
                        {
                            tr.Results.Add(INVALID);
                            tr.DisplayResults.Add(string.Empty);
                            tr.PFFlags.Add(false);
                        }
                    }
                    tr.FunctionName = functionName;
                    tr.Duration     = duration / appResults.Count;
                    list.Add(tr);

                    for (int i = 0; i < tr.PFFlags.Count; i++)
                    {
                        if (actionOnFail[i])
                        {
                            actionOnFail[i] = tr.PFFlags[i];
                        }
                    }
                }
            }

            return(list);
        }