summaryrefslogtreecommitdiff
path: root/ICSharpCode.Decompiler/Tests/TypeAnalysisTests.cs
blob: 760bb862d3d2b5f9c1637ac2226ad6d629afe74a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

using System;

public class TypeAnalysisTests
{
	public byte SubtractFrom256(byte b)
	{
		return (byte)(256 - (int)b);
	}
	
	#region Shift
	public int LShiftInteger(int num1, int num2)
	{
		return num1 << num2;
	}
	
	public uint LShiftUnsignedInteger(uint num1, uint num2)
	{
		return num1 << (int)num2;
	}
	
	public long LShiftLong(long num1, long num2)
	{
		return num1 << (int)num2;
	}
	
	public ulong LShiftUnsignedLong(ulong num1, ulong num2)
	{
		return num1 << (int)num2;
	}
	
	public int RShiftInteger(int num1, int num2)
	{
		return num1 >> num2;
	}
	
	public uint RShiftUnsignedInteger(uint num1, int num2)
	{
		return num1 >> num2;
	}
	
	public long RShiftLong(long num1, long num2)
	{
		return num1 >> (int)num2;
	}
	
	public ulong RShiftUnsignedLong(ulong num1, ulong num2)
	{
		return num1 >> (int)num2;
	}
	
	public int ShiftByte(byte num)
	{
		return (int)num << 8;
	}
	
	public int RShiftByte(byte num)
	{
		return num >> 8;
	}
	
	public uint RShiftByteWithZeroExtension(byte num)
	{
		return (uint)num >> 8;
	}
	
	public int RShiftByteAsSByte(byte num)
	{
		return (sbyte)num >> 8;
	}
	
	public int RShiftSByte(sbyte num)
	{
		return num >> 8;
	}
	
	public uint RShiftSByteWithZeroExtension(sbyte num)
	{
		return (uint)num >> 8;
	}
	
	public int RShiftSByteAsByte(sbyte num)
	{
		return (byte)num >> 8;
	}
	#endregion
	
	public int GetHashCode(long num)
	{
		return (int)num ^ (int)(num >> 32);
	}

	public void TernaryOp(Random a, Random b, bool c)
	{
		if ((c ? a : b) == null)
		{
			Console.WriteLine();
		}
	}

	public void OperatorIs(object o)
	{
		Console.WriteLine(o is Random);
		Console.WriteLine(!(o is Random));
	}
	
	public byte[] CreateArrayWithInt(int length)
	{
		return new byte[length];
	}
	
	public byte[] CreateArrayWithLong(long length)
	{
		return new byte[length];
	}
	
	public byte[] CreateArrayWithUInt(uint length)
	{
		return new byte[length];
	}
	
	public byte[] CreateArrayWithULong(ulong length)
	{
		return new byte[length];
	}
	
	public StringComparison EnumDiffNumber(StringComparison data)
	{
		return data - 1;
	}
	
	public int EnumDiff(StringComparison a, StringComparison b)
	{
		return Math.Abs(a - b);
	}
}