~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/nrefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ReDimStatementTests.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
Import upstream version 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.IO;
 
6
using NUnit.Framework;
 
7
using ICSharpCode.NRefactory.VB.Parser;
 
8
using ICSharpCode.NRefactory.VB.Ast;
 
9
 
 
10
namespace ICSharpCode.NRefactory.VB.Tests.Ast
 
11
{
 
12
        [TestFixture]
 
13
        public class ReDimStatementTests
 
14
        {
 
15
                [Test]
 
16
                public void VBNetReDimStatementTest()
 
17
                {
 
18
                        ReDimStatement reDimStatement = ParseUtil.ParseStatement<ReDimStatement>("ReDim Preserve MyArray(15)");
 
19
                        Assert.AreEqual(1, reDimStatement.ReDimClauses.Count);
 
20
                        Assert.AreSame(reDimStatement, reDimStatement.ReDimClauses[0].Parent);
 
21
                }
 
22
                
 
23
                [Test]
 
24
                public void VBNetReDimStatementTest2()
 
25
                {
 
26
                        ReDimStatement reDimStatement = ParseUtil.ParseStatement<ReDimStatement>("ReDim calCheckData(channelNum, lambdaNum).ShiftFromLastFullCalPixels(CalCheckPeak.HighWavelength)");
 
27
                }
 
28
                
 
29
                [Test]
 
30
                public void VBNetBigReDimStatementTest()
 
31
                {
 
32
                        string program = @"
 
33
Class X
 
34
        Sub x
 
35
                ReDim sU(m - 1, n - 1)
 
36
                ReDim sW(n - 1)
 
37
                ReDim sV(n - 1, n - 1)
 
38
                ReDim rv1(n - 1)
 
39
                ReDim sMt(iNrCols - 1, 0)
 
40
                ReDim Preserve sMt(iNrCols - 1, iRowNr)
 
41
                ReDim sM(iRowNr - 1, iNrCols - 1)
 
42
                If (IsNothing(ColLengths)) Then ReDim ColLengths(0)
 
43
                If (ColLengths.Length = (SubItem + 1)) Then ReDim Preserve ColLengths(SubItem + 1)
 
44
                ReDim sTransform(2, iTransformType - 1)
 
45
                ReDim Preserve _Items(_Count)
 
46
                ReDim Preserve _Items(nCapacity)
 
47
                ReDim Preserve _Items(0 To _Count)
 
48
                ReDim Preserve _Items(0 To nCapacity)
 
49
                ReDim sU(m - 1, n - 1)
 
50
                ReDim sW(n - 1)
 
51
                ReDim sV(n - 1, n - 1)
 
52
                ReDim rv1(n - 1)
 
53
                ReDim sMt(iNrCols - 1, 0)
 
54
                ReDim Preserve sMt(iNrCols - 1, iRowNr)
 
55
                ReDim sM(iRowNr - 1, iNrCols - 1)
 
56
                If (IsNothing(ColLengths)) Then ReDim ColLengths(0)
 
57
                If (ColLengths.Length = (SubItem + 1)) Then ReDim Preserve ColLengths(SubItem + 1)
 
58
                ReDim sTransform(2, iTransformType - 1)
 
59
                ReDim Preserve Samples(Samples.GetUpperBound(0) + 1)
 
60
                ReDim Samples(0)
 
61
                ReDim BaseCssContent(BaseCssContentRows - 1)
 
62
                ReDim mabtRxBuf(Bytes2Read - 1)
 
63
                ReDim Preserve primarykey(primarykey.Length)
 
64
                ReDim Preserve IntArray(10, 10, 15)
 
65
                ReDim X(10, 10)
 
66
                ReDim Preserve IntArray(0 To 10, 10, 0 To 20)
 
67
                ReDim Preserve IntArray(10, 10, 15)
 
68
                ReDim X(0 To 10, 0 To 10)
 
69
                ReDim GetMe().IntArray(0 To 10, 10, 0 To 20)
 
70
                ReDim GetMe(ExplicitParameter := 3).IntArray(0 To 10, 10, 0 To 20)
 
71
                ReDim SomeType(Of Integer).IntArray(0 To 10, 10, 0 To 20)
 
72
        End Sub
 
73
End Class";
 
74
                        TypeDeclaration typeDeclaration = ParseUtil.ParseGlobal<TypeDeclaration>(program);
 
75
                }
 
76
        }
 
77
}