~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/Debugger/Debugger.Tests/Tests/Value_Tests.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

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
 
 
6
namespace Debugger.Tests
 
7
{
 
8
        public class Value_Tests
 
9
        {
 
10
                public static void Main()
 
11
                {
 
12
                        bool b = true;
 
13
                        int i = 5;
 
14
                        string s = "five";
 
15
                        double d = 5.5;
 
16
                        int[,] array = new int[2,2];
 
17
                        array[0,0] = 0;
 
18
                        array[0,1] = 1;
 
19
                        array[1,0] = 2;
 
20
                        array[1,1] = 3;
 
21
                        char[,] lbArray = (char[,])Array.CreateInstance(typeof(char), new int[] { 2, 2 }, new int[] { 10, 20 });
 
22
                        lbArray[10, 20] = 'a';
 
23
                        lbArray[10, 21] = 'b';
 
24
                        lbArray[11, 20] = 'c';
 
25
                        lbArray[11, 21] = 'd';
 
26
                        
 
27
                        System.Diagnostics.Debugger.Break();
 
28
                }
 
29
        }
 
30
}
 
31
 
 
32
#if TEST_CODE
 
33
namespace Debugger.Tests {
 
34
        public partial class DebuggerTests
 
35
        {
 
36
                [NUnit.Framework.Test]
 
37
                public void Value_Tests()
 
38
                {
 
39
                        StartTest();
 
40
                        
 
41
                        DumpLocalVariables();
 
42
                        
 
43
                        Value array = process.SelectedStackFrame.GetLocalVariableValue("array").GetPermanentReference();
 
44
                        ObjectDump("array.Length", array.GetMemberValue("Length"));
 
45
                        ObjectDump("array", array);
 
46
                        
 
47
                        Value lbArray = process.SelectedStackFrame.GetLocalVariableValue("lbArray").GetPermanentReference();
 
48
                        ObjectDump("lbArray", lbArray);
 
49
                        ObjectDump("lbArray-10-20", lbArray.GetArrayElement(new int[] {10, 20}));
 
50
                        
 
51
                        EndTest();
 
52
                }
 
53
        }
 
54
}
 
55
#endif
 
56
 
 
57
#if EXPECTED_OUTPUT
 
58
<?xml version="1.0" encoding="utf-8"?>
 
59
<DebuggerTests>
 
60
  <Test
 
61
    name="Value_Tests.cs">
 
62
    <ProcessStarted />
 
63
    <ModuleLoaded>mscorlib.dll (No symbols)</ModuleLoaded>
 
64
    <ModuleLoaded>Value_Tests.exe (Has symbols)</ModuleLoaded>
 
65
    <DebuggingPaused>Break Value_Tests.cs:27,4-27,40</DebuggingPaused>
 
66
    <LocalVariables>
 
67
      <Item>
 
68
        <LocalVariable
 
69
          Name="b"
 
70
          Type="System.Boolean"
 
71
          Value="True" />
 
72
      </Item>
 
73
      <Item>
 
74
        <LocalVariable
 
75
          Name="i"
 
76
          Type="System.Int32"
 
77
          Value="5" />
 
78
      </Item>
 
79
      <Item>
 
80
        <LocalVariable
 
81
          Name="s"
 
82
          Type="System.String"
 
83
          Value="five" />
 
84
      </Item>
 
85
      <Item>
 
86
        <LocalVariable
 
87
          Name="d"
 
88
          Type="System.Double"
 
89
          Value="5.5" />
 
90
      </Item>
 
91
      <Item>
 
92
        <LocalVariable
 
93
          Name="array"
 
94
          Type="System.Int32[,]"
 
95
          Value="{System.Int32[,]}" />
 
96
      </Item>
 
97
      <Item>
 
98
        <LocalVariable
 
99
          Name="lbArray"
 
100
          Type="System.Char[,]"
 
101
          Value="{System.Char[,]}" />
 
102
      </Item>
 
103
    </LocalVariables>
 
104
    <array.Length>
 
105
      <Value
 
106
        PrimitiveValue="4"
 
107
        Type="System.Int32" />
 
108
    </array.Length>
 
109
    <array>
 
110
      <Value
 
111
        ArrayDimensions="{2, 2}"
 
112
        ArrayLength="4"
 
113
        ArrayRank="2"
 
114
        GetArrayElements="{0, 1, 2, 3}"
 
115
        IsReference="True"
 
116
        PrimitiveValue="{Exception: Value is not a primitive type}"
 
117
        Type="System.Int32[,]" />
 
118
    </array>
 
119
    <lbArray>
 
120
      <Value
 
121
        ArrayDimensions="{10..11, 20..21}"
 
122
        ArrayLength="4"
 
123
        ArrayRank="2"
 
124
        GetArrayElements="{a, b, c, d}"
 
125
        IsReference="True"
 
126
        PrimitiveValue="{Exception: Value is not a primitive type}"
 
127
        Type="System.Char[,]" />
 
128
    </lbArray>
 
129
    <lbArray-10-20>
 
130
      <Value
 
131
        PrimitiveValue="a"
 
132
        Type="System.Char" />
 
133
    </lbArray-10-20>
 
134
    <ProcessExited />
 
135
  </Test>
 
136
</DebuggerTests>
 
137
#endif // EXPECTED_OUTPUT