예제 #1
0
        public void Compare_TwelveToIntervalTwelveOpenToFourteen_False()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare("]12;14]", 12);

            Assert.That(result.AreEqual, Is.False);
        }
예제 #2
0
        public void Compare_TwelveToIntervalTenToInfinity_True()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare("[10;+INF]", 12);

            Assert.That(result.AreEqual, Is.True);
        }
예제 #3
0
        public void Compare_TwelveToElevenWithAToleranceOFTenPercent_False()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(12, 11, "5%");

            Assert.That(result.AreEqual, Is.False);
        }
예제 #4
0
        public void Compare_TwelveToIntervalTenToTwelveClosedWithSpaces_True()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(" [-10 ; 12  ] ", 12);

            Assert.That(result.AreEqual, Is.True);
        }
예제 #5
0
        public void Compare_NullAndAny_True()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(null, "(any)", 1);

            Assert.That(result.AreEqual, Is.True);
        }
예제 #6
0
        public void Compare_NullAnd1Decimal_False()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(null, new decimal(1), 1);

            Assert.That(result.AreEqual, Is.False);
        }
예제 #7
0
        public void Compare_FiveAndSevenWithLessThanFifty_False()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(5, 7, "-50");

            Assert.That(result.AreEqual, Is.False);
        }
예제 #8
0
        public void Compare_MinusTwelveToMinusElevenWithTenPercentAndMinDotFive_True()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(-12, -11, "10% (min 0.5)");

            Assert.That(result.AreEqual, Is.True);
        }
예제 #9
0
        public void Compare_FiveAndSevenWithMoreThanFifty_True()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(5, 7, "+50");

            Assert.That(result.AreEqual, Is.True);
        }
예제 #10
0
        public void Compare_SevenAndFiveWithMoreThanFifty_False()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(7, 5, "+50");

            Assert.That(result.AreEqual, Is.False);
        }
예제 #11
0
        public void Compare_1DecimalAnd2Double_False()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(new decimal(1), 2.0);

            Assert.That(result.AreEqual, Is.False);
        }
예제 #12
0
        public void Compare_TwelveToElevenWithTenPercentAndMaxOne_True()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(12, 11, "10% (max 1)");

            Assert.That(result.AreEqual, Is.True);
        }
예제 #13
0
        public void Compare_TwelveToElevenWithHundredPercentAndMaxDotFive_False()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(12, 11, "100% (max 0.5)");

            Assert.That(result.AreEqual, Is.False);
        }
예제 #14
0
        public void Compare_1DecimalAnd2dot5Double_False()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(new decimal(1), 2.5, 1, SideTolerance.Both);

            Assert.That(result.AreEqual, Is.False);
        }
예제 #15
0
        public void Compare_SevenAndFiveWithLessThanFifty_True()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(7, 5, "-50");

            Assert.That(result.AreEqual, Is.True);
        }
예제 #16
0
        public void Compare_1DecimalAnd1dot5String_True()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(new decimal(1), "1.5", 1, SideTolerance.Both);

            Assert.That(result.AreEqual, Is.True);
        }
예제 #17
0
        public void Compare_MinusFiveAndSevenWithMoreThanFifty_False()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(-5, -7, "+50");

            Assert.That(result.AreEqual, Is.False);
        }
예제 #18
0
        public void Compare_1DecimalAndValue_True()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(new decimal(1), "(value)", 1);

            Assert.That(result.AreEqual, Is.True);
        }
예제 #19
0
        public void Compare_MinusSevenAndThreeWithMoreThanFifty_True()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(-5, -3, "+50");

            Assert.That(result.AreEqual, Is.True);
        }
예제 #20
0
        public void Compare_NullAndValue_False()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(null, "(value)", 1);

            Assert.That(result.AreEqual, Is.False);
        }
예제 #21
0
        public void Compare_MinusFiveAndThreeWithLessThanFifty_False()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(-5, -3, "-50");

            Assert.That(result.AreEqual, Is.False);
        }
예제 #22
0
        public void Compare_NullAndNullPlaceHolder_False()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(null, "(null)", 1);

            Assert.That(result.AreEqual, Is.True);
        }
예제 #23
0
        public void Compare_1DecimalAnd1String_True()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(new decimal(1), "1.0");

            Assert.That(result.AreEqual, Is.True);
        }
예제 #24
0
        public void Compare_TwelveToIntervalTenToFourteen_True()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(12, "[10;14]");

            Assert.That(result.AreEqual, Is.True);
        }
예제 #25
0
        public void Compare_MinusSevenAndNineWithLessThanFifty_True()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(-7, -9, "-50");

            Assert.That(result.AreEqual, Is.True);
        }
예제 #26
0
        public void Compare_TwelveToIntervalTenToTwelveOpen_False()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare("[10;12[", 12);

            Assert.That(result.AreEqual, Is.False);
        }
예제 #27
0
        public void Compare_Rounding_True()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(7.46, 7.47, new NumericRounding(0.1m, Rounding.RoundingStyle.Round));

            Assert.That(result.AreEqual, Is.True);
        }
예제 #28
0
        public void Compare_TwelveToIntervalTenHalfToFourteenHalf_True()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare("]10.5;14.5]", 12);

            Assert.That(result.AreEqual, Is.True);
        }
예제 #29
0
        public void Compare_1DecimalAnd2dot5String_False()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(new decimal(1), "2.5", 1);

            Assert.That(result.AreEqual, Is.False);
        }
예제 #30
0
        public void Compare_MinusTwelveToMinusElevenWithOnePercentAndMinTwo_True()
        {
            var comparer = new NumericComparer();
            var result   = comparer.Compare(-12, -11, "1% (min 2)");

            Assert.That(result.AreEqual, Is.True);
        }
 public List<ProjectBlockInfo> readPlcBlocksList()
 {
     lock (step5BlocksinfoList)
     {
         NumericComparer<ProjectBlockInfo> nc = new NumericComparer<ProjectBlockInfo>();
         step5BlocksinfoList.Sort(nc);
         return new List<ProjectBlockInfo>(step5BlocksinfoList);
     }
 }
        private List<ProjectBlockInfo> intReadPlcBlocksList()
        {
            bool showDeleted = ((Step7ProjectV5)this.Project)._showDeleted;

            List<ProjectBlockInfo> tmpBlocks = new List<ProjectBlockInfo>();

            if (bausteinDBF != null) 
            {
                var dbfTbl = bausteinDBF; 

                foreach (DataRow row in dbfTbl.Rows)
                {
                    if (!(bool)row["DELETED_FLAG"] || showDeleted)
                    {
                        int id = (int)row["ID"];

                        int blocknumber = Convert.ToInt32(row["NUMMER"]);
                        int blocktype = Convert.ToInt32(row["TYP"]);

                        S7ProjectBlockInfo tmp = new S7ProjectBlockInfo();
                        tmp.ParentFolder = this;
                        tmp.Deleted = (bool)row["DELETED_FLAG"];
                        tmp.BlockNumber = blocknumber;
                        tmp.id = id;
                        if (blocktype == 0x00)
                            tmp.BlockType = PLCBlockType.UDT;
                        else
                            tmp.BlockType = (PLCBlockType)blocktype;

                        if (tmp.BlockType == PLCBlockType.SFB || tmp.BlockType == PLCBlockType.SFC || tmp.BlockType == PLCBlockType.SDB || tmp.BlockType == PLCBlockType.DB || tmp.BlockType == PLCBlockType.VAT || tmp.BlockType == PLCBlockType.FB || tmp.BlockType == PLCBlockType.FC || tmp.BlockType == PLCBlockType.OB || tmp.BlockType == PLCBlockType.UDT)
                            tmpBlocks.Add(tmp);
                    }
                }
            }

            if (subblkDBF != null) 
            {
                var dbfTbl = subblkDBF; 

                foreach (S7ProjectBlockInfo step7ProjectBlockInfo in tmpBlocks)
                {
                    var rows = dbfTbl.Select("OBJECTID = " + step7ProjectBlockInfo.id.ToString());
                    foreach (DataRow row in rows)
                    {
                        int subblktyp = Convert.ToInt32(row["SUBBLKTYP"]);
                        if ((int)row["OBJECTID"] == step7ProjectBlockInfo.id && (subblktyp == 12 || subblktyp == 8 || subblktyp == 14))
                        {
                            if ((int)row["PASSWORD"] == 3)
                                step7ProjectBlockInfo.KnowHowProtection = true;
                        }
                    }
                }
            }
            NumericComparer<ProjectBlockInfo> nc = new NumericComparer<ProjectBlockInfo>();
            tmpBlocks.Sort(nc);
            return tmpBlocks;
        }
예제 #33
0
 public void NumericSort()
 {
     IComparer Numeric = new NumericComparer();
     Array.Sort(Data, Numeric);
 }
        private List<ProjectBlockInfo> intReadPlcBlocksList()
        {
            bool showDeleted = ((Step7ProjectV5)this.Project)._showDeleted;

            List<ProjectBlockInfo> tmpBlocks = new List<ProjectBlockInfo>();

            if (bausteinDBF != null) //ZipHelper.FileExists(((Step7ProjectV5)Project)._zipfile, Folder + "BAUSTEIN.DBF"))
            {
                var dbfTbl = bausteinDBF; //DBF.ParseDBF.ReadDBF(Folder + "BAUSTEIN.DBF", ((Step7ProjectV5)Project)._zipfile, ((Step7ProjectV5)Project)._DirSeperator);

                //if (Parent is S7ProgrammFolder && ((S7ProgrammFolder)Parent).SymbolTable != null)
                //{
                //    SymbolTable symtab = (SymbolTable)((S7ProgrammFolder)Parent).SymbolTable;
                //}
                foreach (DataRow row in dbfTbl.Rows)
                {
                    if (!(bool)row["DELETED_FLAG"] || showDeleted)
                    {
                        int id = (int)row["ID"];

                        int blocknumber = Convert.ToInt32(row["NUMMER"]);
                        int blocktype = Convert.ToInt32(row["TYP"]);

                        S7ProjectBlockInfo tmp = new S7ProjectBlockInfo();
                        tmp.ParentFolder = this;
                        tmp.Deleted = (bool)row["DELETED_FLAG"];
                        tmp.BlockNumber = blocknumber;
                        tmp.id = id;
                        if (blocktype == 0x00)
                            tmp.BlockType = PLCBlockType.UDT;
                        else
                            tmp.BlockType = (PLCBlockType)blocktype;

                        /*
                        if (symtab != null)
                        {
                            SymbolTableEntry sym = symtab.GetEntryFromOperand(tmp.ToString());
                            if (sym != null)
                                tmp.Symbol = sym.Symbol;
                        }
                        */

                        if (tmp.BlockType == PLCBlockType.SFB || tmp.BlockType == PLCBlockType.SFC || tmp.BlockType == PLCBlockType.SDB || tmp.BlockType == PLCBlockType.DB || tmp.BlockType == PLCBlockType.VAT || tmp.BlockType == PLCBlockType.FB || tmp.BlockType == PLCBlockType.FC || tmp.BlockType == PLCBlockType.OB || tmp.BlockType == PLCBlockType.UDT)
                            tmpBlocks.Add(tmp);
                    }
                }
            }

            if (subblkDBF != null) //ZipHelper.FileExists(((Step7ProjectV5)Project)._zipfile, Folder + "SUBBLK.DBF"))
            {
                var dbfTbl = subblkDBF; // DBF.ParseDBF.ReadDBF(Folder + "SUBBLK.DBF", ((Step7ProjectV5)Project)._zipfile, ((Step7ProjectV5)Project)._DirSeperator);

                foreach (S7ProjectBlockInfo step7ProjectBlockInfo in tmpBlocks)
                {
                    var rows = dbfTbl.Select("OBJECTID = " + step7ProjectBlockInfo.id.ToString());
                    foreach (DataRow row in rows)
                    {
                        int subblktyp = Convert.ToInt32(row["SUBBLKTYP"]);
                        if ((int)row["OBJECTID"] == step7ProjectBlockInfo.id && (subblktyp == 12 || subblktyp == 8 || subblktyp == 14))
                        {
                            if ((int)row["PASSWORD"] == 3)
                                step7ProjectBlockInfo.KnowHowProtection = true;
                        }
                    }
                }
            }
            NumericComparer<ProjectBlockInfo> nc = new NumericComparer<ProjectBlockInfo>();
            tmpBlocks.Sort(nc);
            return tmpBlocks;
        }