2 using System.Runtime.InteropServices;
6 #region methods for InnerSequential struct
7 // Return new InnerSequential instance
8 public static InnerSequential NewInnerSequential(int f1, float f2, string f3)
10 InnerSequential inner_seq = new InnerSequential();
16 // Prints InnerSequential
17 public static void PrintInnerSequential(InnerSequential inner_seq, string name)
19 Console.WriteLine("\t{0}.f1 = {1}", name, inner_seq.f1);
20 Console.WriteLine("\t{0}.f2 = {1}", name, inner_seq.f2);
21 Console.WriteLine("\t{0}.f3 = {1}", name, inner_seq.f3);
23 public static bool ValidateInnerSequential(InnerSequential s1, InnerSequential s2, string methodName)
25 if (s1.f1 != s2.f1 || s1.f2 != s2.f2 || s1.f3 != s2.f3)
27 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
28 Console.WriteLine("\tThe Actual is...");
29 PrintInnerSequential(s1, s1.ToString());
30 Console.WriteLine("\tThe Expected is...");
31 PrintInnerSequential(s2, s2.ToString());
36 Console.WriteLine("\tPASSED!");
43 #region methods for INNER2 struct
44 // Return new INNER2 instance
45 public static INNER2 NewINNER2(int f1, float f2, string f3)
47 INNER2 inner = new INNER2();
54 public static void PrintINNER2(INNER2 inner, string name)
56 Console.WriteLine("\t{0}.f1 = {1}", name, inner.f1);
57 Console.WriteLine("\t{0}.f2 = {1}", name, inner.f2);
58 Console.WriteLine("\t{0}.f3 = {1}", name, inner.f3);
60 public static bool ValidateINNER2(INNER2 inner1, INNER2 inner2, string methodName)
62 if (inner1.f1 != inner2.f1 || inner1.f2 != inner2.f2 || inner1.f3 != inner2.f3)
64 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
65 Console.WriteLine("\tThe Actual is...");
66 PrintINNER2(inner1, inner1.ToString());
67 Console.WriteLine("\tThe Expected is...");
68 PrintINNER2(inner2, inner2.ToString());
73 Console.WriteLine("\tPASSED!");
80 #region methods for InnerExplicit struct
81 // Return new InnerExplicit instance
82 public static InnerExplicit NewInnerExplicit(int f1, float f2, string f3)
84 InnerExplicit inner = new InnerExplicit();
90 // Prints InnerExplicit
91 public static void PrintInnerExplicit(InnerExplicit inner, string name)
93 Console.WriteLine("\t{0}.f1 = {1}", name, inner.f1);
94 Console.WriteLine("\t{0}.f2 = {1}", name, inner.f2);
95 Console.WriteLine("\t{0}.f3 = {1}", name, inner.f3);
97 public static bool ValidateInnerExplicit(InnerExplicit inner1, InnerExplicit inner2, string methodName)
99 if (inner1.f1 != inner2.f1 || inner1.f2 != inner2.f2 || inner1.f3 != inner2.f3)
101 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
102 Console.WriteLine("\tThe Actual is...");
103 PrintInnerExplicit(inner1, inner1.ToString());
104 Console.WriteLine("\tThe Expected is...");
105 PrintInnerExplicit(inner2, inner2.ToString());
110 Console.WriteLine("\tPASSED!");
117 #region methods for InnerArraySequential struct
118 // Returns new OUTER instance; the params are the fields of INNER;
119 // all the INNER elements have the same field values
120 public static InnerArraySequential NewInnerArraySequential(int f1, float f2, string f3)
122 InnerArraySequential outer = new InnerArraySequential();
123 outer.arr = new InnerSequential[Common.NumArrElements];
124 for (int i = 0; i < Common.NumArrElements; i++)
126 outer.arr[i].f1 = f1;
127 outer.arr[i].f2 = f2;
128 outer.arr[i].f3 = f3;
132 // Prints InnerArraySequential
133 public static void PrintInnerArraySequential(InnerArraySequential outer, string name)
135 for (int i = 0; i < Common.NumArrElements; i++)
137 Console.WriteLine("\t{0}.arr[{1}].f1 = {2}", name, i, outer.arr[i].f1);
138 Console.WriteLine("\t{0}.arr[{1}].f2 = {2}", name, i, outer.arr[i].f2);
139 Console.WriteLine("\t{0}.arr[{1}].f3 = {2}", name, i, outer.arr[i].f3);
142 // Returns true if the two params have the same fields
143 public static bool ValidateInnerArraySequential(InnerArraySequential outer1, InnerArraySequential outer2, string methodName)
145 for (int i = 0; i < Common.NumArrElements; i++)
147 if (outer1.arr[i].f1 != outer2.arr[i].f1 ||
148 outer1.arr[i].f2 != outer2.arr[i].f2 ||
149 outer1.arr[i].f3 != outer2.arr[i].f3)
151 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
152 Console.WriteLine("\tThe Actual is...");
153 Console.WriteLine("\t{0}.arr[{1}].f1 = {2}", outer1.ToString(), i, outer1.arr[i].f1);
154 Console.WriteLine("\t{0}.arr[{1}].f2 = {2}", outer1.ToString(), i, outer1.arr[i].f2);
155 Console.WriteLine("\t{0}.arr[{1}].f3 = {2}", outer1.ToString(), i, outer1.arr[i].f3);
156 Console.WriteLine("\tThe Expected is...");
157 Console.WriteLine("\t{0}.arr[{1}].f1 = {2}", outer2.ToString(), i, outer2.arr[i].f1);
158 Console.WriteLine("\t{0}.arr[{1}].f2 = {2}", outer2.ToString(), i, outer2.arr[i].f2);
159 Console.WriteLine("\t{0}.arr[{1}].f3 = {2}", outer2.ToString(), i, outer2.arr[i].f3);
163 Console.WriteLine("\tPASSED!");
168 #region methods for InnerArrayExplicit struct
169 // Returns new InnerArrayExplicit instance; the params are the fields of INNER;
170 // all the INNER elements have the same field values
171 public static InnerArrayExplicit NewInnerArrayExplicit(int f1, float f2, string f3, string f4)
173 InnerArrayExplicit outer = new InnerArrayExplicit();
174 outer.arr = new InnerSequential[Common.NumArrElements];
175 for (int i = 0; i < Common.NumArrElements; i++)
177 outer.arr[i].f1 = f1;
178 outer.arr[i].f2 = f2;
179 outer.arr[i].f3 = f3;
184 // Prints InnerArrayExplicit
185 public static void PrintInnerArrayExplicit(InnerArrayExplicit outer, string name)
187 for (int i = 0; i < Common.NumArrElements; i++)
189 Console.WriteLine("\t{0}.arr[{1}].f1 = {2}", name, i, outer.arr[i].f1);
190 Console.WriteLine("\t{0}.arr[{1}].f2 = {2}", name, i, outer.arr[i].f2);
191 Console.WriteLine("\t{0}.arr[{1}].f3 = {2}", name, i, outer.arr[i].f3);
193 Console.WriteLine("\t{0}.f4 = {1}", name, outer.f4);
195 // Returns true if the two params have the same fields
196 public static bool ValidateInnerArrayExplicit(InnerArrayExplicit outer1, InnerArrayExplicit InnerArrayExplicit, string methodName)
198 for (int i = 0; i < Common.NumArrElements; i++)
200 if (outer1.arr[i].f1 != InnerArrayExplicit.arr[i].f1)
202 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
203 Console.WriteLine("\tThe Actual f1 field is...");
204 Console.WriteLine("\t{0}.arr[{1}].f1 = {2}", outer1.ToString(), i, outer1.arr[i].f1);
205 Console.WriteLine("\tThe Expected f1 field is...");
206 Console.WriteLine("\t{0}.arr[{1}].f1 = {2}", InnerArrayExplicit.ToString(), i, InnerArrayExplicit.arr[i].f1);
210 if (outer1.f4 != InnerArrayExplicit.f4)
212 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
213 Console.WriteLine("\tThe Actual f4 field is...");
214 Console.WriteLine("\t{0}.f4 = {1}", outer1.ToString(), outer1.f4);
215 Console.WriteLine("\tThe Expected f4 field is...");
216 Console.WriteLine("\t{0}.f4 = {1}", InnerArrayExplicit.ToString(), InnerArrayExplicit.f4);
219 Console.WriteLine("\tPASSED!");
224 #region methods for OUTER3 struct
225 // Returns new OUTER3 instance; the params are the fields of INNER;
226 // all the INNER elements have the same field values
227 public static OUTER3 NewOUTER3(int f1, float f2, string f3, string f4)
229 OUTER3 outer = new OUTER3();
230 outer.arr = new InnerSequential[Common.NumArrElements];
231 for (int i = 0; i < Common.NumArrElements; i++)
233 outer.arr[i].f1 = f1;
234 outer.arr[i].f2 = f2;
235 outer.arr[i].f3 = f3;
241 public static void PrintOUTER3(OUTER3 outer, string name)
243 for (int i = 0; i < Common.NumArrElements; i++)
245 Console.WriteLine("\t{0}.arr[{1}].f1 = {2}", name, i, outer.arr[i].f1);
246 Console.WriteLine("\t{0}.arr[{1}].f2 = {2}", name, i, outer.arr[i].f2);
247 Console.WriteLine("\t{0}.arr[{1}].f3 = {2}", name, i, outer.arr[i].f3);
249 Console.WriteLine("\t{0}.f4 = {1}", name, outer.f4);
251 // Returns true if the two params have the same fields
252 public static bool ValidateOUTER3(OUTER3 outer1, OUTER3 InnerArrayExplicit, string methodName)
254 for (int i = 0; i < Common.NumArrElements; i++)
256 if (outer1.arr[i].f1 != InnerArrayExplicit.arr[i].f1 ||
257 outer1.arr[i].f2 != InnerArrayExplicit.arr[i].f2 ||
258 outer1.arr[i].f3 != InnerArrayExplicit.arr[i].f3)
260 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
261 Console.WriteLine("\tThe Actual is...");
262 Console.WriteLine("\t{0}.arr[{1}].f1 = {2}", outer1.ToString(), i, outer1.arr[i].f1);
263 Console.WriteLine("\t{0}.arr[{1}].f2 = {2}", outer1.ToString(), i, outer1.arr[i].f2);
264 Console.WriteLine("\t{0}.arr[{1}].f3 = {2}", outer1.ToString(), i, outer1.arr[i].f3);
265 Console.WriteLine("\tThe Expected is...");
266 Console.WriteLine("\t{0}.arr[{1}].f1 = {2}", InnerArrayExplicit.ToString(), i, InnerArrayExplicit.arr[i].f1);
267 Console.WriteLine("\t{0}.arr[{1}].f2 = {2}", InnerArrayExplicit.ToString(), i, InnerArrayExplicit.arr[i].f2);
268 Console.WriteLine("\t{0}.arr[{1}].f3 = {2}", InnerArrayExplicit.ToString(), i, InnerArrayExplicit.arr[i].f3);
272 if (outer1.f4 != InnerArrayExplicit.f4)
274 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
275 Console.WriteLine("\tThe Actual f4 field is...");
276 Console.WriteLine("\t{0}.f4 = {1}", outer1.ToString(), outer1.f4);
277 Console.WriteLine("\tThe Expected f4 field is...");
278 Console.WriteLine("\t{0}.f4 = {1}", InnerArrayExplicit.ToString(), InnerArrayExplicit.f4);
281 Console.WriteLine("\tPASSED!");
286 #region methods for CharSetAnsiSequential struct
287 //return CharSetAnsiSequential struct instance
288 public static CharSetAnsiSequential NewCharSetAnsiSequential(string f1, char f2)
290 CharSetAnsiSequential str1 = new CharSetAnsiSequential();
295 //print the struct CharSetAnsiSequential element
296 public static void PrintCharSetAnsiSequential(CharSetAnsiSequential str1, string name)
298 Console.WriteLine("\t{0}.f1 = {1}", name, str1.f1);
299 Console.WriteLine("\t{0}.f2 = {1}", name, str1.f2);
301 // Returns true if the two params have the same fields
302 public static bool ValidateCharSetAnsiSequential(CharSetAnsiSequential str1, CharSetAnsiSequential str2, string methodName)
304 if (str1.f1 != str2.f1 || str1.f2 != str2.f2)
306 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
307 Console.WriteLine("\tThe Actual is...");
308 PrintCharSetAnsiSequential(str1, str1.ToString());
309 Console.WriteLine("\tThe Expected is...");
310 PrintCharSetAnsiSequential(str2, str2.ToString());
315 Console.WriteLine("\tPASSED!");
322 #region methods for CharSetUnicodeSequential struct
323 //return the struct CharSetUnicodeSequential instance
324 public static CharSetUnicodeSequential NewCharSetUnicodeSequential(string f1, char f2)
326 CharSetUnicodeSequential str1 = new CharSetUnicodeSequential();
331 //print the struct CharSetUnicodeSequential element
332 public static void PrintCharSetUnicodeSequential(CharSetUnicodeSequential str1, string name)
334 Console.WriteLine("\t{0}.f1 = {1}", name, str1.f1);
335 Console.WriteLine("\t{0}.f2 = {1}", name, str1.f2);
337 // Returns true if the two params have the same fields
338 public static bool ValidateCharSetUnicodeSequential(CharSetUnicodeSequential str1, CharSetUnicodeSequential str2, string methodName)
340 if (str1.f1 != str2.f1 || str1.f2 != str2.f2)
342 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
343 Console.WriteLine("\tThe Actual is...");
344 PrintCharSetUnicodeSequential(str1, str1.ToString());
345 Console.WriteLine("\tThe Expected is...");
346 PrintCharSetUnicodeSequential(str2, str2.ToString());
351 Console.WriteLine("\tPASSED!");
357 #region methods for NumberSequential struct
358 public static NumberSequential NewNumberSequential(int i32, uint ui32, short s1, ushort us1, Byte b, SByte sb,
359 Int16 i16, UInt16 ui16, Int64 i64, UInt64 ui64, Single sgl, Double d)
361 NumberSequential str1 = new NumberSequential();
376 public static void PrintNumberSequential(NumberSequential str1, string name)
378 Console.WriteLine("\t{0}.i32 = {1}", name, str1.i32);
379 Console.WriteLine("\t{0}.ui32 = {1}", name, str1.ui32);
380 Console.WriteLine("\t{0}.s1 = {1}", name, str1.s1);
381 Console.WriteLine("\t{0}.us1 = {1}", name, str1.us1);
382 Console.WriteLine("\t{0}.b = {1}", name, str1.b);
383 Console.WriteLine("\t{0}.sb = {1}", name, str1.sb);
384 Console.WriteLine("\t{0}.i16 = {1}", name, str1.i16);
385 Console.WriteLine("\t{0}.ui16 = {1}", name, str1.ui16);
386 Console.WriteLine("\t{0}.i64 = {1}", name, str1.i64);
387 Console.WriteLine("\t{0}.ui64 = {1}", name, str1.ui64);
388 Console.WriteLine("\t{0}.sgl = {1}", name, str1.sgl);
389 Console.WriteLine("\t{0}.d = {1}", name, str1.d);
391 public static bool ValidateNumberSequential(NumberSequential str1, NumberSequential str2, string methodName)
393 if (str1.i32 != str2.i32 || str1.ui32 != str2.ui32 || str1.s1 != str2.s1 ||
394 str1.us1 != str2.us1 || str1.b != str2.b || str1.sb != str2.sb || str1.i16 != str2.i16 ||
395 str1.ui16 != str2.ui16 || str1.i64 != str2.i64 || str1.ui64 != str2.ui64 ||
396 str1.sgl != str2.sgl || str1.d != str2.d)
398 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
399 Console.WriteLine("\tThe Actual is...");
400 PrintNumberSequential(str1, str1.ToString());
401 Console.WriteLine("\tThe Expected is...");
402 PrintNumberSequential(str2, str2.ToString());
407 Console.WriteLine("\tPASSED!");
413 #region methods for S3 struct
414 public static void InitialArray(int[] iarr, int[] icarr)
416 for (int i = 0; i < iarr.Length; i++)
421 for (int i = 1; i < icarr.Length + 1; i++)
428 public static S3 NewS3(bool flag, string str, int[] vals)
436 public static void PrintS3(S3 str1, string name)
438 Console.WriteLine("\t{0}.flag = {1}", name, str1.flag);
439 Console.WriteLine("\t{0}.flag = {1}", name, str1.str);
440 for (int i = 0; i < str1.vals.Length; i++)
442 Console.WriteLine("\t{0}.vals[{1}] = {2}", name, i, str1.vals[i]);
445 public static bool ValidateS3(S3 str1, S3 str2, string methodName)
448 if (str1.flag != str2.flag || str1.str != str2.str)
450 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
451 Console.WriteLine("\tThe Actual flag field is...");
452 Console.WriteLine("\t{0}.flag = {1}", str1.ToString(), str1.flag);
453 Console.WriteLine("\t{0}.str = {1}", str1.ToString(), str1.str);
454 Console.WriteLine("\tThe Expected is...");
455 Console.WriteLine("\t{0}.flag = {1}", str2.ToString(), str2.flag);
456 Console.WriteLine("\t{0}.str = {1}", str2.ToString(), str2.str);
459 for (int i = 0; i < 256; i++)
461 if (str1.vals[i] != str2.vals[i])
463 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
464 Console.WriteLine("\tThe Actual vals field is...");
465 Console.WriteLine("\t{0}.vals[{1}] = {2}", str1.ToString(), i, str1.vals[i]);
466 Console.WriteLine("\tThe Expected vals field is...");
467 Console.WriteLine("\t{0}.vals[{1}] = {2}", str2.ToString(), i, str2.vals[i]);
475 Console.WriteLine("\tPASSED!");
480 #region methods for S5 struct
481 public static S5 NewS5(int age, string name,Enum1 ef)
493 public static void PrintS5(S5 str1, string name)
495 Console.WriteLine("\t{0}.s4.age = {1}", str1.s4.age);
496 Console.WriteLine("\t{0}.s4.name = {1}", str1.s4.name);
497 Console.WriteLine("\t{0}.ef = {1}", str1.ef.ToString());
499 public static bool ValidateS5(S5 str1, S5 str2, string methodName)
501 if (str1.s4.age != str2.s4.age || str1.s4.name != str2.s4.name)
503 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
504 Console.WriteLine("\tThe Actual s4 field is...");
505 Console.WriteLine("\t{0}.s4.age = {1}", str1.ToString(), str1.s4.age);
506 Console.WriteLine("\t{0}.s4.name = {1}", str1.ToString(), str1.s4.name);
507 Console.WriteLine("\tThe Expected s4 field is...");
508 Console.WriteLine("\t{0}.s4.age = {1}", str2.ToString(), str2.s4.age);
509 Console.WriteLine("\t{0}.s4.name = {1}", str2.ToString(), str2.s4.name);
512 if (str1.ef != str2.ef)
514 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
515 Console.WriteLine("\tThe Actual ef field is...");
516 Console.WriteLine("\t{0}.ef = {1}", str1.ToString(), str1.ef);
517 Console.WriteLine("\tThe Expected s4 field is...");
518 Console.WriteLine("\t{0}.ef = {1}", str2.ToString(), str2.ef);
521 Console.WriteLine("\tPASSED!");
526 #region methods for StringStructSequentialAnsi struct
527 public static StringStructSequentialAnsi NewStringStructSequentialAnsi(string first, string last)
529 StringStructSequentialAnsi s6 = new StringStructSequentialAnsi();
535 public static void PrintStringStructSequentialAnsi(StringStructSequentialAnsi str1, string name)
537 Console.WriteLine("\t{0}.first = {1}", name, str1.first);
538 Console.WriteLine("\t{0}.last = {1}", name, str1.last);
540 public static bool ValidateStringStructSequentialAnsi(StringStructSequentialAnsi str1, StringStructSequentialAnsi str2, string methodName)
542 if (str1.first != str2.first || str1.last != str2.last)
544 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
545 Console.WriteLine("\tThe Actual is...");
546 PrintStringStructSequentialAnsi(str1, str1.ToString());
547 Console.WriteLine("\tThe Expected is...");
548 PrintStringStructSequentialAnsi(str2, str2.ToString());
553 Console.WriteLine("\tPASSED!");
559 #region methods for StringStructSequentialUnicode struct
560 public static StringStructSequentialUnicode NewStringStructSequentialUnicode(string first, string last)
562 StringStructSequentialUnicode s7 = new StringStructSequentialUnicode();
568 public static void PrintStringStructSequentialUnicode(StringStructSequentialUnicode str1, string name)
570 Console.WriteLine("\t{0}.first = {1}", name, str1.first);
571 Console.WriteLine("\t{0}.last = {1}", name, str1.last);
573 public static bool ValidateStringStructSequentialUnicode(StringStructSequentialUnicode str1, StringStructSequentialUnicode str2, string methodName)
575 if (str1.first != str2.first || str1.last != str2.last)
577 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
578 Console.WriteLine("\tThe Actual is...");
579 PrintStringStructSequentialUnicode(str1, str1.ToString());
580 Console.WriteLine("\tThe Expected is...");
581 PrintStringStructSequentialUnicode(str2, str2.ToString());
586 Console.WriteLine("\tPASSED!");
592 #region methods for S8 struct
593 public static S8 NewS8(string name, bool gender, UInt16 jobNum, int i32, uint ui32, sbyte mySByte)
601 s8.mySByte = mySByte;
604 public static void PrintS8(S8 str1, string name)
606 Console.WriteLine("\t{0}.name = {1}", name, str1.name);
607 Console.WriteLine("\t{0}.gender = {1}", name, str1.gender);
608 Console.WriteLine("\t{0}.jobNum = {1}", name, str1.jobNum);
609 Console.WriteLine("\t{0}.i32 = {1}", name, str1.i32);
610 Console.WriteLine("\t{0}.ui32 = {1}", name, str1.ui32);
611 Console.WriteLine("\t{0}.mySByte = {1}", name, str1.mySByte);
613 public static bool ValidateS8(S8 str1, S8 str2, string methodName)
615 if (str1.name != str2.name || str1.gender != str2.gender ||
616 str1.jobNum != str2.jobNum ||
617 str1.i32 != str2.i32 || str1.ui32 != str2.ui32 || str1.mySByte != str2.mySByte)
619 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
620 Console.WriteLine("\tThe Actual is...");
621 PrintS8(str1, str1.ToString());
622 Console.WriteLine("\tThe Expected is...");
623 PrintS8(str2, str2.ToString());
626 Console.WriteLine("\tPASSED!");
633 #region methods for S9 struct
634 public static S9 NewS9(int i32, TestDelegate1 testDel1)
638 s9.myDelegate1 = testDel1;
641 public static bool ValidateS9(S9 str1, S9 str2, string methodName)
643 if (str1.i32 != str2.i32 || str1.myDelegate1 != str2.myDelegate1)
645 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
646 Console.WriteLine("\tThe Actual is...");
647 Console.WriteLine("\t{0}.i32 = {1}", str1.ToString(), str1.i32);
648 Console.WriteLine("\t{0}.myDelegate1 = {1}", str1.ToString(), str1.myDelegate1);
649 Console.WriteLine("\tThe Expected is...");
650 Console.WriteLine("\t{0}.i32 = {1}", str2.ToString(), str2.i32);
651 Console.WriteLine("\t{0}.myDelegate1 = {1}", str2.ToString(), str2.myDelegate1);
654 Console.WriteLine("\tPASSED!");
659 #region methods for IncludeOuterIntergerStructSequential struct
660 public static IncludeOuterIntergerStructSequential NewIncludeOuterIntergerStructSequential(int i321, int i322)
662 IncludeOuterIntergerStructSequential s10 = new IncludeOuterIntergerStructSequential();
663 s10.s.s_int.i = i321;
667 public static void PrintIncludeOuterIntergerStructSequential(IncludeOuterIntergerStructSequential str1, string name)
669 Console.WriteLine("\t{0}.s.s_int.i = {1}", name, str1.s.s_int.i);
670 Console.WriteLine("\t{0}.s.i = {1}", name, str1.s.i);
672 public static bool ValidateIncludeOuterIntergerStructSequential(IncludeOuterIntergerStructSequential str1, IncludeOuterIntergerStructSequential str2, string methodName)
674 if (str1.s.s_int.i != str2.s.s_int.i || str1.s.i != str2.s.i)
676 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
677 Console.WriteLine("\tThe Actual is...");
678 PrintIncludeOuterIntergerStructSequential(str1, str1.ToString());
679 Console.WriteLine("\tThe Expected is...");
680 PrintIncludeOuterIntergerStructSequential(str2, str2.ToString());
685 Console.WriteLine("\tPASSED!");
691 #region methods for S11 struct
692 unsafe public static void PrintS11(S11 str1, string name)
694 Console.WriteLine("\t{0}.i32 = {1}", name, (int)(str1.i32));
695 Console.WriteLine("\t{0}.i = {1}", name, str1.i);
697 unsafe public static S11 NewS11(int* i32, int i)
704 unsafe public static bool ValidateS11(S11 str1, S11 str2, string methodName)
706 if (str1.i32 != str2.i32 || str1.i != str2.i)
708 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
709 Console.WriteLine("\tThe Actual is...");
710 PrintS11(str1, str1.ToString());
711 Console.WriteLine("\tThe Expected is...");
712 PrintS11(str2, str2.ToString());
715 Console.WriteLine("\tPASSED!");
720 #region methods for U struct
721 public static U NewU(int i32, uint ui32, IntPtr iPtr, UIntPtr uiPtr, short s, ushort us, byte b, sbyte sb, long l, ulong ul, float f, double d)
739 public static void PrintU(U str1, string name)
741 Console.WriteLine("\t{0}.i32 = {1}", name, str1.i32);
742 Console.WriteLine("\t{0}.ui32 = {1}", name, str1.ui32);
743 Console.WriteLine("\t{0}.iPtr = {1}", name, str1.iPtr);
744 Console.WriteLine("\t{0}.uiPtr = {1}", name, str1.uiPtr);
745 Console.WriteLine("\t{0}.s = {1}", name, str1.s);
746 Console.WriteLine("\t{0}.us = {1}", name, str1.us);
747 Console.WriteLine("\t{0}.b = {1}", name, str1.b);
748 Console.WriteLine("\t{0}.sb = {1}", name, str1.sb);
749 Console.WriteLine("\t{0}.l = {1}", name, str1.l);
750 Console.WriteLine("\t{0}.ul = {1}", name, str1.ul);
751 Console.WriteLine("\t{0}.f = {1}", name, str1.f);
752 Console.WriteLine("\t{0}.d = {1}", name, str1.d);
754 public static bool ValidateU(U str1, U str2, string methodName)
756 if (str1.i32 != str2.i32 || str1.ui32 != str2.ui32 || str1.iPtr != str2.iPtr ||
757 str1.uiPtr != str2.uiPtr || str1.s != str2.s || str1.us != str2.us ||
758 str1.b != str2.b || str1.sb != str2.sb || str1.l != str2.l || str1.ul != str2.ul ||
759 str1.f != str2.f || str1.d != str2.d)
761 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
762 Console.WriteLine("\tThe Actual is...");
763 PrintU(str1, str1.ToString());
764 Console.WriteLine("\tThe Expected is...");
765 PrintU(str2, str2.ToString());
768 Console.WriteLine("\tPASSED!");
773 #region methods for ByteStructPack2Explicit struct
774 public static ByteStructPack2Explicit NewByteStructPack2Explicit(byte b1, byte b2)
776 ByteStructPack2Explicit u1 = new ByteStructPack2Explicit();
782 public static void PrintByteStructPack2Explicit(ByteStructPack2Explicit str1, string name)
784 Console.WriteLine("\t{0}.b1 = {1}", name, str1.b1);
785 Console.WriteLine("\t{0}.b2 = {1}", name, str1.b2);
787 public static bool ValidateByteStructPack2Explicit(ByteStructPack2Explicit str1, ByteStructPack2Explicit str2, string methodName)
789 if (str1.b1 != str2.b1 || str1.b2 != str2.b2)
791 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
792 Console.WriteLine("\tThe Actual is...");
793 PrintByteStructPack2Explicit(str1, str1.ToString());
794 Console.WriteLine("\tThe Expected is...");
795 PrintByteStructPack2Explicit(str2, str2.ToString());
800 Console.WriteLine("\tPASSED!");
806 #region methods for ShortStructPack4Explicit struct
807 public static ShortStructPack4Explicit NewShortStructPack4Explicit(short s1, short s2)
809 ShortStructPack4Explicit u2 = new ShortStructPack4Explicit();
815 public static void PrintShortStructPack4Explicit(ShortStructPack4Explicit str1, string name)
817 Console.WriteLine("\t{0}.s1 = {1}", name, str1.s1);
818 Console.WriteLine("\t{0}.s2 = {1}", name, str1.s2);
820 public static bool ValidateShortStructPack4Explicit(ShortStructPack4Explicit str1, ShortStructPack4Explicit str2, string methodName)
822 if (str1.s1 != str2.s1 || str1.s2 != str2.s2)
824 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
825 Console.WriteLine("\tThe Actual is...");
826 PrintShortStructPack4Explicit(str1, str1.ToString());
827 Console.WriteLine("\tThe Expected is...");
828 PrintShortStructPack4Explicit(str2, str2.ToString());
833 Console.WriteLine("\tPASSED!");
839 #region methods for IntStructPack8Explicit struct
840 public static IntStructPack8Explicit NewIntStructPack8Explicit(int i1, int i2)
842 IntStructPack8Explicit u3 = new IntStructPack8Explicit();
848 public static void PrintIntStructPack8Explicit(IntStructPack8Explicit str1, string name)
850 Console.WriteLine("\t{0}.i1 = {1}", name, str1.i1);
851 Console.WriteLine("\t{0}.i2 = {1}", name, str1.i2);
853 public static bool ValidateIntStructPack8Explicit(IntStructPack8Explicit str1, IntStructPack8Explicit str2, string methodName)
855 if (str1.i1 != str2.i1 || str1.i2 != str2.i2)
857 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
858 Console.WriteLine("\tThe Actual is...");
859 PrintIntStructPack8Explicit(str1, str1.ToString());
860 Console.WriteLine("\tThe Expected is...");
861 PrintIntStructPack8Explicit(str2, str2.ToString());
866 Console.WriteLine("\tPASSED!");
872 #region methods for LongStructPack16Explicit struct
873 public static LongStructPack16Explicit NewLongStructPack16Explicit(long l1, long l2)
875 LongStructPack16Explicit u4 = new LongStructPack16Explicit();
881 public static void PrintLongStructPack16Explicit(LongStructPack16Explicit str1, string name)
883 Console.WriteLine("\t{0}.l1 = {1}", name, str1.l1);
884 Console.WriteLine("\t{0}.l2 = {1}", name, str1.l2);
886 public static bool ValidateLongStructPack16Explicit(LongStructPack16Explicit str1, LongStructPack16Explicit str2, string methodName)
888 if (str1.l1 != str2.l1 || str1.l2 != str2.l2)
890 Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
891 Console.WriteLine("\tThe Actual is...");
892 PrintLongStructPack16Explicit(str1, str1.ToString());
893 Console.WriteLine("\tThe Expected is...");
894 PrintLongStructPack16Explicit(str2, str2.ToString());
899 Console.WriteLine("\tPASSED!");