PageRenderTime 87ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 2ms

/client_v4_2_comm/Test/Platform/Tests/CLR/mscorlib/statements/StatementsTests.cs

#
C# | 5504 lines | 5302 code | 168 blank | 34 comment | 566 complexity | 47987d8a12b78a6ce69532254bd0d8ee MD5 | raw file
Possible License(s): Apache-2.0, LGPL-2.0, MIT, MPL-2.0-no-copyleft-exception

Large files files are truncated, but you can click here to view the full file

  1. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  4. using System;
  5. using System.Reflection;
  6. using Microsoft.SPOT.Platform.Test;
  7. namespace Microsoft.SPOT.Platform.Tests
  8. {
  9. public class StatementsTests : IMFTestInterface
  10. {
  11. [SetUp]
  12. public InitializeResult Initialize()
  13. {
  14. Log.Comment("Adding set up for the tests");
  15. return InitializeResult.ReadyToGo;
  16. }
  17. [TearDown]
  18. public void CleanUp()
  19. {
  20. Log.Comment("Cleaning up after the tests");
  21. }
  22. //Statements Test methods
  23. //The following tests were ported from folder current\test\cases\client\CLR\Conformance\10_classes\Statements
  24. //Label_001,Label_002,Label_004,Decl_001,Decl_002,Decl_003,Decl_004,Decl_007,Decl_009,Decl_010,Decl_012,Decl_014,Decl_016,Block_001,Empty_001,Expr_002,Expr_003,Expr_004,Expr_006,if_001,if_003,if_005,if_007,if_009,switch_001,switch_002,switch_003,switch_004,switch_005,switch_006,switch_007,switch_010,switch_012,switch_013,switch_015,switch_016,switch_017,switch_018,switch_019,switch_023,switch_030,switch_031,switch_032,switch_033,switch_034,switch_035,switch_036,switch_037,switch_038,switch_039,switch_040,switch_041,switch_042,switch_044,switch_047,switch_049,switch_string_001,dowhile_001,dowhile_002,dowhile_003,dowhile_004,dowhile_005,dowhile_006,for_001,for_003,for_004,for_006,for_007,for_008,for_009,for_010,for_011,for_013,for_014,char_in_string_s01,char_in_string_ex01,while_001,while_002,while_003,while_004,while_005,while_006,break_001,break_002,break_003,break_006,break_007,break_010,continue_001,continue_002,continue_006,continue_007,continue_010,goto_001,goto_008,goto_009,goto_010,goto_014,goto_017,goto_018,return_001,return_004,return_006,return_008,return_009,return_010,return_013,return_014,throw_001,throw_005,trycatch_001,trycatch_006,trycatch_007,tryfinally_001,tryfinally_002,tryfinally_003,tryfinally_004,tryfinally_006,tryfinally_007,tryfinally_008,tryfinally_009,tryfinally_010,tryfinally_011,tryfinally_012,tryfinally_013,Using_001,Using_002,Using_003,Using_005,Using_009,Using_010,Using_011,Using_012,Using_013,Using_014,Using_015,Using_017,Using_018,lock001,lock003,lock004,lock005,lock007,enum_002
  25. //Test Case Calls
  26. [TestMethod]
  27. public MFTestResults Statements_Label_001_Test()
  28. {
  29. Log.Comment("Label_001.sc");
  30. Log.Comment("Make sure labels can be declared");
  31. if (Statements_TestClass_Label_001.testMethod())
  32. {
  33. return MFTestResults.Pass;
  34. }
  35. return MFTestResults.Fail;
  36. }
  37. [TestMethod]
  38. public MFTestResults Statements_Label_002_Test()
  39. {
  40. Log.Comment("Label_002.sc");
  41. Log.Comment("Make sure labels can be referenced. Assumes 'goto'");
  42. if (Statements_TestClass_Label_002.testMethod())
  43. {
  44. return MFTestResults.Pass;
  45. }
  46. return MFTestResults.Fail;
  47. }
  48. [TestMethod]
  49. public MFTestResults Statements_Label_004_Test()
  50. {
  51. Log.Comment("Label_004.sc");
  52. Log.Comment("Make sure labels can be associated with an empty statement");
  53. if (Statements_TestClass_Label_004.testMethod())
  54. {
  55. return MFTestResults.Pass;
  56. }
  57. return MFTestResults.Fail;
  58. }
  59. [TestMethod]
  60. public MFTestResults Statements_Decl_001_Test()
  61. {
  62. Log.Comment("Decl_001.sc");
  63. Log.Comment("Declare a local variable of an intrinsic type");
  64. if (Statements_TestClass_Decl_001.testMethod())
  65. {
  66. return MFTestResults.Pass;
  67. }
  68. return MFTestResults.Fail;
  69. }
  70. [TestMethod]
  71. public MFTestResults Statements_Decl_002_Test()
  72. {
  73. Log.Comment("Decl_002.sc");
  74. Log.Comment("Declare a local variable of an intrinsic type and initialize it");
  75. if (Statements_TestClass_Decl_002.testMethod())
  76. {
  77. return MFTestResults.Pass;
  78. }
  79. return MFTestResults.Fail;
  80. }
  81. [TestMethod]
  82. public MFTestResults Statements_Decl_003_Test()
  83. {
  84. Log.Comment("Decl_003.sc");
  85. Log.Comment("Declare a local variable of an intrinsic type and initialize it");
  86. Log.Comment("with an expression.");
  87. if (Statements_TestClass_Decl_003.testMethod())
  88. {
  89. return MFTestResults.Pass;
  90. }
  91. return MFTestResults.Fail;
  92. }
  93. [TestMethod]
  94. public MFTestResults Statements_Decl_004_Test()
  95. {
  96. Log.Comment("Decl_004.sc");
  97. Log.Comment("Declare a local variable of an external object type");
  98. if (Statements_TestClass_Decl_004.testMethod())
  99. {
  100. return MFTestResults.Pass;
  101. }
  102. return MFTestResults.Fail;
  103. }
  104. [TestMethod]
  105. public MFTestResults Statements_Decl_007_Test()
  106. {
  107. Log.Comment("Decl_007.sc");
  108. Log.Comment("Declare a series of local variables of an intrinsic type with commas");
  109. if (Statements_TestClass_Decl_007.testMethod())
  110. {
  111. return MFTestResults.Pass;
  112. }
  113. return MFTestResults.Fail;
  114. }
  115. [TestMethod]
  116. public MFTestResults Statements_Decl_009_Test()
  117. {
  118. Log.Comment("Decl_009.sc");
  119. Log.Comment("Declare a series of local variables of an intrinsic type with commas and");
  120. Log.Comment("initial assignments.");
  121. if (Statements_TestClass_Decl_009.testMethod())
  122. {
  123. return MFTestResults.Pass;
  124. }
  125. return MFTestResults.Fail;
  126. }
  127. [TestMethod]
  128. public MFTestResults Statements_Decl_010_Test()
  129. {
  130. Log.Comment("Decl_010.sc");
  131. Log.Comment("Declare a local variable of an intrinsic type as an array");
  132. if (Statements_TestClass_Decl_010.testMethod())
  133. {
  134. return MFTestResults.Pass;
  135. }
  136. return MFTestResults.Fail;
  137. }
  138. [TestMethod]
  139. public MFTestResults Statements_Decl_012_Test()
  140. {
  141. Log.Comment("Decl_012.sc");
  142. Log.Comment("Declare a local variable of an intrinsic type as an array, allocate and reference it.");
  143. if (Statements_TestClass_Decl_012.testMethod())
  144. {
  145. return MFTestResults.Pass;
  146. }
  147. return MFTestResults.Fail;
  148. }
  149. [TestMethod]
  150. public MFTestResults Statements_Decl_014_Test()
  151. {
  152. Log.Comment("Decl_014.sc");
  153. Log.Comment("Declare a local variable of an intrinsic type as an initialized array");
  154. if (Statements_TestClass_Decl_014.testMethod())
  155. {
  156. return MFTestResults.Pass;
  157. }
  158. return MFTestResults.Fail;
  159. }
  160. [TestMethod]
  161. public MFTestResults Statements_Decl_016_Test()
  162. {
  163. Log.Comment("Decl_016.sc");
  164. Log.Comment("Correctly declare a local variable of a type that has no default constructor");
  165. Log.Comment("as an array.");
  166. if (Statements_TestClass_Decl_016.testMethod())
  167. {
  168. return MFTestResults.Pass;
  169. }
  170. return MFTestResults.Fail;
  171. }
  172. [TestMethod]
  173. public MFTestResults Statements_Block_001_Test()
  174. {
  175. Log.Comment("Block_001.sc");
  176. Log.Comment("Statements_TestClass_? Several types of statement blocks. Statement blocks");
  177. Log.Comment("are so fundamental, that most can be tested in one pass.");
  178. Log.Comment("Note that by the nature of this code, many warnings");
  179. Log.Comment("could/should be generated about items that are never reached.");
  180. if (Statements_TestClass_Block_001.testMethod())
  181. {
  182. return MFTestResults.Pass;
  183. }
  184. return MFTestResults.Fail;
  185. }
  186. [TestMethod]
  187. public MFTestResults Statements_Empty_001_Test()
  188. {
  189. Log.Comment("Empty_001.sc");
  190. Log.Comment("Statements_TestClass_? Several scenarios for empty statement. Emtpy statements");
  191. Log.Comment("are so fundamental, that most can be tested in one pass.");
  192. Log.Comment("Note that by the nature of this code, many warnings");
  193. Log.Comment("could/should be generated about items that are never reached.");
  194. if (Statements_TestClass_Empty_001.testMethod())
  195. {
  196. return MFTestResults.Pass;
  197. }
  198. return MFTestResults.Fail;
  199. }
  200. [TestMethod]
  201. public MFTestResults Statements_Expr_002_Test()
  202. {
  203. Log.Comment("Expr_002.sc");
  204. Log.Comment("Use an expression with side effects.");
  205. if (Statements_TestClass_Expr_002.testMethod())
  206. {
  207. return MFTestResults.Pass;
  208. }
  209. return MFTestResults.Fail;
  210. }
  211. [TestMethod]
  212. public MFTestResults Statements_Expr_003_Test()
  213. {
  214. Log.Comment("Expr_003.sc");
  215. Log.Comment("Use an expression with side effects and multiple l-values.");
  216. if (Statements_TestClass_Expr_003.testMethod())
  217. {
  218. return MFTestResults.Pass;
  219. }
  220. return MFTestResults.Fail;
  221. }
  222. [TestMethod]
  223. public MFTestResults Statements_Expr_004_Test()
  224. {
  225. Log.Comment("Expr_004.sc");
  226. Log.Comment("Run a quick test of common operator/assignment combos");
  227. if (Statements_TestClass_Expr_004.testMethod())
  228. {
  229. return MFTestResults.Pass;
  230. }
  231. return MFTestResults.Fail;
  232. }
  233. [TestMethod]
  234. public MFTestResults Statements_Expr_006_Test()
  235. {
  236. Log.Comment(" complex assignment");
  237. if (Statements_TestClass_Expr_006.testMethod())
  238. {
  239. return MFTestResults.Pass;
  240. }
  241. return MFTestResults.Fail;
  242. }
  243. [TestMethod]
  244. public MFTestResults Statements_if_001_Test()
  245. {
  246. Log.Comment("if_001.sc");
  247. Log.Comment("Simple boolean if with a single statement");
  248. if (Statements_TestClass_if_001.testMethod())
  249. {
  250. return MFTestResults.Pass;
  251. }
  252. return MFTestResults.Fail;
  253. }
  254. [TestMethod]
  255. public MFTestResults Statements_if_003_Test()
  256. {
  257. Log.Comment("if_003.sc");
  258. Log.Comment("Simple boolean if with a block statement");
  259. if (Statements_TestClass_if_003.testMethod())
  260. {
  261. return MFTestResults.Pass;
  262. }
  263. return MFTestResults.Fail;
  264. }
  265. [TestMethod]
  266. public MFTestResults Statements_if_005_Test()
  267. {
  268. Log.Comment("if_005.sc");
  269. Log.Comment("Simple boolean if with a single statement and else");
  270. if (Statements_TestClass_if_005.testMethod())
  271. {
  272. return MFTestResults.Pass;
  273. }
  274. return MFTestResults.Fail;
  275. }
  276. [TestMethod]
  277. public MFTestResults Statements_if_007_Test()
  278. {
  279. Log.Comment("if_007.sc");
  280. Log.Comment("Simple boolean if with a block statement");
  281. if (Statements_TestClass_if_007.testMethod())
  282. {
  283. return MFTestResults.Pass;
  284. }
  285. return MFTestResults.Fail;
  286. }
  287. [TestMethod]
  288. public MFTestResults Statements_if_009_Test()
  289. {
  290. Log.Comment("if_009.sc");
  291. Log.Comment("Nest ifs with elses without blocks. Statements_TestClass_? that the 'else' ambiguity from");
  292. Log.Comment("C/C++ is handled the same way (else bound to closest if)");
  293. if (Statements_TestClass_if_009.testMethod())
  294. {
  295. return MFTestResults.Pass;
  296. }
  297. return MFTestResults.Fail;
  298. }
  299. [TestMethod]
  300. public MFTestResults Statements_switch_001_Test()
  301. {
  302. Log.Comment("switch_001.sc");
  303. Log.Comment("Empty switch");
  304. if (Statements_TestClass_switch_001.testMethod())
  305. {
  306. return MFTestResults.Pass;
  307. }
  308. return MFTestResults.Fail;
  309. }
  310. [TestMethod]
  311. public MFTestResults Statements_switch_002_Test()
  312. {
  313. Log.Comment("switch_002.sc");
  314. Log.Comment("Default only switch");
  315. if (Statements_TestClass_switch_002.testMethod())
  316. {
  317. return MFTestResults.Pass;
  318. }
  319. return MFTestResults.Fail;
  320. }
  321. [TestMethod]
  322. public MFTestResults Statements_switch_003_Test()
  323. {
  324. Log.Comment("switch_003.sc");
  325. Log.Comment("Switch with single case without break - no default");
  326. if (Statements_TestClass_switch_003.testMethod())
  327. {
  328. return MFTestResults.Pass;
  329. }
  330. return MFTestResults.Fail;
  331. }
  332. [TestMethod]
  333. public MFTestResults Statements_switch_004_Test()
  334. {
  335. Log.Comment("switch_004.sc");
  336. Log.Comment("Switch with one case, using break");
  337. if (Statements_TestClass_switch_004.testMethod())
  338. {
  339. return MFTestResults.Pass;
  340. }
  341. return MFTestResults.Fail;
  342. }
  343. [TestMethod]
  344. public MFTestResults Statements_switch_005_Test()
  345. {
  346. Log.Comment("switch_005.sc");
  347. Log.Comment("Switch with two cases, using break");
  348. if (Statements_TestClass_switch_005.testMethod())
  349. {
  350. return MFTestResults.Pass;
  351. }
  352. return MFTestResults.Fail;
  353. }
  354. [TestMethod]
  355. public MFTestResults Statements_switch_006_Test()
  356. {
  357. Log.Comment("switch_006.sc");
  358. Log.Comment("Switch with one case and a default");
  359. if (Statements_TestClass_switch_006.testMethod())
  360. {
  361. return MFTestResults.Pass;
  362. }
  363. return MFTestResults.Fail;
  364. }
  365. [TestMethod]
  366. public MFTestResults Statements_switch_007_Test()
  367. {
  368. Log.Comment("switch_007.sc");
  369. Log.Comment("Switch with two cases and a default");
  370. if (Statements_TestClass_switch_007.testMethod())
  371. {
  372. return MFTestResults.Pass;
  373. }
  374. return MFTestResults.Fail;
  375. }
  376. [TestMethod]
  377. public MFTestResults Statements_switch_010_Test()
  378. {
  379. Log.Comment("switch_010.sc");
  380. Log.Comment("Switch with a const variable in a case");
  381. if (Statements_TestClass_switch_010.testMethod())
  382. {
  383. return MFTestResults.Pass;
  384. }
  385. return MFTestResults.Fail;
  386. }
  387. [TestMethod]
  388. public MFTestResults Statements_switch_012_Test()
  389. {
  390. Log.Comment("switch_012.sc");
  391. Log.Comment("Multiple case labels");
  392. if (Statements_TestClass_switch_012.testMethod())
  393. {
  394. return MFTestResults.Pass;
  395. }
  396. return MFTestResults.Fail;
  397. }
  398. [TestMethod]
  399. public MFTestResults Statements_switch_013_Test()
  400. {
  401. Log.Comment("switch_013.sc");
  402. Log.Comment("test goto all over");
  403. Log.Comment("Expected Output");
  404. if (Statements_TestClass_switch_013.testMethod())
  405. {
  406. return MFTestResults.Pass;
  407. }
  408. return MFTestResults.Fail;
  409. }
  410. [TestMethod]
  411. public MFTestResults Statements_switch_015_Test()
  412. {
  413. Log.Comment("switch_015.sc");
  414. Log.Comment("Run a switch over a specific type: byte");
  415. if (Statements_TestClass_switch_015.testMethod())
  416. {
  417. return MFTestResults.Pass;
  418. }
  419. return MFTestResults.Fail;
  420. }
  421. [TestMethod]
  422. public MFTestResults Statements_switch_016_Test()
  423. {
  424. Log.Comment("switch_016.sc");
  425. Log.Comment("Run a switch over a specific type: char");
  426. if (Statements_TestClass_switch_016.testMethod())
  427. {
  428. return MFTestResults.Pass;
  429. }
  430. return MFTestResults.Fail;
  431. }
  432. [TestMethod]
  433. public MFTestResults Statements_switch_017_Test()
  434. {
  435. Log.Comment("switch_017.sc");
  436. Log.Comment("Run a switch over a specific type: short");
  437. if (Statements_TestClass_switch_017.testMethod())
  438. {
  439. return MFTestResults.Pass;
  440. }
  441. return MFTestResults.Fail;
  442. }
  443. [TestMethod]
  444. public MFTestResults Statements_switch_018_Test()
  445. {
  446. Log.Comment("switch_018.sc");
  447. Log.Comment("Run a switch over a specific type: int");
  448. if (Statements_TestClass_switch_018.testMethod())
  449. {
  450. return MFTestResults.Pass;
  451. }
  452. return MFTestResults.Fail;
  453. }
  454. [TestMethod]
  455. public MFTestResults Statements_switch_019_Test()
  456. {
  457. Log.Comment("switch_019.sc");
  458. Log.Comment("Run a switch over a specific type: long");
  459. if (Statements_TestClass_switch_019.testMethod())
  460. {
  461. return MFTestResults.Pass;
  462. }
  463. return MFTestResults.Fail;
  464. }
  465. [TestMethod]
  466. public MFTestResults Statements_switch_023_Test()
  467. {
  468. Log.Comment("switch_023.sc");
  469. Log.Comment("Run a switch over a specific type: enum");
  470. if (Statements_TestClass_switch_023.testMethod())
  471. {
  472. return MFTestResults.Pass;
  473. }
  474. return MFTestResults.Fail;
  475. }
  476. [TestMethod]
  477. public MFTestResults Statements_switch_030_Test()
  478. {
  479. Log.Comment(" switch on int variable, float case");
  480. if (Statements_TestClass_switch_030.testMethod())
  481. {
  482. return MFTestResults.Pass;
  483. }
  484. return MFTestResults.Fail;
  485. }
  486. [TestMethod]
  487. public MFTestResults Statements_switch_031_Test()
  488. {
  489. Log.Comment(" switch with holes in range");
  490. if (Statements_TestClass_switch_031.testMethod())
  491. {
  492. return MFTestResults.Pass;
  493. }
  494. return MFTestResults.Fail;
  495. }
  496. [TestMethod]
  497. public MFTestResults Statements_switch_032_Test()
  498. {
  499. Log.Comment(" switch: default case at top");
  500. if (Statements_TestClass_switch_032.testMethod())
  501. {
  502. return MFTestResults.Pass;
  503. }
  504. return MFTestResults.Fail;
  505. }
  506. [TestMethod]
  507. public MFTestResults Statements_switch_033_Test()
  508. {
  509. Log.Comment(" switch: default case in middle");
  510. if (Statements_TestClass_switch_033.testMethod())
  511. {
  512. return MFTestResults.Pass;
  513. }
  514. return MFTestResults.Fail;
  515. }
  516. [TestMethod]
  517. public MFTestResults Statements_switch_034_Test()
  518. {
  519. Log.Comment(" switch: default case in middle");
  520. if (Statements_TestClass_switch_034.testMethod())
  521. {
  522. return MFTestResults.Pass;
  523. }
  524. return MFTestResults.Fail;
  525. }
  526. [TestMethod]
  527. public MFTestResults Statements_switch_035_Test()
  528. {
  529. Log.Comment("Otherwise, exactly one user-defined implicit conversion (§6.4) must exist from the type of ");
  530. Log.Comment("the switch expression to one of the following possible governing types: sbyte, byte, short,");
  531. Log.Comment("ushort, int, uint, long, ulong, char, string. If no such implicit conversion exists, or if ");
  532. Log.Comment("more than one such implicit conversion exists, a compile-time error occurs.");
  533. if (Statements_TestClass_switch_035.testMethod())
  534. {
  535. return MFTestResults.Pass;
  536. }
  537. return MFTestResults.Fail;
  538. }
  539. [TestMethod]
  540. public MFTestResults Statements_switch_036_Test()
  541. {
  542. Log.Comment("Otherwise, exactly one user-defined implicit conversion (§6.4) must exist from the type of ");
  543. Log.Comment("the switch expression to one of the following possible governing types: sbyte, byte, short,");
  544. Log.Comment("ushort, int, uint, long, ulong, char, string. If no such implicit conversion exists, or if ");
  545. Log.Comment("more than one such implicit conversion exists, a compile-time error occurs.");
  546. if (Statements_TestClass_switch_036.testMethod())
  547. {
  548. return MFTestResults.Pass;
  549. }
  550. return MFTestResults.Fail;
  551. }
  552. [TestMethod]
  553. public MFTestResults Statements_switch_037_Test()
  554. {
  555. Log.Comment("Otherwise, exactly one user-defined implicit conversion (§6.4) must exist from the type of ");
  556. Log.Comment("the switch expression to one of the following possible governing types: sbyte, byte, short,");
  557. Log.Comment("ushort, int, uint, long, ulong, char, string. If no such implicit conversion exists, or if ");
  558. Log.Comment("more than one such implicit conversion exists, a compile-time error occurs.");
  559. if (Statements_TestClass_switch_037.testMethod())
  560. {
  561. return MFTestResults.Pass;
  562. }
  563. return MFTestResults.Fail;
  564. }
  565. [TestMethod]
  566. public MFTestResults Statements_switch_038_Test()
  567. {
  568. Log.Comment("Otherwise, exactly one user-defined implicit conversion (§6.4) must exist from the type of ");
  569. Log.Comment("the switch expression to one of the following possible governing types: sbyte, byte, short,");
  570. Log.Comment("ushort, int, uint, long, ulong, char, string. If no such implicit conversion exists, or if ");
  571. Log.Comment("more than one such implicit conversion exists, a compile-time error occurs.");
  572. if (Statements_TestClass_switch_038.testMethod())
  573. {
  574. return MFTestResults.Pass;
  575. }
  576. return MFTestResults.Fail;
  577. }
  578. [TestMethod]
  579. public MFTestResults Statements_switch_039_Test()
  580. {
  581. Log.Comment("Otherwise, exactly one user-defined implicit conversion (§6.4) must exist from the type of ");
  582. Log.Comment("the switch expression to one of the following possible governing types: sbyte, byte, short,");
  583. Log.Comment("ushort, int, uint, long, ulong, char, string. If no such implicit conversion exists, or if ");
  584. Log.Comment("more than one such implicit conversion exists, a compile-time error occurs.");
  585. if (Statements_TestClass_switch_039.testMethod())
  586. {
  587. return MFTestResults.Pass;
  588. }
  589. return MFTestResults.Fail;
  590. }
  591. [TestMethod]
  592. public MFTestResults Statements_switch_040_Test()
  593. {
  594. Log.Comment("Otherwise, exactly one user-defined implicit conversion (§6.4) must exist from the type of ");
  595. Log.Comment("the switch expression to one of the following possible governing types: sbyte, byte, short,");
  596. Log.Comment("ushort, int, uint, long, ulong, char, string. If no such implicit conversion exists, or if ");
  597. Log.Comment("more than one such implicit conversion exists, a compile-time error occurs.");
  598. if (Statements_TestClass_switch_040.testMethod())
  599. {
  600. return MFTestResults.Pass;
  601. }
  602. return MFTestResults.Fail;
  603. }
  604. [TestMethod]
  605. public MFTestResults Statements_switch_041_Test()
  606. {
  607. Log.Comment("Otherwise, exactly one user-defined implicit conversion (§6.4) must exist from the type of ");
  608. Log.Comment("the switch expression to one of the following possible governing types: sbyte, byte, short,");
  609. Log.Comment("ushort, int, uint, long, ulong, char, string. If no such implicit conversion exists, or if ");
  610. Log.Comment("more than one such implicit conversion exists, a compile-time error occurs.");
  611. if (Statements_TestClass_switch_041.testMethod())
  612. {
  613. return MFTestResults.Pass;
  614. }
  615. return MFTestResults.Fail;
  616. }
  617. [TestMethod]
  618. public MFTestResults Statements_switch_042_Test()
  619. {
  620. Log.Comment("Otherwise, exactly one user-defined implicit conversion (§6.4) must exist from the type of ");
  621. Log.Comment("the switch expression to one of the following possible governing types: sbyte, byte, short,");
  622. Log.Comment("ushort, int, uint, long, ulong, char, string. If no such implicit conversion exists, or if ");
  623. Log.Comment("more than one such implicit conversion exists, a compile-time error occurs.");
  624. if (Statements_TestClass_switch_042.testMethod())
  625. {
  626. return MFTestResults.Pass;
  627. }
  628. return MFTestResults.Fail;
  629. }
  630. [TestMethod]
  631. public MFTestResults Statements_switch_044_Test()
  632. {
  633. Log.Comment("Otherwise, exactly one user-defined implicit conversion (§6.4) must exist from the type of ");
  634. Log.Comment("the switch expression to one of the following possible governing types: sbyte, byte, short,");
  635. Log.Comment("ushort, int, uint, long, ulong, char, string. If no such implicit conversion exists, or if ");
  636. Log.Comment("more than one such implicit conversion exists, a compile-time error occurs.");
  637. if (Statements_TestClass_switch_044.testMethod())
  638. {
  639. return MFTestResults.Pass;
  640. }
  641. return MFTestResults.Fail;
  642. }
  643. [TestMethod]
  644. public MFTestResults Statements_switch_047_Test()
  645. {
  646. Log.Comment("Otherwise, exactly one user-defined implicit conversion (§6.4) must exist from the type of ");
  647. Log.Comment("the switch expression to one of the following possible governing types: sbyte, byte, short,");
  648. Log.Comment("ushort, int, uint, long, ulong, char, string. If no such implicit conversion exists, or if ");
  649. Log.Comment("more than one such implicit conversion exists, a compile-time error occurs.");
  650. Log.Comment("Ensure error is emmited on when more than one implicit conversion to an acceptable governing type is defined");
  651. if (Statements_TestClass_switch_047.testMethod())
  652. {
  653. return MFTestResults.Pass;
  654. }
  655. return MFTestResults.Fail;
  656. }
  657. [TestMethod]
  658. public MFTestResults Statements_switch_049_Test()
  659. {
  660. Log.Comment("warning CS1522: Empty switch block");
  661. if (Statements_TestClass_switch_049.testMethod())
  662. {
  663. return MFTestResults.Pass;
  664. }
  665. return MFTestResults.Fail;
  666. }
  667. [TestMethod]
  668. public MFTestResults Statements_switch_string_001_Test()
  669. {
  670. Log.Comment(" switch on string: null");
  671. if (Statements_TestClass_switch_string_001.testMethod())
  672. {
  673. return MFTestResults.Pass;
  674. }
  675. return MFTestResults.Fail;
  676. }
  677. [TestMethod]
  678. public MFTestResults Statements_dowhile_001_Test()
  679. {
  680. Log.Comment("dowhile_001.sc");
  681. Log.Comment("do/while with a single statement");
  682. if (Statements_TestClass_dowhile_001.testMethod())
  683. {
  684. return MFTestResults.Pass;
  685. }
  686. return MFTestResults.Fail;
  687. }
  688. [TestMethod]
  689. public MFTestResults Statements_dowhile_002_Test()
  690. {
  691. Log.Comment("dowhile_002.sc");
  692. Log.Comment("do/while with a compound statement");
  693. if (Statements_TestClass_dowhile_002.testMethod())
  694. {
  695. return MFTestResults.Pass;
  696. }
  697. return MFTestResults.Fail;
  698. }
  699. [TestMethod]
  700. public MFTestResults Statements_dowhile_003_Test()
  701. {
  702. Log.Comment("dowhile_003.sc");
  703. Log.Comment("verify known false condition executes only once with single statement");
  704. if (Statements_TestClass_dowhile_003.testMethod())
  705. {
  706. return MFTestResults.Pass;
  707. }
  708. return MFTestResults.Fail;
  709. }
  710. [TestMethod]
  711. public MFTestResults Statements_dowhile_004_Test()
  712. {
  713. Log.Comment("dowhile_004.sc");
  714. Log.Comment("verify known true condition executes with single statement");
  715. if (Statements_TestClass_dowhile_004.testMethod())
  716. {
  717. return MFTestResults.Pass;
  718. }
  719. return MFTestResults.Fail;
  720. }
  721. [TestMethod]
  722. public MFTestResults Statements_dowhile_005_Test()
  723. {
  724. Log.Comment("dowhile_005.sc");
  725. Log.Comment("verify known false condition executes once with compound statements");
  726. if (Statements_TestClass_dowhile_005.testMethod())
  727. {
  728. return MFTestResults.Pass;
  729. }
  730. return MFTestResults.Fail;
  731. }
  732. [TestMethod]
  733. public MFTestResults Statements_dowhile_006_Test()
  734. {
  735. Log.Comment("dowhile_006.sc");
  736. Log.Comment("verify known true condition executes with compound statements");
  737. if (Statements_TestClass_dowhile_006.testMethod())
  738. {
  739. return MFTestResults.Pass;
  740. }
  741. return MFTestResults.Fail;
  742. }
  743. [TestMethod]
  744. public MFTestResults Statements_for_001_Test()
  745. {
  746. Log.Comment("for_001.sc");
  747. Log.Comment("empty for loop");
  748. if (Statements_TestClass_for_001.testMethod())
  749. {
  750. return MFTestResults.Pass;
  751. }
  752. return MFTestResults.Fail;
  753. }
  754. [TestMethod]
  755. public MFTestResults Statements_for_003_Test()
  756. {
  757. Log.Comment("for_003.sc");
  758. Log.Comment("empty initializer in for loop");
  759. if (Statements_TestClass_for_003.testMethod())
  760. {
  761. return MFTestResults.Pass;
  762. }
  763. return MFTestResults.Fail;
  764. }
  765. [TestMethod]
  766. public MFTestResults Statements_for_004_Test()
  767. {
  768. Log.Comment("for_004.sc");
  769. Log.Comment("empty iterator in for loop");
  770. if (Statements_TestClass_for_004.testMethod())
  771. {
  772. return MFTestResults.Pass;
  773. }
  774. return MFTestResults.Fail;
  775. }
  776. [TestMethod]
  777. public MFTestResults Statements_for_006_Test()
  778. {
  779. Log.Comment("for_006.sc");
  780. Log.Comment("Full normal for loop");
  781. if (Statements_TestClass_for_006.testMethod())
  782. {
  783. return MFTestResults.Pass;
  784. }
  785. return MFTestResults.Fail;
  786. }
  787. [TestMethod]
  788. public MFTestResults Statements_for_007_Test()
  789. {
  790. Log.Comment("for_007.sc");
  791. Log.Comment("Full normal for loop with a compound statement");
  792. if (Statements_TestClass_for_007.testMethod())
  793. {
  794. return MFTestResults.Pass;
  795. }
  796. return MFTestResults.Fail;
  797. }
  798. [TestMethod]
  799. public MFTestResults Statements_for_008_Test()
  800. {
  801. Log.Comment("for_008.sc");
  802. Log.Comment("Multiple declarations in initializer");
  803. if (Statements_TestClass_for_008.testMethod())
  804. {
  805. return MFTestResults.Pass;
  806. }
  807. return MFTestResults.Fail;
  808. }
  809. [TestMethod]
  810. public MFTestResults Statements_for_009_Test()
  811. {
  812. Log.Comment("for_009.sc");
  813. Log.Comment("Statements_TestClass_? statement expression lists in for initializer");
  814. if (Statements_TestClass_for_009.testMethod())
  815. {
  816. return MFTestResults.Pass;
  817. }
  818. return MFTestResults.Fail;
  819. }
  820. [TestMethod]
  821. public MFTestResults Statements_for_010_Test()
  822. {
  823. Log.Comment("for_010.sc");
  824. Log.Comment("Statements_TestClass_? statement expression lists in for iterator");
  825. if (Statements_TestClass_for_010.testMethod())
  826. {
  827. return MFTestResults.Pass;
  828. }
  829. return MFTestResults.Fail;
  830. }
  831. [TestMethod]
  832. public MFTestResults Statements_for_011_Test()
  833. {
  834. Log.Comment("for_011.sc");
  835. Log.Comment("Statements_TestClass_? statement expression lists in for initializer and iterator");
  836. if (Statements_TestClass_for_011.testMethod())
  837. {
  838. return MFTestResults.Pass;
  839. }
  840. return MFTestResults.Fail;
  841. }
  842. [TestMethod]
  843. public MFTestResults Statements_for_013_Test()
  844. {
  845. Log.Comment("for_013.sc");
  846. Log.Comment("Verify conditional evaluates before iterator");
  847. if (Statements_TestClass_for_013.testMethod())
  848. {
  849. return MFTestResults.Pass;
  850. }
  851. return MFTestResults.Fail;
  852. }
  853. [TestMethod]
  854. public MFTestResults Statements_for_014_Test()
  855. {
  856. Log.Comment("for_014.sc");
  857. Log.Comment("Verify method calls work ok in all for loop areas");
  858. if (Statements_TestClass_for_014.testMethod())
  859. {
  860. return MFTestResults.Pass;
  861. }
  862. return MFTestResults.Fail;
  863. }
  864. [TestMethod]
  865. public MFTestResults Statements_char_in_string_s01_Test()
  866. {
  867. Log.Comment("Optimization to foreach (char c in String) by treating String as a char array");
  868. if (Statements_TestClass_char_in_string_s01.testMethod())
  869. {
  870. return MFTestResults.Pass;
  871. }
  872. return MFTestResults.Fail;
  873. }
  874. [TestMethod]
  875. public MFTestResults Statements_char_in_string_ex01_Test()
  876. {
  877. Log.Comment("Optimization to foreach (char c in String) by treating String as a char array");
  878. if (Statements_TestClass_char_in_string_ex01.testMethod())
  879. {
  880. return MFTestResults.Pass;
  881. }
  882. return MFTestResults.Fail;
  883. }
  884. [TestMethod]
  885. public MFTestResults Statements_while_001_Test()
  886. {
  887. Log.Comment("while_001.sc");
  888. Log.Comment("while with a single statement");
  889. if (Statements_TestClass_while_001.testMethod())
  890. {
  891. return MFTestResults.Pass;
  892. }
  893. return MFTestResults.Fail;
  894. }
  895. [TestMethod]
  896. public MFTestResults Statements_while_002_Test()
  897. {
  898. Log.Comment("while_002.sc");
  899. Log.Comment("while with a compound statement");
  900. if (Statements_TestClass_while_002.testMethod())
  901. {
  902. return MFTestResults.Pass;
  903. }
  904. return MFTestResults.Fail;
  905. }
  906. [TestMethod]
  907. public MFTestResults Statements_while_003_Test()
  908. {
  909. Log.Comment("while_003.sc");
  910. Log.Comment("verify known false condition doesn't execute with single statement");
  911. if (Statements_TestClass_while_003.testMethod())
  912. {
  913. return MFTestResults.Pass;
  914. }
  915. return MFTestResults.Fail;
  916. }
  917. [TestMethod]
  918. public MFTestResults Statements_while_004_Test()
  919. {
  920. Log.Comment("while_004.sc");
  921. Log.Comment("verify known true condition executes with single statement");
  922. if (Statements_TestClass_while_004.testMethod())
  923. {
  924. return MFTestResults.Pass;
  925. }
  926. return MFTestResults.Fail;
  927. }
  928. [TestMethod]
  929. public MFTestResults Statements_while_005_Test()
  930. {
  931. Log.Comment("while_005.sc");
  932. Log.Comment("verify known false condition doesn't execute with compound statements");
  933. if (Statements_TestClass_while_005.testMethod())
  934. {
  935. return MFTestResults.Pass;
  936. }
  937. return MFTestResults.Fail;
  938. }
  939. [TestMethod]
  940. public MFTestResults Statements_while_006_Test()
  941. {
  942. Log.Comment("while_006.sc");
  943. Log.Comment("verify known true condition executes with compound statements");
  944. if (Statements_TestClass_while_006.testMethod())
  945. {
  946. return MFTestResults.Pass;
  947. }
  948. return MFTestResults.Fail;
  949. }
  950. [TestMethod]
  951. public MFTestResults Statements_break_001_Test()
  952. {
  953. Log.Comment("break_001.sc");
  954. Log.Comment("Make sure break works in all basic single statement loops");
  955. if (Statements_TestClass_break_001.testMethod())
  956. {
  957. return MFTestResults.Pass;
  958. }
  959. return MFTestResults.Fail;
  960. }
  961. [TestMethod]
  962. public MFTestResults Statements_break_002_Test()
  963. {
  964. Log.Comment("break_002.sc");
  965. Log.Comment("Make sure break works in all basic compound statement loops");
  966. if (Statements_TestClass_break_002.testMethod())
  967. {
  968. return MFTestResults.Pass;
  969. }
  970. return MFTestResults.Fail;
  971. }
  972. [TestMethod]
  973. public MFTestResults Statements_break_003_Test()
  974. {
  975. Log.Comment("break_003.sc");
  976. Log.Comment("Make sure break optional on end of switch");
  977. if (Statements_TestClass_break_003.testMethod())
  978. {
  979. return MFTestResults.Pass;
  980. }
  981. return MFTestResults.Fail;
  982. }
  983. [TestMethod]
  984. public MFTestResults Statements_break_006_Test()
  985. {
  986. Log.Comment("break_006.sc");
  987. Log.Comment("break in an if successfully breaks loop");
  988. if (Statements_TestClass_break_006.testMethod())
  989. {
  990. return MFTestResults.Pass;
  991. }
  992. return MFTestResults.Fail;
  993. }
  994. [TestMethod]
  995. public MFTestResults Statements_break_007_Test()
  996. {
  997. Log.Comment("break_007.sc");
  998. Log.Comment("break in a blocked if successfully breaks loop");
  999. if (Statements_TestClass_break_007.testMethod())
  1000. {
  1001. return MFTestResults.Pass;
  1002. }
  1003. return MFTestResults.Fail;
  1004. }
  1005. [TestMethod]
  1006. public MFTestResults Statements_break_010_Test()
  1007. {
  1008. Log.Comment("break_010.sc");
  1009. Log.Comment("Make sure break correctly when nested");
  1010. if (Statements_TestClass_break_010.testMethod())
  1011. {
  1012. return MFTestResults.Pass;
  1013. }
  1014. return MFTestResults.Fail;
  1015. }
  1016. [TestMethod]
  1017. public MFTestResults Statements_continue_001_Test()
  1018. {
  1019. Log.Comment("continue_001.sc");
  1020. Log.Comment("Make sure continue works in all basic single statement loops");
  1021. if (Statements_TestClass_continue_001.testMethod())
  1022. {
  1023. return MFTestResults.Pass;
  1024. }
  1025. return MFTestResults.Fail;
  1026. }
  1027. [TestMethod]
  1028. public MFTestResults Statements_continue_002_Test()
  1029. {
  1030. Log.Comment("continue_002.sc");
  1031. Log.Comment("Make sure continue works in all basic compound statement loops");
  1032. Log.Comment("Expected Output");
  1033. if (Statements_TestClass_continue_002.testMethod())
  1034. {
  1035. return MFTestResults.Pass;
  1036. }
  1037. return MFTestResults.Fail;
  1038. }
  1039. [TestMethod]
  1040. public MFTestResults Statements_continue_006_Test()
  1041. {
  1042. Log.Comment("continue_006.sc");
  1043. Log.Comment("continue in an if successfully continues loop");
  1044. if (Statements_TestClass_continue_006.testMethod())
  1045. {
  1046. return MFTestResults.Pass;
  1047. }
  1048. return MFTestResults.Fail;
  1049. }
  1050. [TestMethod]
  1051. public MFTestResults Statements_continue_007_Test()
  1052. {
  1053. Log.Comment("continue_007.sc");
  1054. Log.Comment("continue in a block if successfully continues loop");
  1055. if (Statements_TestClass_continue_007.testMethod())
  1056. {
  1057. return MFTestResults.Pass;
  1058. }
  1059. return MFTestResults.Fail;
  1060. }
  1061. [TestMethod]
  1062. public MFTestResults Statements_continue_010_Test()
  1063. {
  1064. Log.Comment("continue_010.sc");
  1065. Log.Comment("Make sure continue works correctly when nested");
  1066. if (Statements_TestClass_continue_010.testMethod())
  1067. {
  1068. return MFTestResults.Pass;
  1069. }
  1070. return MFTestResults.Fail;
  1071. }
  1072. [TestMethod]
  1073. public MFTestResults Statements_goto_001_Test()
  1074. {
  1075. Log.Comment("goto_001.sc");
  1076. Log.Comment("simple goto to adjust flow control");
  1077. if (Statements_TestClass_goto_001.testMethod())
  1078. {
  1079. return MFTestResults.Pass;
  1080. }
  1081. return MFTestResults.Fail;
  1082. }
  1083. [TestMethod]
  1084. public MFTestResults Statements_goto_008_Test()
  1085. {
  1086. Log.Comment("goto_008.sc");
  1087. Log.Comment("goto currect case");
  1088. if (Statements_TestClass_goto_008.testMethod())
  1089. {
  1090. return MFTestResults.Pass;
  1091. }
  1092. return MFTestResults.Fail;
  1093. }
  1094. [TestMethod]
  1095. public MFTestResults Statements_goto_009_Test()
  1096. {
  1097. Log.Comment("goto_009.sc");
  1098. Log.Comment("goto a different case");
  1099. Log.Comment("Expected Output");
  1100. if (Statements_TestClass_goto_009.testMethod())
  1101. {
  1102. return MFTestResults.Pass;
  1103. }
  1104. return MFTestResults.Fail;
  1105. }
  1106. [TestMethod]
  1107. public MFTestResults Statements_goto_010_Test()
  1108. {
  1109. Log.Comment("goto_010.sc");
  1110. Log.Comment("goto default correctly");
  1111. if (Statements_TestClass_goto_010.testMethod())
  1112. {
  1113. return MFTestResults.Pass;
  1114. }
  1115. return MFTestResults.Fail;
  1116. }
  1117. [TestMethod]
  1118. public MFTestResults Statements_goto_014_Test()
  1119. {
  1120. Log.Comment("goto_014.sc");
  1121. Log.Comment("simple gotos to test jumping to parent process.");
  1122. if (Statements_TestClass_goto_014.testMethod())
  1123. {
  1124. return MFTestResults.Pass;
  1125. }
  1126. return MFTestResults.Fail;
  1127. }
  1128. [TestMethod]
  1129. public MFTestResults Statements_goto_017_Test()
  1130. {
  1131. Log.Comment(" some gotos");
  1132. if (Statements_TestClass_goto_017.testMethod())
  1133. {
  1134. return MFTestResults.Pass;
  1135. }
  1136. return MFTestResults.Fail;
  1137. }
  1138. [TestMethod]
  1139. public MFTestResults Statements_goto_018_Test()
  1140. {
  1141. Log.Comment(" try/catch/finally with goto");
  1142. if (Statements_TestClass_goto_018.testMethod())
  1143. {
  1144. return MFTestResults.Pass;
  1145. }
  1146. return MFTestResults.Fail;
  1147. }
  1148. [TestMethod]
  1149. public MFTestResults Statements_return_001_Test()
  1150. {
  1151. Log.Comment("return_001.sc");
  1152. Log.Comment("simple void return on a void method");
  1153. if (Statements_TestClass_return_001.testMethod())
  1154. {
  1155. return MFTestResults.Pass;
  1156. }
  1157. return MFTestResults.Fail;
  1158. }
  1159. [TestMethod]
  1160. public MFTestResults Statements_return_004_Test()
  1161. {
  1162. Log.Comment("return_004.sc");
  1163. Log.Comment("simple return a normal type, assigning, and ignoring return value");
  1164. if (Statements_TestClass_return_004.testMethod())
  1165. {
  1166. return MFTestResults.Pass;
  1167. }
  1168. return MFTestResults.Fail;
  1169. }
  1170. [TestMethod]
  1171. public MFTestResults Statements_return_006_Test()
  1172. {
  1173. Log.Comment("return_006.sc");
  1174. Log.Comment("simple return a type mismatch that has an implicit conversion");
  1175. if (Statements_TestClass_return_006.testMethod())
  1176. {
  1177. return MFTestResults.Pass;
  1178. }
  1179. return MFTestResults.Fail;
  1180. }
  1181. [TestMethod]
  1182. public MFTestResults Statements_return_008_Test()
  1183. {
  1184. Log.Comment("return_008.sc");
  1185. Log.Comment("simple return a type mismatch that has an explicit convertion conversion,");
  1186. Log.Comment("applying the cast");
  1187. if (Statements_TestClass_return_008.testMethod())
  1188. {
  1189. return MFTestResults.Pass;
  1190. }
  1191. return MFTestResults.Fail;
  1192. }
  1193. [TestMethod]
  1194. public MFTestResults Statements_return_009_Test()
  1195. {
  1196. Log.Comment("return_009.sc");
  1197. Log.Comment("return of a struct");
  1198. if (Statements_TestClass_return_009.testMethod())
  1199. {
  1200. return MFTestResults.Pass;
  1201. }
  1202. return MFTestResults.Fail;
  1203. }
  1204. [TestMethod]
  1205. public MFTestResults Statements_return_010_Test()
  1206. {
  1207. Log.Comment("return_010.sc");
  1208. Log.Comment("return of a class");
  1209. if (Statements_TestClass_return_010.testMethod())
  1210. {
  1211. return MFTestResults.Pass;
  1212. }
  1213. return MFTestResults.Fail;
  1214. }
  1215. [TestMethod]
  1216. public MFTestResults Statements_return_013_Test()
  1217. {
  1218. Log.Comment("return_013.sc");
  1219. Log.Comment("simple falloff on a void method");
  1220. if (Statements_TestClass_return_013.testMethod())
  1221. {
  1222. return MFTestResults.Pass;
  1223. }
  1224. return MFTestResults.Fail;
  1225. }
  1226. [TestMethod]
  1227. public MFTestResults Statements_return_014_Test()
  1228. {
  1229. Log.Comment("return_014.sc");
  1230. Log.Comment("verify that a 'throw' is adequate for flow control analysis of return type");
  1231. if (Statements_TestClass_return_014.testMethod())
  1232. {
  1233. return MFTestResults.Pass;
  1234. }
  1235. return MFTestResults.Fail;
  1236. }
  1237. [TestMethod]
  1238. public MFTestResults Statements_throw_001_Test()
  1239. {
  1240. Log.Comment("throw_001.sc");
  1241. Log.Comment("simple throw");
  1242. if (Statements_TestClass_throw_001.testMethod())
  1243. {
  1244. return MFTestResults.Pass;
  1245. }
  1246. return MFTestResults.Fail;
  1247. }
  1248. [TestMethod]
  1249. pub

Large files files are truncated, but you can click here to view the full file