PageRenderTime 46ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/mcs/tests/test-debug-11.cs

https://bitbucket.org/danipen/mono
C# | 273 lines | 244 code | 29 blank | 0 comment | 21 complexity | f0aec06293b920b9b8f2aa8aa1538163 MD5 | raw file
Possible License(s): Unlicense, Apache-2.0, LGPL-2.0, MPL-2.0-no-copyleft-exception, CC-BY-SA-3.0, GPL-2.0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. struct S : IDisposable, IEnumerable
  5. {
  6. public void Dispose ()
  7. {
  8. }
  9. public IEnumerator GetEnumerator ()
  10. {
  11. return new List<int>().GetEnumerator ();
  12. }
  13. }
  14. class C
  15. {
  16. public static void Main ()
  17. {
  18. }
  19. void Using_1 ()
  20. {
  21. using (var s = new S ())
  22. {
  23. }
  24. }
  25. void Using_2 ()
  26. {
  27. using (S s = new S (), s2 = new S ())
  28. {
  29. }
  30. }
  31. void Using_3 ()
  32. {
  33. using (S? s = new S ())
  34. {
  35. }
  36. }
  37. void Using_4 ()
  38. {
  39. using (var ms = new System.IO.MemoryStream ())
  40. {
  41. Console.WriteLine ("a");
  42. }
  43. }
  44. void Lock ()
  45. {
  46. lock (this)
  47. {
  48. }
  49. }
  50. void Lock_2 ()
  51. {
  52. lock (this)
  53. {
  54. return;
  55. }
  56. }
  57. void Switch_1 (int arg)
  58. {
  59. switch (arg)
  60. {
  61. case 1:
  62. break;
  63. case 2:
  64. {
  65. break;
  66. }
  67. case 3:
  68. goto case 2;
  69. case 4:
  70. case 5:
  71. break;
  72. default:
  73. break;
  74. }
  75. }
  76. void Switch_2 (int? arg)
  77. {
  78. switch (arg)
  79. {
  80. case 1:
  81. break;
  82. case 2:
  83. {
  84. break;
  85. }
  86. default:
  87. break;
  88. }
  89. }
  90. void Switch_3 (string s)
  91. {
  92. switch (s)
  93. {
  94. case "a":
  95. break;
  96. case "b":
  97. {
  98. break;
  99. }
  100. case "c":
  101. case "e":
  102. goto case "a";
  103. case "f":
  104. break;
  105. case "gggg":
  106. case "hhh":
  107. case "iii":
  108. break;
  109. default:
  110. break;
  111. }
  112. }
  113. void Switch_4 (string s)
  114. {
  115. switch (s)
  116. {
  117. case "a":
  118. break;
  119. case "b":
  120. break;
  121. default:
  122. break;
  123. }
  124. }
  125. void Checked ()
  126. {
  127. checked
  128. {
  129. int a = 1;
  130. }
  131. unchecked
  132. {
  133. int a = 2;
  134. }
  135. }
  136. void DoWhile (int arg)
  137. {
  138. do
  139. {
  140. }
  141. while (arg != 0);
  142. while (arg > 0)
  143. {
  144. }
  145. }
  146. void DoWhile_2 ()
  147. {
  148. do
  149. {
  150. int i = 2;
  151. }
  152. while (true);
  153. }
  154. void While_2 ()
  155. {
  156. while (true)
  157. {
  158. Console.WriteLine ("aa");
  159. }
  160. }
  161. void If (string s)
  162. {
  163. if (s == "a")
  164. {
  165. }
  166. else
  167. {
  168. }
  169. }
  170. void If_2 (string s)
  171. {
  172. if (s == "a")
  173. {
  174. }
  175. else if (s == "b")
  176. {
  177. }
  178. else
  179. {
  180. }
  181. }
  182. void If_3 (int i)
  183. {
  184. if (i == i)
  185. {
  186. }
  187. else
  188. {
  189. }
  190. }
  191. void For_1 ()
  192. {
  193. for (int i = 0;
  194. i < 4;
  195. ++i)
  196. {
  197. }
  198. for (;
  199. ;
  200. )
  201. {
  202. }
  203. }
  204. void For_2 ()
  205. {
  206. for (int i = 0; ;)
  207. {
  208. }
  209. }
  210. void ForEach (int[] args)
  211. {
  212. foreach (
  213. var a
  214. in args)
  215. {
  216. }
  217. }
  218. void ForEach_2 (List<object> args)
  219. {
  220. foreach
  221. (var a
  222. in
  223. args)
  224. {
  225. }
  226. }
  227. void ForEach_3 (S args)
  228. {
  229. foreach
  230. (var a
  231. in
  232. args)
  233. {
  234. }
  235. }
  236. void ForEach_4 (int[,] args)
  237. {
  238. foreach (
  239. var a
  240. in args)
  241. {
  242. }
  243. }
  244. }