This repository was archived by the owner on Dec 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnitTestCSharp.cs
More file actions
1379 lines (1290 loc) · 76 KB
/
UnitTestCSharp.cs
File metadata and controls
1379 lines (1290 loc) · 76 KB
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// List of API support
// List of EXTs API support for all modes
//#define EXT_IUTIL
//#define EXT_ICOMMAND
//#define EXT_ICINIFILE
//#define EXT_ITIMER
//#define EXT_HKTIMER
// List of EXTs API support for mp mode only
//#define EXT_IHALOENGINE
//#define EXT_IOBJECT // Require EXT_IUTIL
//#define EXT_IPLAYER // Require EXT_IOBJECT; if define EXT_IADMIN, EXT_IPLAYER test will not process
//#define EXT_IADMIN // Require EXT_IUTIL
// Not included in this UnitTest.
//#define EXT_IDATABASE
//#define EXT_IDATABASESTATEMENT
//#define EXT_HKDATABASE
//Future API support
//#define EXT_INETWORK // Will require mp mode test and possible client?
//#define EXT_ISOUND // Require client side test only.
//#define EXT_IDIRECTX9 // Require client side test only
//#define EXT_HKEXTERNAL // TBD
#if DO_NOT_INCLUDE_THIS
addon_info EXTPluginInfo = { "UnitTest C Sharp", "1.0.0.0",
"DZS|All-In-One, founder of DZS",
"Used for verifying each API are working right in C# language under C99 standard.",
"UnitTest",
"unit_test",
"test_unit",
"unit test",
"[unit]test",
"test[unit]"};
#endif
/*
* Verification list as of 0.5.3.4
*
* EXT_IHALOENGINE - Passed (except a few functions are not included in test.)
* EXT_IOBJECT - Passed (except a few functions are not included in test.)
* EXT_IPLAYER - Passed (except a few functions are not included in test.)
* EXT_IADMIN - Passed
* EXT_ICOMMAND - Passed
* EXT_IDATABASE - Not included in this UnitTest.
* EXT_IDATABASESTATEMENT - Not included in this UnitTest.
* EXT_HKDATABASE - Not included in this UnitTest.
* EXT_ICINIFILE - Passed
* EXT_ITIMER - Passed (Expect imbalance tick synchronize for 1/30 ticks per second after first load time.)
* EXT_HKTIMER - Passed
* EXT_IUTIL - Passed (except a few functions are not included in test.)
* Future API support
* EXT_INETWORK
* EXT_ISOUND
* EXT_IDIRECTX9
* EXT_HKEXTERNAL
*/
/*
* This link is for effective usage in unmanaged code (not for C# code) to load managed dll.
* http://stackoverflow.com/questions/773476/how-to-split-dot-net-hosting-function-when-calling-via-c-dll
*/
using System;
using System.Text;
using System.Windows.Forms;
using RGiesecke.DllExport;
using System.Runtime.InteropServices;
namespace UnitTestCSharp {
public class Addon {
public static uint hash;
#if EXT_IUTIL
//boolean test section
public static string trueStr = "true";
public static string TRUEStr = "TRUE";
public static string trUeStr = "trUe";
public static string trueNumStr = "1";
public static string falseStr = "false";
public static string FALSEStr = "FALSE";
public static string faLseStr = "faLse";
public static string falseNumStr = "0";
//team test section
public static string blueStr = "blue";
public static string BLUEStr = "BLUE";
public static string btStr = "bt";
public static string redStr = "red";
public static string REDStr = "RED";
public static string rtStr = "rt";
//detect string test section
public static string lettersStr = "lEtteRs";
public static string letters2Str = "LeTterS";
public static string numbersStr = "12348765";
public static string numbers2Str = "87651234";
public static string floatStr = "1234.8765";
public static string doubleStr = "1.2348765";
public static string hashStr = "87a651234";
public static string hash2Str = "876512z34";
public static string MatterStr = "Matter";
public static string MattarStr = "Mattar";
public static string MattarReplaceBeforeStr = "MattarTest 'Foobar'";
public static string MatterReplaceBeforeStr = "MatterTest 'Foobar'";
//directory and file test section
public static string dirExtension = "extension";
public static string fileHExt = "H-Ext.dll";
public static string dirExtesion = "extesion";
public static string fileHEt = "H-Et.dll";
public static StringBuilder replaceTestStr = new StringBuilder("Test 'Foobar'");
public static string replaceBeforeStr = "Test 'Foobar'";
public static string replaceAfterStr = "Test ''Foobar''";
//regex test section
public static StringBuilder regexTestNoDB = new StringBuilder("? *? {test} )(string]here[there", 40);
public static string regexTestNoDBAfter = ". .*. \\{test\\} \\)\\(string\\]here\\[there";
public static StringBuilder regexTestDB = new StringBuilder("? *? {test} )(string]here[there", 40);
public static string regexTestDBAfter = "_ %_ \\{test\\} \\)\\(string\\]here\\[there";
public static string wildcard = ".*";
public static string wildcardEndTest = ".*Test";
public static string wildcardBeginUnit = "Unit .*";
public static string dotdotdot = "...";
public static string hi_ = "Hi!";
public static string Unit_Test = "Unit Test";
public static string unit_test = "unit test";
//variant test section - CSharp only provide unicode input, absolutely no ansi support at all.
//public static string variantFormatExpected = "Aa 1.000000 2.000002 1 25 50 4294967295 2147483647 2147483647 4294967295 aA";
//public static string variantFormat = "{0:s} {2:f} {3:f} {4:hhd} {5:hd} {6:hu} {8:u} {7:d} {9:ld} {10:lu} {1:s}";
public static string variantFormatExpected = "1.000000 2.000002 1 25 50 4294967295 2147483647 2147483647 4294967295 aA";
public static string variantFormat = "{2:f} {3:f} {4:hhd} {5:hd} {6:hu} {8:u} {7:d} {9:ld} {10:lu} {1:s}";
#endif
#if EXT_ICOMMAND || EXT_ICINIFILE
public static Addon_API.addon_section_names sectors = new Addon_API.addon_section_names() {
sect_name1="unit_test",
sect_name2="test_unit",
sect_name3="unit test",
sect_name4="[unit]test",
sect_name5="test[unit]" };
#endif
#if EXT_ICINIFILE
public static string iniFileStr = "UnitTestC.ini";
public static string firstUnitTestCStr = "First Unit Test C";
public static string str1_0 = "1.0";
public static string str1_1 = "1.1";
public static string str1_2 = "1.2";
public static string str1_3 = "1.3";
public static string iniFileDataStr = " [unit_test]\r\n 1.0=First Unit Test C\r\n [test_unit]\r\n 1.1=First Unit Test C\r\n [unit test]";
#endif
//ICommand test section
#if EXT_ICOMMAND
public static string eaoTestExecuteStr = "eao_test_execute";
public static string eaoTestExecuteAliasStr = "testexec";
public static string eaoLoadFileStr = "unit_test.txt";
//This is needed in order to preserve function pointer address
public static Addon_API.CmdFunc eao_testExecutePtr;
public static Addon_API.CmdFunc eao_testExecuteOverridePtr;
public static Addon_API.CmdFunc eao_testExecuteOverride2Ptr;
public static Addon_API.CMD_RETURN eao_testExecute([In] Addon_API.PlayerInfo plI, [In, Out] ref Addon_API.ArgContainerVars arg, [In] Addon_API.MSG_PROTOCOL protocolMsg, [In] uint idTimer, [In, Out] boolOption showChat) {
return Addon_API.CMD_RETURN.SUCC;
}
public static Addon_API.CMD_RETURN eao_testExecuteOverride([In] Addon_API.PlayerInfo plI, [In, Out] ref Addon_API.ArgContainerVars arg, [In] Addon_API.MSG_PROTOCOL protocolMsg, [In] uint idTimer, [In, Out] boolOption showChat) {
return Addon_API.CMD_RETURN.SUCC;
}
public static Addon_API.CMD_RETURN eao_testExecuteOverride2([In] Addon_API.PlayerInfo plI, [In, Out] ref Addon_API.ArgContainerVars arg, [In] Addon_API.MSG_PROTOCOL protocolMsg, [In] uint idTimer, [In, Out] boolOption showChat) {
return Addon_API.CMD_RETURN.SUCC;
}
#endif
//IPlayer test section
#if EXT_IPLAYER
public static StringBuilder cdHashKeyA = new StringBuilder(0x60);
#endif
//IAdmin test section
#if EXT_IADMIN
public static string username = "unittest";
public static string usernamebad = "unittes";
public static string cmdEaoLoad = "ext_addon_load unittest";
public static string noKeyHere = "nokeyhere";
public static string localhost = "127.0.0.1";
#endif
//ITimer test section
#if EXT_ITIMER
public static Addon_API.ITimer pITimer;
public static uint[] TimerID = { 0, 0, 0, 0 };
public static uint TimerTickStart = 0;
public static uint[] TimerTickSys = { 0, 0, 0, 0 };
#endif
//IHaloEngine test section
#if EXT_IHALOENGINE
public static string rconTestStr = "Rcon Test";
public static string playerChatTest = "Player Chat Test";
public static string globalChatTest = "Global Chat Test";
public static string password = "unitest";
public static StringBuilder passwordWGet = new StringBuilder("deadbeef", 8);
public static StringBuilder passwordAGet = new StringBuilder("deadbeef", 8);
#endif
[DllExport("EXTOnEAOLoad", CallingConvention = CallingConvention.Cdecl)]
public static Addon_API.EAO_RETURN EXTOnEAOLoad(uint uniqueHash) {
hash = uniqueHash;
uint retCode;
IntPtr testPtr = IntPtr.Zero;
Addon_API.PlayerInfo plI = new Addon_API.PlayerInfo(), plIKeep = new Addon_API.PlayerInfo(), plINull = new Addon_API.PlayerInfo();
#region IUtil test section
#if EXT_IUTIL
Addon_API.IUtil pIUtil = Addon_API.Interface.getIUtil(hash);
try {
if (pIUtil.isNotNull()) {
Addon_API.Global.pIUtil = pIUtil;
//m_allocMem & m_freeMem functions are not needed here.
StringBuilder testBStrW = new StringBuilder(0x30);
StringBuilder testBStrA = new StringBuilder(0x30);
string testStr1 = "Test String";
StringBuilder matterStr = new StringBuilder("Matter");
if (pIUtil.m_strcatW(testBStrW, (uint)testBStrW.Capacity, testStr1) != 11)
throw new ArgumentException();
if (!pIUtil.m_strcmpW(testBStrW.ToString(), testStr1))
throw new ArgumentException();
if (pIUtil.m_strcatA(testBStrA, (uint)testBStrA.Capacity, testStr1) != 11)
throw new ArgumentException();
if (!pIUtil.m_strcmpA(testBStrA.ToString(), testStr1))
throw new ArgumentException();
#region boolean values
if (pIUtil.m_strToBooleanW(testBStrW.ToString()) != Addon_API.e_boolean.FAIL)
throw new ArgumentException();
if (pIUtil.m_strToBooleanA(testBStrA.ToString()) != Addon_API.e_boolean.FAIL)
throw new ArgumentException();
if (pIUtil.m_strToBooleanW(trueStr) != Addon_API.e_boolean.TRUE)
throw new ArgumentException();
if (pIUtil.m_strToBooleanW(TRUEStr) != Addon_API.e_boolean.TRUE)
throw new ArgumentException();
if (pIUtil.m_strToBooleanW(trUeStr) != Addon_API.e_boolean.TRUE)
throw new ArgumentException();
if (pIUtil.m_strToBooleanW(trueNumStr) != Addon_API.e_boolean.TRUE)
throw new ArgumentException();
if (pIUtil.m_strToBooleanW(falseStr) != Addon_API.e_boolean.FALSE)
throw new ArgumentException();
if (pIUtil.m_strToBooleanW(FALSEStr) != Addon_API.e_boolean.FALSE)
throw new ArgumentException();
if (pIUtil.m_strToBooleanW(faLseStr) != Addon_API.e_boolean.FALSE)
throw new ArgumentException();
if (pIUtil.m_strToBooleanW(falseNumStr) != Addon_API.e_boolean.FALSE)
throw new ArgumentException();
if (pIUtil.m_strToBooleanA(trueStr) != Addon_API.e_boolean.TRUE)
throw new ArgumentException();
if (pIUtil.m_strToBooleanA(TRUEStr) != Addon_API.e_boolean.TRUE)
throw new ArgumentException();
if (pIUtil.m_strToBooleanA(trUeStr) != Addon_API.e_boolean.TRUE)
throw new ArgumentException();
if (pIUtil.m_strToBooleanA(trueNumStr) != Addon_API.e_boolean.TRUE)
throw new ArgumentException();
if (pIUtil.m_strToBooleanA(falseStr) != Addon_API.e_boolean.FALSE)
throw new ArgumentException();
if (pIUtil.m_strToBooleanA(FALSEStr) != Addon_API.e_boolean.FALSE)
throw new ArgumentException();
if (pIUtil.m_strToBooleanA(faLseStr) != Addon_API.e_boolean.FALSE)
throw new ArgumentException();
if (pIUtil.m_strToBooleanA(falseNumStr) != Addon_API.e_boolean.FALSE)
throw new ArgumentException();
#endregion
#region team values
if (pIUtil.m_strToTeamW(testBStrW.ToString()) != e_color_team_index.TEAM_NONE)
throw new ArgumentException();
if (pIUtil.m_strToTeamA(testBStrA.ToString()) != e_color_team_index.TEAM_NONE)
throw new ArgumentException();
if (pIUtil.m_strToTeamW(blueStr) != e_color_team_index.TEAM_BLUE)
throw new ArgumentException();
if (pIUtil.m_strToTeamW(BLUEStr) != e_color_team_index.TEAM_BLUE)
throw new ArgumentException();
if (pIUtil.m_strToTeamW(btStr) != e_color_team_index.TEAM_BLUE)
throw new ArgumentException();
if (pIUtil.m_strToTeamW(redStr) != e_color_team_index.TEAM_RED)
throw new ArgumentException();
if (pIUtil.m_strToTeamW(REDStr) != e_color_team_index.TEAM_RED)
throw new ArgumentException();
if (pIUtil.m_strToTeamW(rtStr) != e_color_team_index.TEAM_RED)
throw new ArgumentException();
if (pIUtil.m_strToTeamA(blueStr) != e_color_team_index.TEAM_BLUE)
throw new ArgumentException();
if (pIUtil.m_strToTeamA(BLUEStr) != e_color_team_index.TEAM_BLUE)
throw new ArgumentException();
if (pIUtil.m_strToTeamA(btStr) != e_color_team_index.TEAM_BLUE)
throw new ArgumentException();
if (pIUtil.m_strToTeamA(redStr) != e_color_team_index.TEAM_RED)
throw new ArgumentException();
if (pIUtil.m_strToTeamA(REDStr) != e_color_team_index.TEAM_RED)
throw new ArgumentException();
if (pIUtil.m_strToTeamA(rtStr) != e_color_team_index.TEAM_RED)
throw new ArgumentException();
#endregion
#region Strings values verification
testBStrA.Remove(0, testBStrA.Length);
pIUtil.m_toCharA(testBStrW.ToString(), testBStrW.Length + 1, testBStrA);
if (!pIUtil.m_strcmpA(testStr1, testBStrA.ToString()))
throw new ArgumentException();
pIUtil.m_toCharW(testBStrA.ToString(), testBStrA.Length + 1, testBStrW);
if (!pIUtil.m_strcmpW(testStr1, testBStrW.ToString()))
throw new ArgumentException();
testBStrA.Replace('t', 'T');
testBStrW.Replace('t', 'T');
if (!pIUtil.m_stricmpA(testStr1, testBStrA.ToString()))
throw new ArgumentException();
testBStrW.Remove(0, testBStrW.Length);
pIUtil.m_toCharW(testBStrA.ToString(), testBStrA.Length + 1, testBStrW);
if (!pIUtil.m_stricmpW(testStr1, testBStrW.ToString()))
throw new ArgumentException();
testBStrA.Replace('T', 't');
testBStrW.Replace('T', 't');
if (!pIUtil.m_stricmpW(lettersStr, letters2Str))
throw new ArgumentException();
if (!pIUtil.m_stricmpA(lettersStr, letters2Str))
throw new ArgumentException();
if (pIUtil.m_strcmpW(lettersStr, letters2Str))
throw new ArgumentException();
if (pIUtil.m_strcmpA(lettersStr, letters2Str))
throw new ArgumentException();
if (pIUtil.m_stricmpW(numbersStr, numbers2Str))
throw new ArgumentException();
if (pIUtil.m_stricmpA(numbersStr, numbers2Str))
throw new ArgumentException();
if (pIUtil.m_strcmpW(numbersStr, numbers2Str))
throw new ArgumentException();
if (pIUtil.m_strcmpA(numbersStr, numbers2Str))
throw new ArgumentException();
Addon_API.e_boolean boolean = pIUtil.m_shiftStrW(matterStr, 1, 3, 1, false);
if (boolean != Addon_API.e_boolean.TRUE)
throw new ArgumentException();
if (!pIUtil.m_findSubStrFirstW(matterStr.ToString(), MatterStr))
throw new ArgumentException();
if (pIUtil.m_findSubStrFirstW(matterStr.ToString(), MattarStr))
throw new ArgumentException();
boolean = pIUtil.m_shiftStrW(matterStr, 1, 1, 3, true);
if (boolean != Addon_API.e_boolean.TRUE)
throw new ArgumentException();
if (!pIUtil.m_findSubStrFirstW(matterStr.ToString(), MattarStr))
throw new ArgumentException();
if (pIUtil.m_findSubStrFirstW(matterStr.ToString(), MatterStr))
throw new ArgumentException();
//No reason to have 2 matter string since ANSII and Unicode are done by C# itself.
matterStr.Remove(0, matterStr.Length);
matterStr.Insert(0, MatterStr);
boolean = pIUtil.m_shiftStrA(matterStr, 1, 3, 1, false);
if (boolean != Addon_API.e_boolean.TRUE)
throw new ArgumentException();
if (!pIUtil.m_findSubStrFirstA(matterStr.ToString(), MatterStr))
throw new ArgumentException();
if (pIUtil.m_findSubStrFirstA(matterStr.ToString(), MattarStr))
throw new ArgumentException();
boolean = pIUtil.m_shiftStrA(matterStr, 1, 1, 3, true);
if (boolean != Addon_API.e_boolean.TRUE)
throw new ArgumentException();
if (!pIUtil.m_findSubStrFirstA(matterStr.ToString(), MattarStr))
throw new ArgumentException();
if (pIUtil.m_findSubStrFirstA(matterStr.ToString(), MatterStr))
throw new ArgumentException();
testBStrW.Remove(0, testBStrW.Length);
testBStrA.Remove(0, testBStrA.Length);
retCode = pIUtil.m_strcatW(testBStrW, 48, MattarStr);
if (retCode != 6)
throw new ArgumentException();
retCode = pIUtil.m_strcatA(testBStrA, 48, MatterStr);
if (retCode != 6)
throw new ArgumentException();
if (!pIUtil.m_strcmpW(testBStrW.ToString(), MattarStr))
throw new ArgumentException();
if (!pIUtil.m_strcmpA(testBStrA.ToString(), MatterStr))
throw new ArgumentException();
retCode = pIUtil.m_strcatW(testBStrW, 48, replaceBeforeStr);
if (retCode != 13)
throw new ArgumentException();
retCode = pIUtil.m_strcatA(testBStrA, 48, replaceBeforeStr);
if (retCode != 13)
throw new ArgumentException();
if (!pIUtil.m_strcmpW(testBStrW.ToString(), MattarReplaceBeforeStr))
throw new ArgumentException();
if (!pIUtil.m_strcmpA(testBStrA.ToString(), MatterReplaceBeforeStr))
throw new ArgumentException();
#endregion
#region isLetters, isFloat, isDouble, isNumbers, and isHash
if (!pIUtil.m_isLettersW(lettersStr))
throw new ArgumentException();
if (pIUtil.m_isLettersW(hashStr))
throw new ArgumentException();
if (!pIUtil.m_isLettersA(letters2Str))
throw new ArgumentException();
if (pIUtil.m_isLettersA(hash2Str))
throw new ArgumentException();
if (!pIUtil.m_isNumberW(numbersStr))
throw new ArgumentException();
if (pIUtil.m_isNumberW(hashStr))
throw new ArgumentException();
if (pIUtil.m_isNumberW(floatStr))
throw new ArgumentException();
if (!pIUtil.m_isNumberA(numbers2Str))
throw new ArgumentException();
if (pIUtil.m_isNumberW(hash2Str))
throw new ArgumentException();
if (pIUtil.m_isNumberW(floatStr))
throw new ArgumentException();
if (!pIUtil.m_isDoubleW(doubleStr))
throw new ArgumentException();
if (!pIUtil.m_isDoubleW(numbersStr))
throw new ArgumentException();
if (pIUtil.m_isDoubleW(hashStr))
throw new ArgumentException();
if (!pIUtil.m_isDoubleW(floatStr))
throw new ArgumentException();
if (!pIUtil.m_isDoubleA(doubleStr))
throw new ArgumentException();
if (!pIUtil.m_isDoubleA(numbers2Str))
throw new ArgumentException();
if (pIUtil.m_isDoubleA(hash2Str))
throw new ArgumentException();
if (!pIUtil.m_isDoubleA(floatStr))
throw new ArgumentException();
if (!pIUtil.m_isFloatW(floatStr))
throw new ArgumentException();
if (pIUtil.m_isFloatW(doubleStr))
throw new ArgumentException();
if (!pIUtil.m_isFloatW(numbersStr))
throw new ArgumentException();
if (pIUtil.m_isFloatW(hashStr))
throw new ArgumentException();
if (!pIUtil.m_isFloatA(floatStr))
throw new ArgumentException();
if (pIUtil.m_isFloatA(doubleStr))
throw new ArgumentException();
if (!pIUtil.m_isFloatA(numbers2Str))
throw new ArgumentException();
if (pIUtil.m_isFloatA(hash2Str))
throw new ArgumentException();
if (!pIUtil.m_isHashW(hashStr))
throw new ArgumentException();
if (pIUtil.m_isHashW(floatStr))
throw new ArgumentException();
if (!pIUtil.m_isHashA(hash2Str))
throw new ArgumentException();
if (pIUtil.m_isHashA(floatStr))
throw new ArgumentException();
#endregion
#region file & directory check
if (!pIUtil.m_isDirExist(dirExtension, ref retCode))
throw new ArgumentException();
if (retCode>0)
throw new ArgumentException();
if (pIUtil.m_isDirExist(dirExtesion, ref retCode))
throw new ArgumentException();
if (retCode==0)
throw new ArgumentException();
if (pIUtil.m_isDirExist(fileHExt, ref retCode))
throw new ArgumentException();
if (retCode == 0)
throw new ArgumentException();
if (!pIUtil.m_isFileExist(fileHExt, ref retCode))
throw new ArgumentException();
if (retCode>0)
throw new ArgumentException();
if (pIUtil.m_isFileExist(fileHEt, ref retCode))
throw new ArgumentException();
if (retCode == 0)
throw new ArgumentException();
if (pIUtil.m_isFileExist(dirExtension, ref retCode))
throw new ArgumentException();
if (retCode == 0)
throw new ArgumentException();
#endregion
#region Replace & undo relative + database regex replace.
pIUtil.m_replaceW(replaceTestStr);
if (!pIUtil.m_strcmpW(replaceTestStr.ToString(), replaceAfterStr))
throw new ArgumentException();
pIUtil.m_replaceUndoW(replaceTestStr);
if (!pIUtil.m_strcmpW(replaceTestStr.ToString(), replaceBeforeStr))
throw new ArgumentException();
pIUtil.m_replaceA(replaceTestStr);
if (!pIUtil.m_strcmpA(replaceTestStr.ToString(), replaceAfterStr))
throw new ArgumentException();
pIUtil.m_replaceUndoA(replaceTestStr);
if (!pIUtil.m_strcmpA(replaceTestStr.ToString(), replaceBeforeStr))
throw new ArgumentException();
pIUtil.m_regexReplaceW(regexTestNoDB, false);
if (!pIUtil.m_strcmpW(regexTestNoDB.ToString(), regexTestNoDBAfter))
throw new ArgumentException();
pIUtil.m_regexReplaceW(regexTestDB, true);
if (!pIUtil.m_strcmpW(regexTestDB.ToString(), regexTestDBAfter))
throw new ArgumentException();
//regex test
if (!pIUtil.m_regexMatchW(Unit_Test, wildcard))
throw new ArgumentException();
if (!pIUtil.m_regexMatchW(Unit_Test, wildcardBeginUnit))
throw new ArgumentException();
if (!pIUtil.m_regexMatchW(Unit_Test, wildcardEndTest))
throw new ArgumentException();
if (!pIUtil.m_regexMatchW(unit_test, wildcard))
throw new ArgumentException();
if (pIUtil.m_regexMatchW(unit_test, wildcardBeginUnit))
throw new ArgumentException();
if (pIUtil.m_regexMatchW(unit_test, wildcardEndTest))
throw new ArgumentException();
if (pIUtil.m_regexMatchW(unit_test, dotdotdot))
throw new ArgumentException();
if (!pIUtil.m_regexMatchW(hi_, dotdotdot))
throw new ArgumentException();
if (!pIUtil.m_regexiMatchW(hi_, dotdotdot))
throw new ArgumentException();
if (!pIUtil.m_regexiMatchW(Unit_Test, wildcard))
throw new ArgumentException();
if (!pIUtil.m_regexiMatchW(Unit_Test, wildcardBeginUnit))
throw new ArgumentException();
if (!pIUtil.m_regexiMatchW(Unit_Test, wildcardEndTest))
throw new ArgumentException();
if (!pIUtil.m_regexiMatchW(unit_test, wildcard))
throw new ArgumentException();
if (!pIUtil.m_regexiMatchW(unit_test, wildcardBeginUnit))
throw new ArgumentException();
if (!pIUtil.m_regexiMatchW(unit_test, wildcardEndTest))
throw new ArgumentException();
if (pIUtil.m_regexiMatchW(unit_test, dotdotdot))
throw new ArgumentException();
#endregion
#region formatVar___ functions
object[] testVariant = new object[11];
StringBuilder outputString = new StringBuilder(0x512);
//TODO: Unable to force ansi string into object as it does not have support for it.
//testVariant[0] = new BStrWrapper("Aa"); //Nope, it's set to auto. It actually return unicode / System.Runtime.InteropServices.BStrWrapper
//testVariant[0] = Encoding.Default.GetString(Encoding.Default.GetBytes("Aa")); //Nope, still is unicode.
testVariant[1] = "aA";
testVariant[2] = (float)1.000f;
testVariant[3] = (double)2.000002;
testVariant[4] = (bool)true;
testVariant[5] = (short)25;
testVariant[6] = (ushort)50;
testVariant[7] = Int32.MaxValue; //MAXINT
testVariant[8] = UInt32.MaxValue; //MAXUINT
testVariant[9] = (long)0x7fffffff; //MAXLONG
testVariant[10] = (ulong)((uint)~((uint)0)); //MAXULONG
if (!pIUtil.m_formatVariantW(outputString, (uint)outputString.Capacity, variantFormat, 11, testVariant))
throw new ArgumentException();
if (!pIUtil.m_strcmpW(variantFormatExpected, outputString.ToString()))
throw new ArgumentException();
#endregion
MessageBox.Show("IUtil API has passed unit test.", "PASSED - IUtil", MessageBoxButtons.OK, MessageBoxIcon.Information);
} else
throw new ArgumentException();
} catch(ArgumentException) {
MessageBox.Show("IUtil API has failed unit test.", "ERROR - IUtil", MessageBoxButtons.OK, MessageBoxIcon.Error);
return Addon_API.EAO_RETURN.FAIL;
}
#endif
#endregion
#region ICIniFile test section
#if EXT_ICINIFILE
Addon_API.ICIniFileClass pICIniFile = Addon_API.Interface.getICIniFile(hash);
try {
if (pICIniFile.isNotNull()) {
if (pICIniFile.m_open_file(iniFileStr)) {
if (!pICIniFile.m_delete_file(iniFileStr))
throw new ArgumentException();
if (pICIniFile.m_open_file(iniFileStr))
throw new ArgumentException();
}
if (!pICIniFile.m_create_file(iniFileStr))
throw new ArgumentException();
if (!pICIniFile.m_open_file(iniFileStr))
throw new ArgumentException();
retCode = 0;
recheckICIniFileDataExists:
if (pICIniFile.m_section_exist(sectors.sect_name1))
throw new ArgumentException();
if (pICIniFile.m_section_exist(sectors.sect_name2))
throw new ArgumentException();
if (pICIniFile.m_section_exist(sectors.sect_name3))
throw new ArgumentException();
if (pICIniFile.m_section_exist(sectors.sect_name4))
throw new ArgumentException();
if (pICIniFile.m_section_exist(sectors.sect_name5))
throw new ArgumentException();
if (pICIniFile.m_key_exist(sectors.sect_name1, str1_0))
throw new ArgumentException();
if (pICIniFile.m_key_exist(sectors.sect_name2, str1_1))
throw new ArgumentException();
if (pICIniFile.m_key_exist(sectors.sect_name3, str1_0))
throw new ArgumentException();
if (pICIniFile.m_key_exist(sectors.sect_name4, str1_2))
throw new ArgumentException();
if (pICIniFile.m_key_exist(sectors.sect_name5, str1_3))
throw new ArgumentException();
if (!pICIniFile.m_value_set(sectors.sect_name1, str1_0, firstUnitTestCStr))
throw new ArgumentException();
if (!pICIniFile.m_value_set(sectors.sect_name2, str1_1, firstUnitTestCStr))
throw new ArgumentException();
if (!pICIniFile.m_value_set(sectors.sect_name3, str1_0, firstUnitTestCStr))
throw new ArgumentException();
if (pICIniFile.m_value_set(sectors.sect_name4, str1_2, firstUnitTestCStr))
throw new ArgumentException();
if (pICIniFile.m_value_set(sectors.sect_name5, str1_3, firstUnitTestCStr))
throw new ArgumentException();
retCode++;
switch(retCode) {
case 1: {
if (!pICIniFile.m_load())
throw new ArgumentException();
goto recheckICIniFileDataExists;
}
case 2: {
pICIniFile.m_clear();
if (!pICIniFile.m_save())
throw new ArgumentException();
if (!pICIniFile.m_load())
throw new ArgumentException();
goto recheckICIniFileDataExists;
}
default: break;
}
if (!pICIniFile.m_save())
throw new ArgumentException();
if (!pICIniFile.m_load())
throw new ArgumentException();
if (!pICIniFile.m_section_exist(sectors.sect_name1))
throw new ArgumentException();
if (!pICIniFile.m_section_exist(sectors.sect_name2))
throw new ArgumentException();
if (!pICIniFile.m_section_exist(sectors.sect_name3))
throw new ArgumentException();
if (pICIniFile.m_section_exist(sectors.sect_name4))
throw new ArgumentException();
if (pICIniFile.m_section_exist(sectors.sect_name5))
throw new ArgumentException();
if (!pICIniFile.m_section_delete(sectors.sect_name3))
throw new ArgumentException();
if (pICIniFile.m_section_exist(sectors.sect_name3))
throw new ArgumentException();
if (!pICIniFile.m_section_add(sectors.sect_name3))
throw new ArgumentException();
if (!pICIniFile.m_section_exist(sectors.sect_name3))
throw new ArgumentException();
if (!pICIniFile.m_key_exist(sectors.sect_name1, str1_0))
throw new ArgumentException();
if (!pICIniFile.m_key_exist(sectors.sect_name2, str1_1))
throw new ArgumentException();
if (pICIniFile.m_key_exist(sectors.sect_name3, str1_0))
throw new ArgumentException();
if (pICIniFile.m_key_exist(sectors.sect_name4, str1_2))
throw new ArgumentException();
if (pICIniFile.m_key_exist(sectors.sect_name5, str1_3))
throw new ArgumentException();
if (!pICIniFile.m_value_set(sectors.sect_name1, str1_0, firstUnitTestCStr))
throw new ArgumentException();
if (!pICIniFile.m_key_exist(sectors.sect_name1, str1_0))
throw new ArgumentException();
if (!pICIniFile.m_save())
throw new ArgumentException();
if (!pICIniFile.m_key_delete(sectors.sect_name1, str1_0))
throw new ArgumentException();
if (pICIniFile.m_key_exist(sectors.sect_name1, str1_0))
throw new ArgumentException();
if (!pICIniFile.m_load())
throw new ArgumentException();
if (!pICIniFile.m_key_exist(sectors.sect_name1, str1_0))
throw new ArgumentException();
retCode = 1;
string contentStr = null;
if (!pICIniFile.m_content(ref contentStr, ref retCode))
throw new ArgumentException();
if (!(contentStr != null && retCode != 0))
throw new ArgumentException();
if (iniFileDataStr.Length != retCode) //Does not required -1 after Length
throw new ArgumentException();
//retCode++; //Is not required.
if (!compareString(contentStr, iniFileDataStr, retCode))
throw new ArgumentException();
// Begin 0.5.3.4 Feature
StringBuilder section_name = new StringBuilder(Addon_API.ICIniFileClass.INIFILESECTIONMAX);
StringBuilder key_name = new StringBuilder(Addon_API.ICIniFileClass.INIFILEKEYMAX);
StringBuilder value_name = new StringBuilder(Addon_API.ICIniFileClass.INIFILEVALUEMAX);
uint ini_sec_count = pICIniFile.m_section_count();
if (ini_sec_count != 3)
throw new ArgumentException();
uint ini_key_count;
// Section 0 test
if (!pICIniFile.m_section_index(0, section_name))
throw new ArgumentException();
if (!compareString(sectors.sect_name1, section_name.ToString(), uint.MaxValue))
throw new ArgumentException();
ini_key_count = pICIniFile.m_key_count(section_name.ToString());
if (ini_key_count != 1)
throw new ArgumentException();
// Section 0 key 0 test
if (!pICIniFile.m_key_index(section_name.ToString(), 0, key_name, value_name))
throw new ArgumentException();
if (!compareString(str1_0, key_name.ToString(), uint.MaxValue))
throw new ArgumentException();
if (!compareString(firstUnitTestCStr, value_name.ToString(), uint.MaxValue))
throw new ArgumentException();
// Section 1 test
if (!pICIniFile.m_section_index(1, section_name))
throw new ArgumentException();
if (!compareString(sectors.sect_name2, section_name.ToString(), uint.MaxValue))
throw new ArgumentException();
ini_key_count = pICIniFile.m_key_count(section_name.ToString());
if (ini_key_count != 1)
throw new ArgumentException();
// Section 1 key 0 test
if (!pICIniFile.m_key_index(section_name.ToString(), 0, key_name, value_name))
throw new ArgumentException();
if (!compareString(str1_1, key_name.ToString(), uint.MaxValue))
throw new ArgumentException();
if (!compareString(firstUnitTestCStr, value_name.ToString(), uint.MaxValue))
throw new ArgumentException();
// Section 2 test
if (!pICIniFile.m_section_index(2, section_name))
throw new ArgumentException();
if (!compareString(sectors.sect_name3, section_name.ToString(), uint.MaxValue))
throw new ArgumentException();
ini_key_count = pICIniFile.m_key_count(section_name.ToString());
if (ini_key_count != 0)
throw new ArgumentException();
// End 0.5.3.4 Feature
if (!pICIniFile.m_delete_file(iniFileStr))
throw new ArgumentException();
pICIniFile.m_release();
MessageBox.Show("ICIniFile API has passed unit test.", "PASSED - ICIniFile", MessageBoxButtons.OK, MessageBoxIcon.Information);
} else
throw new ArgumentException();
} catch (ArgumentException) {
if (pICIniFile.isNotNull())
pICIniFile.m_release();
MessageBox.Show("ICIniFile API has failed unit test.", "ERROR - ICIniFile", MessageBoxButtons.OK, MessageBoxIcon.Error);
return Addon_API.EAO_RETURN.FAIL;
}
#endif
#endregion
#region ICommand test section
#if EXT_ICOMMAND
Addon_API.ICommand pICommand = Addon_API.Interface.getICommand(hash);
try {
if (pICommand.isNotNull()) {
//TODO: need to re-review this function internally.
if (pICommand.m_reload_level(hash))
throw new ArgumentException();
//This is needed in order to preserve function pointer address
eao_testExecutePtr = eao_testExecute;
GC.KeepAlive(eao_testExecutePtr);
eao_testExecuteOverridePtr = eao_testExecuteOverride;
GC.KeepAlive(eao_testExecuteOverridePtr);
eao_testExecuteOverride2Ptr = eao_testExecuteOverride2;
GC.KeepAlive(eao_testExecuteOverride2Ptr);
if (pICommand.m_delete(hash, eao_testExecutePtr, eaoTestExecuteStr))
throw new ArgumentException();
if (pICommand.m_alias_delete(eaoTestExecuteStr, eaoTestExecuteAliasStr))
throw new ArgumentException();
if (!pICommand.m_add(hash, eaoTestExecuteStr, eao_testExecutePtr, sectors.sect_name1, 1, 1, false, HEXT.modeAll))
throw new ArgumentException();
if (pICommand.m_add(hash, eaoTestExecuteStr, eao_testExecutePtr, sectors.sect_name1, 1, 1, false, HEXT.modeAll))
throw new ArgumentException();
if (!pICommand.m_delete(hash, eao_testExecutePtr, eaoTestExecuteStr))
throw new ArgumentException();
if (pICommand.m_delete(hash, eao_testExecutePtr, eaoTestExecuteStr))
throw new ArgumentException();
if (!pICommand.m_add(hash, eaoTestExecuteStr, eao_testExecutePtr, sectors.sect_name1, 1, 1, true, HEXT.modeAll))
throw new ArgumentException();
if (!pICommand.m_add(hash, eaoTestExecuteStr, eao_testExecuteOverridePtr, sectors.sect_name1, 1, 1, true, HEXT.modeAll))
throw new ArgumentException();
if (pICommand.m_add(hash, eaoTestExecuteStr, eao_testExecuteOverride2Ptr, sectors.sect_name1, 1, 1, true, HEXT.modeAll))
throw new ArgumentException();
if (!pICommand.m_alias_add(eaoTestExecuteStr, eaoTestExecuteAliasStr))
throw new ArgumentException();
if (pICommand.m_alias_add(eaoTestExecuteStr, eaoTestExecuteAliasStr))
throw new ArgumentException();
if (!pICommand.m_alias_delete(eaoTestExecuteStr, eaoTestExecuteAliasStr))
throw new ArgumentException();
if (pICommand.m_alias_delete(eaoTestExecuteStr, eaoTestExecuteAliasStr))
throw new ArgumentException();
if (!pICommand.m_alias_add(eaoTestExecuteStr, eaoTestExecuteAliasStr))
throw new ArgumentException();
if (!pICommand.m_reload_level(hash))
throw new ArgumentException();
if (!pICommand.m_load_from_file(hash, eaoLoadFileStr, plI, Addon_API.MSG_PROTOCOL.MP_RCON))
throw new ArgumentException();
// Proper remove command when done testing.
if (!pICommand.m_delete(hash, eao_testExecutePtr, eaoTestExecuteStr))
throw new ArgumentException();
MessageBox.Show("ICommand API has passed unit test.", "PASSED - ICommand", MessageBoxButtons.OK, MessageBoxIcon.Information);
} else
throw new ArgumentException();
} catch(ArgumentException) {
MessageBox.Show("ICommand API has failed unit test.", "ERROR - ICommand", MessageBoxButtons.OK, MessageBoxIcon.Error);
return Addon_API.EAO_RETURN.FAIL;
}
#endif
#endregion
#region IObject test section
#if EXT_IOBJECT
Addon_API.IObject pIObject = Addon_API.Interface.getIObject(hash);
try {
if (pIObject.isNotNull()) {
Addon_API.objTagGroupList gtag_list = new Addon_API.objTagGroupList();
if (!pIObject.m_get_lookup_group_tag_list(e_tag_group.TAG_WEAP, gtag_list))
throw new ArgumentException();
if (gtag_list.count == 0)
throw new ArgumentException();
Addon_API.hTagHeader_managed tag_header = gtag_list.list(0);
if (tag_header.isNull())
throw new ArgumentException();
if (tag_header.hTagHeader_n.group_tag != e_tag_group.TAG_WEAP)
throw new ArgumentException();
s_ident object_id = new s_ident(0);
s_ident parent_id = new s_ident();
Addon_API.objManaged move_object = new Addon_API.objManaged();
move_object.world.x = 1.0f;
move_object.world.y = 1.0f;
move_object.world.z = 1.0f;
if (!pIObject.m_create(tag_header.hTagHeader_n.ident, parent_id, 1000, ref object_id, ref move_object.world))
throw new ArgumentException();
s_object_managed created_object = pIObject.m_get_address(object_id);
if (created_object.getPtr().ptr == IntPtr.Zero)
throw new ArgumentException();
tag_header = pIObject.m_lookup_tag(created_object.s_object_n.ModelTag);
if (tag_header.isNull())
throw new ArgumentException();
if (created_object.s_object_n.World.x != 1.0f && created_object.s_object_n.World.y != 1.0f&& created_object.s_object_n.World.z != 1.0f)
throw new ArgumentException();
move_object.world.x = 2.0f;
move_object.world.y = 2.0f;
move_object.world.z = 2.0f;
pIObject.m_move(object_id, move_object);
created_object.refresh();
if (created_object.s_object_n.World.x != 2.0f && created_object.s_object_n.World.y != 2.0f&& created_object.s_object_n.World.z != 2.0f)
throw new ArgumentException();
move_object.world.x = 5.0f;
move_object.world.y = 5.0f;
move_object.world.z = 5.0f;
pIObject.m_move_and_reset(object_id, ref move_object.world);
created_object.refresh();
if (created_object.s_object_n.World.x != 5.0f && created_object.s_object_n.World.y != 5.0f&& created_object.s_object_n.World.z != 5.0f)
throw new ArgumentException();
pIObject.m_update(object_id);
if (!pIObject.m_destroy(object_id))
throw new ArgumentException();
MessageBox.Show("IObject API has passed unit test.", "PASSED - IObject", MessageBoxButtons.OK, MessageBoxIcon.Information);
} else
throw new ArgumentException();
} catch(ArgumentException) {
MessageBox.Show("IObject API has failed unit test.", "ERROR - IObject", MessageBoxButtons.OK, MessageBoxIcon.Error);
return Addon_API.EAO_RETURN.FAIL;
}
#endif
#endregion
#region IPlayer test section
#if EXT_IPLAYER && !EXT_IADMIN
Addon_API.IPlayer pIPlayer = Addon_API.Interface.getIPlayer(hash);
try {
if (pIPlayer.isNotNull()) {
StringBuilder testStr = new StringBuilder(64);
Addon_API.PlayerInfoList plList = new Addon_API.PlayerInfoList();
//Addon_API.PlayerInfo plINull = new Addon_API.PlayerInfo();
ushort totalPlayers = pIPlayer.m_get_str_to_player_list("*", ref plList, null);
if (totalPlayers == 0)
throw new ArgumentException();
Addon_API.PlayerInfo plITest = new Addon_API.PlayerInfo(), plITest2 = new Addon_API.PlayerInfo();
if (pIPlayer.m_get_m_index(2, ref plITest, true))
throw new ArgumentException();
if (pIPlayer.m_get_m_index(1, ref plITest, true))
throw new ArgumentException();
if (!pIPlayer.m_get_m_index(0, ref plITest, true))
throw new ArgumentException();
if (pIPlayer.m_get_id(200, ref plITest2))
throw new ArgumentException();
if (!pIPlayer.m_get_id((uint)plITest.plR.PlayerIndex, ref plITest2))
throw new ArgumentException();
if (!(plITest.cmS == plITest2.cmS && plITest.cplEx == plITest2.cplEx && plITest.cplS == plITest2.cplS && plITest.cplR == plITest2.cplR))
throw new ArgumentException();
s_biped_managed plBiped = pIObject.m_get_address(plITest.plS.CurrentBiped);
if (plBiped.getPtr().ptr == IntPtr.Zero)
throw new ArgumentException();
if (!pIPlayer.m_get_ident(plBiped.s_object_n.PlayerOwner, ref plITest2))
throw new ArgumentException();
if (pIPlayer.m_get_by_unique_id(600, ref plITest2))
throw new ArgumentException();
if (!pIPlayer.m_get_by_unique_id(plITest.mS.UniqueID, ref plITest2))
throw new ArgumentException();
if (!(plITest.cmS == plITest2.cmS && plITest.cplEx == plITest2.cplEx && plITest.cplS == plITest2.cplS && plITest.cplR == plITest2.cplR))
throw new ArgumentException();
retCode = pIPlayer.m_get_id_full_name(plITest.plR.PlayerName);
if (retCode == 0)
throw new ArgumentException();
if (!pIPlayer.m_get_full_name_id(retCode, testStr))
throw new ArgumentException();
if (testStr.ToString() != plITest.plR.PlayerName)
throw new ArgumentException();
testStr.Remove(0, testStr.Length);
retCode = pIPlayer.m_get_id_ip_address(plITest.plEx.IP_Addr);
if (retCode == 0)
throw new ArgumentException();
if (!pIPlayer.m_get_ip_address_id(retCode, testStr))
throw new ArgumentException();
if (testStr.ToString() != plITest.plEx.IP_Addr)
throw new ArgumentException();
testStr.Remove(0, testStr.Length);
retCode = pIPlayer.m_get_id_port(plITest.plEx.IP_Port);
if (retCode == 0)
throw new ArgumentException();
if (!pIPlayer.m_get_port_id(retCode, testStr))
throw new ArgumentException();
if (testStr.ToString() != plITest.plEx.IP_Port)
throw new ArgumentException();
testStr.Remove(0, testStr.Length);
if (pIPlayer.m_update(ref plINull))
throw new ArgumentException();
if (!pIPlayer.m_update(ref plITest))
throw new ArgumentException();
if (!pIPlayer.m_send_custom_message(Addon_API.MSG_FORMAT.MF_BLANK, Addon_API.MSG_PROTOCOL.MP_CHAT, ref plITest, "Simple blank prefix message for {0:s}", 1, plITest.plR.PlayerName))
throw new ArgumentException();
if (!pIPlayer.m_send_custom_message(Addon_API.MSG_FORMAT.MF_SERVER, Addon_API.MSG_PROTOCOL.MP_CHAT, ref plITest, "Simple server prefix message for {0:s}", 1, plITest.plR.PlayerName))
throw new ArgumentException();
if (!pIPlayer.m_send_custom_message_broadcast(Addon_API.MSG_FORMAT.MF_BLANK, "Simple blank prefix message for {0:s}", 0))
throw new ArgumentException();
if (!pIPlayer.m_send_custom_message_broadcast(Addon_API.MSG_FORMAT.MF_SERVER, "Simple server prefix message for {0:s}", 0))
throw new ArgumentException();
//m_apply_camo test only required biped data to verify data is set to camoflauge.
plBiped.refresh();
if ((plBiped.s_object_n.isVisible & 0x10) != 0)
throw new ArgumentException();
pIPlayer.m_apply_camo(ref plITest, 10);
plBiped.refresh();
if ((plBiped.s_object_n.isVisible & 0x10) == 0)
throw new ArgumentException();
e_color_team_index oldTeam = plITest.plR.Team;
pIPlayer.m_change_team(ref plITest, (e_color_team_index)Convert.ToByte((oldTeam == e_color_team_index.TEAM_RED)), true);
if (plITest.plR.Team == oldTeam)
throw new ArgumentException();
tm gmtm = new tm();
System.DateTime time = DateTime.UtcNow;
gmtm.tm_isdst = Convert.ToInt32(time.IsDaylightSavingTime());