Exemple #1
0
 public void CCodeUnitPositionConstructorTest5()
 {
     long             line_start  = 12;
     int              index_start = 23;
     long             line_end    = 12;
     int              index_end   = 22;
     CElementPosition target      = new CElementPosition(line_start, index_start, line_end, index_end);
 }
Exemple #2
0
        public static CExtendedCodeUnit FromToken(Token token, CTokenizerParms args)
        {
            CElementPosition  pos         = new CElementPosition(token.line, token.col, token.line, token.col + token.val.Length);
            CCodeUnit         simple_unit = new CCodeUnit(pos, token.val);
            CExtendedCodeUnit unit        = new CExtendedCodeUnit(simple_unit, args.GetFileID().SourceFileID);

            return(unit);
        }
Exemple #3
0
        public void LineEndTest2()
        {
            long             line_start  = 99999999999;
            int              index_start = 11;
            CElementPosition target      = new CElementPosition(line_start, index_start);
            long             expected    = 5;

            target.LineEnd = expected;
        }
Exemple #4
0
        public void LineStartTest2()
        {
            long             line_start  = 444;
            int              index_start = 11;
            CElementPosition target      = new CElementPosition(line_start, index_start);
            long             expected    = 555;

            target.LineStart = expected;
        }
Exemple #5
0
        public void IndexStartTest2()
        {
            long             line_start  = 1;
            int              index_start = 11;
            CElementPosition target      = new CElementPosition(line_start, index_start);
            int              expected    = index_start + 1;

            target.IndexStart = expected;
        }
Exemple #6
0
        public void EqualsTest()
        {
            long             line_start  = 9999999999;
            int              index_start = 999999999;
            CElementPosition first       = new CElementPosition(line_start, index_start);
            CElementPosition second      = new CElementPosition(line_start, index_start);

            Assert.IsTrue(first.Equals(second));
        }
Exemple #7
0
        public void LineStartTest1()
        {
            long             line_start  = 9999999999;
            int              index_start = 11;
            CElementPosition target      = new CElementPosition(line_start, index_start);
            long             expected    = 56;

            target.LineStart = expected;
            Assert.AreEqual(expected, target.LineStart);
        }
Exemple #8
0
        public void IndexStartTest3()
        {
            long             line_start  = 1;
            int              index_start = 11;
            CElementPosition target      = new CElementPosition(line_start, index_start, line_start + 1, index_start);
            int              expected    = index_start + 1;

            target.IndexStart = expected;
            Assert.AreEqual(expected, target.IndexStart);
        }
Exemple #9
0
        public void CCodeUnitPositionConstructorTest1()
        {
            long             line_start  = 1;
            int              index_start = 0;
            CElementPosition target      = new CElementPosition(line_start, index_start);

            Assert.AreEqual(target.LineStart, line_start);
            Assert.AreEqual(target.LineEnd, line_start);
            Assert.AreEqual(target.IndexStart, index_start);
            Assert.AreEqual(target.IndexEnd, index_start);
        }
Exemple #10
0
        public void CompareToTest()
        {
            long             line_start  = 9999999999;
            int              index_start = 999999999;
            CElementPosition first       = new CElementPosition(line_start, index_start);
            CElementPosition second      = new CElementPosition(line_start, index_start);

            Assert.AreEqual(first.CompareTo(second), 0);

            second = new CElementPosition(line_start + 1, index_start);
            Assert.AreEqual(first.CompareTo(second), 0);

            second = new CElementPosition(line_start, index_start, line_start + 1, index_start);
            Assert.AreEqual(first.CompareTo(second), -1);
        }
Exemple #11
0
        public void CElementPositionConstructorTest()
        {
            long             line_start  = 3;
            int              index_start = 11;
            CElementPosition other       = new CElementPosition(line_start, index_start);
            CElementPosition target      = new CElementPosition(other);

            other.LineEnd++;
            other.IndexStart--;
            other.LineStart--;
            Assert.AreEqual(other.LineEnd, line_start + 1);
            Assert.AreEqual(target.LineStart, line_start);
            Assert.AreEqual(target.LineEnd, line_start);
            Assert.AreEqual(target.IndexStart, index_start);
            Assert.AreEqual(target.IndexEnd, index_start);
        }
Exemple #12
0
 public void CCodeUnitPositionConstructorTest3()
 {
     long             line_start  = 11;
     int              index_start = -1;
     CElementPosition target      = new CElementPosition(line_start, index_start);
 }
Exemple #13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="_Position"></param>
 /// <param name="CommentPair">Символы комментариев, которые начинают и завершают этот фрагмент кода</param>
 public CCommentedCodeFragment(CElementPosition _Position, CPair <string> CommentPair)
 {
     m_CommentSymbolPair = CommentPair;
     m_Position          = _Position;
 }