-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtils_test.ts
More file actions
1652 lines (1259 loc) · 71.8 KB
/
Utils_test.ts
File metadata and controls
1652 lines (1259 loc) · 71.8 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
/// <reference path="_references.ts" />
module TS_Utils_test
{
class TestConstructorCallClass
{
private _ID: string;
constructor(ID: string = "1")
{
TS.Utils.checkConstructorCall(this, TestConstructorCallClass);
this._ID = ID;
}
}
enum testEnum { ZERO, ONE, TWO, THREE };
QUnit.module("TS.Utils",
{
before: function ()
{
// runs once before anything else in the module
},
beforeEach: function ()
{
// prepare something for all following tests
},
afterEach: function ()
{
// clean up after each test
},
after: function ()
{
// runs once after all unit tests finished (including teardown)
//personEnumerable = null;
}
});
QUnit.test("allIndexOf", (assert) =>
{
let result: Array<number>;
let sourceString: string = "abcabcdabcdeabcdefabcdefgabcdefgh";
let searchString: string = "abc";
let expectedResult = [0, 3, 7, 12, 18, 25];
result = TS.Utils.allIndexOf(sourceString, searchString);
assert.deepEqual(result, expectedResult, "Should return the expected array of indexes.");
result = TS.Utils.allIndexOf(searchString, "xyz");
assert.ok(result.length == 0, "Should return an empty result array for a search string which has no match.");
result = TS.Utils.allIndexOf(null, searchString);
assert.ok(result.length == 0, "Should return an empty result array for a call with an null source string.");
result = TS.Utils.allIndexOf(undefined, searchString)
assert.ok(result.length == 0, "Should return an empty result array for a call with an undefined source string.");
result = TS.Utils.allIndexOf(sourceString, null)
assert.ok(result.length == 0, "Should return an empty result array for a call with a null search string.");
result = TS.Utils.allIndexOf(sourceString, undefined)
assert.ok(result.length == 0, "Should return an empty result array for a call with an undefined search string.");
});
QUnit.test("bitStringToByteArray", (assert) =>
{
let testVectors: Array<{ str: string, val: number }>;
let index: number;
let resultArray: Array<number>;
testVectors = [{ str: "10101010", val: 170 }, { str: "00001111", val: 15 }, { str: "01010101", val: 85 }, { str: "00000000", val: 0 }, { str: "00000001", val: 1 }];
for (index = 0; index < testVectors.length; index++)
{
let innerIndex: number;
let testString: string;
let testArray: Array<number>;
testString = "";
testArray = new Array<number>();
for (innerIndex = 0; innerIndex <= index; innerIndex++)
{
testString += testVectors[innerIndex].str;
testArray.push(testVectors[innerIndex].val);
}//END for
resultArray = TS.Utils.bitStringToByteArray(testString);
assert.deepEqual(resultArray, testArray, "The result array should match with the test values.");
}//END for
assert.throws(() =>
{
resultArray = TS.Utils.bitStringToByteArray(undefined);
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for an undefined parameter value.")
assert.throws(() =>
{
resultArray = TS.Utils.bitStringToByteArray(null);
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a null parameter value.")
assert.throws(() =>
{
resultArray = TS.Utils.bitStringToByteArray("");
}, TS.ArgumentNullUndefOrWhiteSpaceException, "The call should fail with a \"TS.ArgumentNullUndefOrWhiteSpaceException\" for an empty parameter value.")
assert.throws(() =>
{
resultArray = TS.Utils.bitStringToByteArray(" \r\n");
}, TS.ArgumentNullUndefOrWhiteSpaceException, "The call should fail with a \"TS.ArgumentNullUndefOrWhiteSpaceException\" for a whitespace parameter value.")
assert.throws(() =>
{
resultArray = TS.Utils.bitStringToByteArray("test");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter which is not a valid bit string.");
});
QUnit.test("byteArrayToBitString", (assert) =>
{
let testVectors: Array<{ str: string, val: number }>;
let index: number;
let byteArray: Array<number>;
let controlStr: string;
testVectors = [{ str: "10101010", val: 170 }, { str: "00001111", val: 15 }, { str: "01010101", val: 85 }, { str: "00000000", val: 0 }, { str: "00000001", val: 1 }];
byteArray = new Array<number>();
controlStr = "";
for (index = 0; index < testVectors.length; index++)
{
byteArray.push(testVectors[index].val);
controlStr += testVectors[index].str;
}
let resultStr = TS.Utils.byteArrayToBitString(byteArray);
assert.equal(resultStr, controlStr, "Should return the expected bit string.");
assert.throws(() =>
{
TS.Utils.byteArrayToBitString([0, 1, null, 3]);
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a invalid byteArray argument value.")
assert.throws(() =>
{
TS.Utils.byteArrayToBitString([]);
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for an empty byteArray argument value.")
assert.throws(() =>
{
TS.Utils.byteArrayToBitString(null);
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a null byteArray argument value.")
assert.throws(() =>
{
TS.Utils.byteArrayToBitString(undefined);
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for an undefined byteArray argument value.")
});
QUnit.test("byteArrayToHexString", (assert) =>
{
let controlString = "0102030405060708090afafbfcfdfeff";
let byteArray: Array<number>;
let UIntArray: Uint8Array;
let resultString: string;
byteArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 250, 251, 252, 253, 254, 255];
UIntArray = new Uint8Array(byteArray);
resultString = TS.Utils.byteArrayToHexString(byteArray);
assert.equal(resultString, controlString, "Should return the expected result string for a valid array of byte values.");
resultString = TS.Utils.byteArrayToHexString(UIntArray);
assert.equal(resultString, controlString, "Should return the expected result string for a valid Uint8Array.");
assert.throws(() =>
{
TS.Utils.byteArrayToHexString([0, 1, null, 3]);
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a invalid byteArray argument value.")
assert.throws(() =>
{
TS.Utils.byteArrayToHexString([0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 256]);
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a byteArray argument value which exceeds the range of allowed values.");
assert.throws(() =>
{
TS.Utils.byteArrayToHexString([]);
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for an empty byteArray argument value.")
assert.throws(() =>
{
TS.Utils.byteArrayToHexString(null);
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a null byteArray argument value.")
assert.throws(() =>
{
TS.Utils.byteArrayToHexString(undefined);
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for an undefined byteArray argument value.")
});
QUnit.test("byteArrayToUInt", (assert) =>
{
let testNumberArray: Array<number> = [0X49, 0X96, 0X02, 0XD2];
let testUInt8Array: Uint8Array = new Uint8Array([0xff, 0xf0, 0x0f, 0x00]);
let numArrayResult: number = 1234567890;
let UInt8ArrayResult: number = 4293922560;
let testResult: number;
testResult = TS.Utils.byteArrayToUInt(testNumberArray);
assert.equal(testResult, numArrayResult, "Should return the expected integer result.");
testResult = TS.Utils.byteArrayToUInt(testUInt8Array);
assert.equal(testResult, UInt8ArrayResult, "Should return the expected integer result.");
assert.throws(() =>
{
TS.Utils.byteArrayToBitString([0, 1, null, 3]);
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a invalid byteArray argument value.")
assert.throws(() =>
{
TS.Utils.byteArrayToUInt([0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF]);
}, TS.ArgumentOutOfRangeException, "The call should fail with a \"TS.ArgumentOutOfRangeException\" for an byteArray argument value which exceeds the range of allowed values.");
assert.throws(() =>
{
TS.Utils.byteArrayToUInt([]);
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for an empty byteArray argument value.")
assert.throws(() =>
{
TS.Utils.byteArrayToUInt(null);
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a null byteArray argument value.")
assert.throws(() =>
{
TS.Utils.byteArrayToUInt(undefined);
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for an undefined byteArray argument value.")
});
QUnit.test("byteToBitString", (assert) =>
{
let testVectors: Array<{ str: string, val: number }>;
let resultString: string;
let index: number;
testVectors = [{ str: "10101010", val: 170 }, { str: "00001111", val: 15 }, { str: "01010101", val: 85 }, { str: "00000000", val: 0 }, { str: "00000001", val: 1 }];
for (index = 0; index < testVectors.length; index++)
{
resultString = TS.Utils.byteToBitString(testVectors[index].val);
assert.equal(resultString, testVectors[index].str, "The result string should match with the test string.");
}//END for
assert.throws(() =>
{
TS.Utils.byteToBitString(undefined);
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for an undefined 'value' argument.");
assert.throws(() =>
{
TS.Utils.byteToBitString(null);
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a null 'value' argument.");
assert.throws(() =>
{
TS.Utils.byteToBitString(-1);
}, TS.InvalidTypeException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a negative integer 'value' argument.");
assert.throws(() =>
{
TS.Utils.byteToBitString(256);
}, TS.InvalidTypeException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for an integer which is out of byte range 'value' argument.");
assert.throws(() =>
{
TS.Utils.byteToBitString(2.5);
}, TS.InvalidTypeException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a floating point 'value' argument.");
});
QUnit.test("checkArgumentsLength", (assert) =>
{
let args: IArguments;
function threeArgs(num: number, str: string, obj: Object)
{
TS.Utils.checkArgumentsLength(arguments, 1, 3, "threeArgs");
}
threeArgs(1, "two", { name: "three" });
(threeArgs as any)(1, "two");
(threeArgs as any)(1);
assert.throws(() =>
{
(threeArgs as any)();
}, TS.InvalidInvokationException, "The call should fail with a \"TS.InvalidInvokationException\" for less arguments as required.");
assert.throws(() =>
{
(threeArgs as any)(1, "two", { name: "three" }, [4], true);
}, TS.InvalidInvokationException, "The call should fail with a \"TS.InvalidInvokationException\" for more arguments as allowed.");
})
QUnit.test("checkArrayLikeParameter", (assert) =>
{
TS.Utils.checkArrayLikeParameter("doucment_all", document.all, "checkArrayLikeParameter");
assert.ok(true, "Should pass with a node collection as parameter.");
TS.Utils.checkArrayLikeParameter("string", "ABCdefGHIjkl", "checkArrayLikeParameter");
assert.ok(true, "Should pass with a string as parameter.");
assert.throws(() =>
{
TS.Utils.checkArrayLikeParameter("number", 5.4, "checkArrayLikeParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a number 'parameter' argument.");
assert.throws(() =>
{
TS.Utils.checkArrayLikeParameter("null", null, "checkArrayLikeParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a null 'parameter' argument.");
assert.throws(() =>
{
TS.Utils.checkArrayLikeParameter("undefined", undefined, "checkArrayLikeParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for an undefined 'parameter' argument.");
});
QUnit.test("checkArrayParameter", (assert) =>
{
TS.Utils.checkArrayParameter("array", [1, 2], "checkArrayParameter");
assert.ok(true, "Should pass with an array as parameter.");
assert.throws(() =>
{
TS.Utils.checkArrayParameter("object", {}, "checkArrayParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for an object 'parameter' argument.");
assert.throws(() =>
{
TS.Utils.checkArrayParameter("object", null, "checkArrayParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for an object 'parameter' argument.");
assert.throws(() =>
{
TS.Utils.checkArrayParameter("object", undefined, "checkArrayParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for an object 'parameter' argument.");
});
QUnit.test("checkBitStringParameter", (assert) =>
{
TS.Utils.checkBitStringParameter("bitString", "10010111010", "checkBitStringParameter");
assert.ok(true, "Should pass with a valid bit string as parameter.");
assert.throws(() =>
{
TS.Utils.checkBitStringParameter("invalidBitString", "10010 11010", "checkBitStringParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for an invalid bit string 'parameter' argument.");
assert.throws(() =>
{
TS.Utils.checkBitStringParameter("whitespace", " ", "checkBitStringParameter");
}, TS.ArgumentNullUndefOrWhiteSpaceException, "The call should fail with a \"TS.ArgumentNullUndefOrWhiteSpaceException\" for a whitespace string 'parameter' argument.");
assert.throws(() =>
{
TS.Utils.checkBitStringParameter("empty", "", "checkBitStringParameter");
}, TS.ArgumentNullUndefOrWhiteSpaceException, "The call should fail with a \"TS.ArgumentNullUndefOrWhiteSpaceException\" for an empty string 'parameter' argument.");
//assert.throws(() =>
//{
// TS.Utils.checkBitStringParameter("object", {}, "checkBitStringParameter");
//}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for an objct 'parameter' argument.");
assert.throws(() =>
{
TS.Utils.checkBitStringParameter("null", null, "checkBitStringParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.InvalidTypeException\" for a null 'parameter' argument.");
assert.throws(() =>
{
TS.Utils.checkBitStringParameter("undefined", undefined, "checkBitStringParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.InvalidTypeException\" for an undefined 'parameter' argument.");
});
QUnit.test("checkBooleanParameter", (assert) =>
{
TS.Utils.checkBooleanParameter("true", true, "checkBooleanParameter")
assert.ok(true, "Should pass for a parameter value which is the boolean true.");
TS.Utils.checkBooleanParameter("false", false, "checkBooleanParameter")
assert.ok(true, "Should pass for a parameter value which is the boolean false.");
assert.throws(() =>
{
TS.Utils.checkBooleanParameter("object", {}, "checkBooleanParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for an object 'parameter' argument.");
assert.throws(() =>
{
TS.Utils.checkBooleanParameter("string", "", "checkBooleanParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a string 'parameter' argument.");
assert.throws(() =>
{
TS.Utils.checkBooleanParameter("null", null, "checkBooleanParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a null 'parameter' argument.");
assert.throws(() =>
{
TS.Utils.checkBooleanParameter("undefined", undefined, "checkBooleanParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for an undefined 'parameter' argument.");
});
QUnit.test("checkConstructorCall", (assert) =>
{
let constructResult: any;
constructResult = new TestConstructorCallClass();
assert.ok(true, "Should pass for a valid constructor call with the new operator.");
});
QUnit.test("checkConstructorParameter", (assert) =>
{
let testFunc: (...rest: Array<any>) => any;
let testFactoryFunc: (...rest: Array<any>) => any;
TS.Utils.checkConstructorParameter("constructor", TestConstructorCallClass, "checkConstructorParameter");
assert.ok(true, "Should pass for a parameter value which is a constructor function.");
testFunc = function (first: number, second: number): number
{
return first + second;
}
testFactoryFunc = function ()
{
return new TestConstructorCallClass();
}
assert.throws(() =>
{
TS.Utils.checkConstructorParameter("object", testFunc, "checkConstructorParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which isn't meant to be a constructor function.");
assert.throws(() =>
{
TS.Utils.checkConstructorParameter("object", testFactoryFunc, "checkConstructorParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which is a factory function instead of a constructor function.");
assert.throws(() =>
{
TS.Utils.checkConstructorParameter("object", {}, "checkConstructorParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which is a object.");
assert.throws(() =>
{
TS.Utils.checkConstructorParameter("string", "", "checkConstructorParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which is a string.");
assert.throws(() =>
{
TS.Utils.checkConstructorParameter("null", null, "checkConstructorParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for parameter value which is a null value.");
assert.throws(() =>
{
TS.Utils.checkConstructorParameter("undefined", undefined, "checkConstructorParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a parameter value which is undefined.");
});
QUnit.test("checkDateParameter", (assert) =>
{
TS.Utils.checkDateParameter("Date", new Date(), "checkDateParameter");
assert.ok(true, "Should pass for a parameter value which is a valid date object.");
assert.throws(() =>
{
TS.Utils.checkDateParameter("Empty object", {}, "checkDateParameter")
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which is an empty object.");
assert.throws(() =>
{
TS.Utils.checkDateParameter("null", null, "checkDateParameter")
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a null parameter value.");
assert.throws(() =>
{
TS.Utils.checkDateParameter("undefined", undefined, "checkDateParameter")
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for an undefined parameter value.");
});
QUnit.test("checkDateStringParameter", (assert) =>
{
TS.Utils.checkDateStringParameter("2016-01-01T00:00:00", "2016-01-01T00:00:00", "checkDateParameter");
assert.ok(true, "Should pass for a parameter value which is a valid date string.");
TS.Utils.checkDateStringParameter("Mon Nov 28 2016", "Mon Nov 28 2016", "checkDateParameter");
assert.ok(true, "Should pass for a parameter value which is a valid date string.");
TS.Utils.checkDateStringParameter("Mon, 28 Nov 2016 17:02:37 GMT", "Mon, 28 Nov 2016 17:02:37 GMT", "checkDateParameter");
assert.ok(true, "Should pass for a parameter value which is a valid date string.");
TS.Utils.checkDateStringParameter("11/28/2016", "11/28/2016", "checkDateParameter");
assert.ok(true, "Should pass for a parameter value which is a valid date string.");
assert.throws(() =>
{
TS.Utils.checkDateStringParameter("13/13/2016", "13/13/2016", "checkDateStringParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for an invalid date string parameter value.");
assert.throws(() =>
{
TS.Utils.checkDateStringParameter("Mon, 28 Nov 2016 25:02:37 GMT", "Mon, 28 Nov 2016 25:02:37 GMT", "checkDateStringParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for an invalid date string parameter value.");
assert.throws(() =>
{
TS.Utils.checkDateStringParameter("2016-00-01T00:00:00", "2016-00-01T00:00:00", "checkDateStringParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for an invalid date string parameter value.");
assert.throws(() =>
{
TS.Utils.checkDateStringParameter("no date", "no date", "checkDateStringParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for an invalid date string parameter value.");
assert.throws(() =>
{
TS.Utils.checkDateStringParameter("{}", {}, "checkDateStringParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for an empty object parameter value.");
assert.throws(() =>
{
TS.Utils.checkDateStringParameter("null", null, "checkDateStringParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a null parameter value.");
assert.throws(() =>
{
TS.Utils.checkDateStringParameter("undefined", undefined, "checkDateStringParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for an undefined parameter value.");
});
QUnit.test("checkFunctionParameter", (assert) =>
{
TS.Utils.checkFunctionParameter("func", () => { }, "checkFunctionParameter");
assert.ok(true, "Should pass for a call with a valid function parameter.");
assert.throws(() =>
{
TS.Utils.checkIntNumberParameter("null", null, "checkFunctionParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a parameter value which is a null value.");
assert.throws(() =>
{
TS.Utils.checkIntNumberParameter("undefined", undefined, "checkFunctionParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a parameter value which is undefined.");
});
QUnit.test("checkIntNumberParameter", (assert) =>
{
TS.Utils.checkIntNumberParameter("one", 1, "checkIntegerNumberParameter");
assert.ok(true, "Should pass for a parameter value which is a postitive integer number.");
TS.Utils.checkIntNumberParameter("minusOne", -1, "checkIntegerNumberParameter");
assert.ok(true, "Should pass for a parameter value which is a negative integer number.");
TS.Utils.checkIntNumberParameter("zero", 0, "checkIntegerNumberParameter");
assert.ok(true, "Should pass for a parameter value which is a number with the value '0'.");
TS.Utils.checkIntNumberParameter("MAX_SAFE_INTEGER", Number.MAX_SAFE_INTEGER, "checkIntegerNumberParameter");
assert.ok(true, "Should pass for a parameter value which is MAX_SAFE_INTEGER.");
assert.throws(() =>
{
TS.Utils.checkIntNumberParameter("MAX_VALUE", Number.MAX_VALUE, "checkIntegerNumberParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which is a Number.MAX_VALUE number.");
assert.throws(() =>
{
TS.Utils.checkIntNumberParameter("POSITIVE_INFINITY", Number.POSITIVE_INFINITY, "checkIntegerNumberParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which is a Number.POSITIVE_INFINITY number.");
assert.throws(() =>
{
TS.Utils.checkIntNumberParameter("NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, "checkIntegerNumberParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which is a Number.NEGATIVE_INFINITY number.");
assert.throws(() =>
{
TS.Utils.checkIntNumberParameter("zeroPointFive", 0.5, "checkIntegerNumberParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which is a floating point number.");
assert.throws(() =>
{
TS.Utils.checkIntNumberParameter("NaN", Number.NaN, "checkIntegerNumberParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which is Number.NaN.");
assert.throws(() =>
{
TS.Utils.checkIntNumberParameter("null", null, "checkIntegerNumberParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for parameter value which is a null value.");
assert.throws(() =>
{
TS.Utils.checkIntNumberParameter("undefined", undefined, "checkIntegerNumberParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a parameter value which is undefined.");
});
QUnit.test("checkInstanceOfParameter", (assert) =>
{
let testObj0: any;
let testLiteralObj: any;
testLiteralObj =
{
Address: "Main Street 20",
City: "Vienna",
CompanyName: "Making Money",
ContactName: "Call me",
ContactTitle: "",
Country: "Austria",
CustomerID: "42",
Fax: "1234",
Phone: "555-555",
PostalCode: "12345",
Region: "NW"
};
testObj0 = new DATA.Customer("Main Street 20", "Vienna", "Making Money", "Call me", "", "Austria", "42", "1234", "555-555", "12345", "NW");
TS.Utils.checkInstanceOfParameter("testObj0", testObj0, DATA.Customer, "checkInstanceOf");
assert.ok(true, "Should pass for a parameter value wich is an instance of the specified type.");
assert.throws(() =>
{
TS.Utils.checkInstanceOfParameter("testLiteralObj", testLiteralObj, DATA.Customer, "checkInstanceOf");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which is a literal boject.");
assert.throws(() =>
{
TS.Utils.checkInstanceOfParameter("testObj0", testObj0, testLiteralObj, "checkInstanceOf");
}, TS.InvalidInvokationException, "The call should fail with a \"TS.InvalidInvokationException\" for a type parameter value which is a literal boject.");
assert.throws(() =>
{
TS.Utils.checkInstanceOfParameter("null", null, DATA.Customer, "checkInstanceOf");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a null parameter value.");
assert.throws(() =>
{
TS.Utils.checkInstanceOfParameter("undefined", undefined, DATA.Customer, "checkInstanceOf");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for an undefined parameter value.");
});
QUnit.test("checkIterableParameter", (assert) =>
{
TS.Utils.checkIterableParameter("array", [1, 2, 3, 4, 5], "checkIterableParameter");
assert.ok(true, "Should pass for a parameter value which is an array.");
TS.Utils.checkIterableParameter("string", "AbCdEf", "checkIterableParameter");
assert.ok(true, "Should pass for a parameter value which is a string.");
assert.throws(() =>
{
TS.Utils.checkIterableParameter("object", {}, "checkIterableParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for an object 'parameter' argument.");
assert.throws(() =>
{
TS.Utils.checkIterableParameter("null", null, "checkIterableParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a null 'parameter' argument.");
assert.throws(() =>
{
TS.Utils.checkIterableParameter("undefined", undefined, "checkIterableParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for an undefined 'parameter' argument.");
});
QUnit.test("checkKeyByteArray", (assert) =>
{
let testArray16 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
let testArray24 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24];
let testArray32 = [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];
TS.Utils.checkKeyByteArray("testArray16", testArray16, "checkKeyByteArray");
assert.ok(true, "Should pass for a parameter value which is a valid 16 byte array.");
TS.Utils.checkKeyByteArray("testArray24", testArray24, "checkKeyByteArray");
assert.ok(true, "Should pass for a parameter value which is a valid 24 byte array.");
TS.Utils.checkKeyByteArray("testArray32", testArray32, "checkKeyByteArray");
assert.ok(true, "Should pass for a parameter value which is a valid 32 byte array.");
assert.throws(() =>
{
TS.Utils.checkKeyByteArray("shortArray", [1, 2, 3], "checkKeyByteArray");
}, TS.ArgumentOutOfRangeException, "The call should fail with a \"TS.ArgumentOutOfRangeException\" for a call with an array which deceeds the minimum array length.");
assert.throws(() =>
{
testArray32.push(33);
TS.Utils.checkKeyByteArray("longArray", testArray32, "checkKeyByteArray");
}, TS.ArgumentOutOfRangeException, "The call should fail with a \"TS.ArgumentOutOfRangeException\" for a call with an array which exceeds the maximum array length.");
assert.throws(() =>
{
testArray24[15] = null;
TS.Utils.checkKeyByteArray("invallidArray", testArray24, "checkKeyByteArray");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a call with an array which is not a valid unsigned byte array.");
assert.throws(() =>
{
testArray24[15] = null;
TS.Utils.checkKeyByteArray("longArray", null, "checkKeyByteArray");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a call with a null 'parameter' value.");
assert.throws(() =>
{
testArray24[15] = null;
TS.Utils.checkKeyByteArray("longArray", undefined, "checkKeyByteArray");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a call with an undefined 'parameter' value.");
});
QUnit.test("checkNotEmptyParameter", (assert) =>
{
TS.Utils.checkNotEmptyParameter("array", [1, 2], "checkNotEmptyParameter");
TS.Utils.checkNotEmptyParameter("string", "Test", "checkNotEmptyParameter");
TS.Utils.checkNotEmptyParameter("number", 0, "checkNotEmptyParameter");
TS.Utils.checkNotEmptyParameter("object", {}, "checkNotEmptyParameter");
assert.throws(() =>
{
TS.Utils.checkNotEmptyParameter("emptyString", "", "checkNotEmptyParameter");
}, TS.ArgumentNullUndefOrEmptyException, "The call should fail with a \"TS.ArgumentNullUndefOrEmptyException\" for an empty string parameter value.");
assert.throws(() =>
{
TS.Utils.checkNotEmptyParameter("emptyArra", [], "checkNotEmptyParameter");
}, TS.ArgumentNullUndefOrEmptyException, "The call should fail with a \"TS.ArgumentNullUndefOrEmptyException\" for an empty array parameter value.");
assert.throws(() =>
{
TS.Utils.checkNotEmptyParameter("null", null, "checkNotEmptyParameter");
}, TS.ArgumentNullUndefOrEmptyException, "The call should fail with a \"TS.ArgumentNullUndefOrEmptyException\" for a null parameter value.");
assert.throws(() =>
{
TS.Utils.checkNotEmptyParameter("undefined", undefined, "checkNotEmptyParameter");
}, TS.ArgumentNullUndefOrEmptyException, "The call should fail with a \"TS.ArgumentNullUndefOrEmptyException\" for a undefined parameter value.");
});
QUnit.test("checkNotUndefinedParameter", (assert) =>
{
TS.Utils.checkNotUndefinedParameter("object", {}, "checkNotUndefinedParameter");
assert.ok(true, "Should pass for a parameter value which is an object.");
TS.Utils.checkNotUndefinedParameter("string", "", "checkNotUndefinedParameter");
assert.ok(true, "Should pass for a parameter value which is a string.");
TS.Utils.checkNotUndefinedParameter("null", null, "checkNotUndefinedParameter");
assert.ok(true, "Should pass for a parameter value which is null.");
assert.throws(() =>
{
TS.Utils.checkNotUndefinedParameter("undefined", undefined, "checkNotUndefinedParameter");
}, TS.ArgumentUndefinedException, "The call should fail with a \"TS.ArgumentUndefinedException\" for a parameter value which is undefined.");
});
QUnit.test("checkNumberParameter", (assert) =>
{
TS.Utils.checkNumberParameter("intNumber", 10, "checkNumberParameter");
TS.Utils.checkNumberParameter("intNumber", -10, "checkNumberParameter");
TS.Utils.checkNumberParameter("zero", 0, "checkNumberParameter");
TS.Utils.checkNumberParameter("float", 2.5, "checkNumberParameter");
TS.Utils.checkNumberParameter("float", -2.5, "checkNumberParameter");
TS.Utils.checkNumberParameter("float", 314e-2, "checkNumberParameter");
TS.Utils.checkNumberParameter("float", 0.0314E+2, "checkNumberParameter");
TS.Utils.checkNumberParameter("MIN_SAFE_INTEGER", Number.MIN_SAFE_INTEGER, "checkNumberParameter");
TS.Utils.checkNumberParameter("MAX_SAFE_INTEGER", Number.MAX_SAFE_INTEGER, "checkNumberParameter");
TS.Utils.checkNumberParameter("MIN_SAFE_INTEGER", Number.MIN_VALUE, "checkNumberParameter");
TS.Utils.checkNumberParameter("MAX_SAFE_INTEGER", Number.MAX_VALUE, "checkNumberParameter");
TS.Utils.checkNumberParameter("NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, "checkNumberParameter");
TS.Utils.checkNumberParameter("POSITIVE_INFINITY", Number.POSITIVE_INFINITY, "checkNumberParameter");
TS.Utils.checkNumberParameter("numberObject", new Number(5), "checkNumberParameter");
assert.ok(true, "Should pass for a parametes values which are number.");
assert.throws(() =>
{
TS.Utils.checkNumberParameter("numberString", "5", "checkNumberParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.ArgumentUndefinedException\" for a parameter value which is a string.");
assert.throws(() =>
{
TS.Utils.checkNumberParameter("object", {}, "checkNumberParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.ArgumentUndefinedException\" for a parameter value which is an object.");
assert.throws(() =>
{
TS.Utils.checkNumberParameter("null", null, "checkNumberParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a null parmeter value.");
assert.throws(() =>
{
TS.Utils.checkNumberParameter("undefined", undefined, "checkNumberParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for an undefined parameter value.");
});
QUnit.test("checkObjectParameter", (assert) =>
{
TS.Utils.checkObjectParameter("Literal Object", {}, "checkObjectParameter");
TS.Utils.checkObjectParameter("Constructed Object", new Object(null), "checkObjectParameter");
TS.Utils.checkObjectParameter("String Object", new String(""), "checkObjectParameter");
TS.Utils.checkObjectParameter("Number Object", new Number(0), "checkObjectParameter");
TS.Utils.checkObjectParameter("Boolean Object", new Boolean(true), "checkObjectParameter");
TS.Utils.checkObjectParameter("Literal RegEx", /[a-z]*/, "checkObjectParameter");
TS.Utils.checkObjectParameter("Constructe RegEx", new RegExp("[a-z]"), "checkObjectParameter");
assert.ok(true, "Should pass for all paramters which are objects");
assert.throws(() =>
{
TS.Utils.checkObjectParameter("string", "string", "checkObjectParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which is a string.");
assert.throws(() =>
{
TS.Utils.checkObjectParameter("number", 42, "checkObjectParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which is a number.");
assert.throws(() =>
{
TS.Utils.checkObjectParameter("boolean", true, "checkObjectParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which is a boolean.");
assert.throws(() =>
{
TS.Utils.checkObjectParameter("symbol", Symbol("symbol"), "checkObjectParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which is a symbol.");
assert.throws(() =>
{
TS.Utils.checkObjectParameter("null", null, "checkObjectParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a parameter value which is a null value.");
assert.throws(() =>
{
TS.Utils.checkObjectParameter("undefined", undefined, "checkObjectParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a parameter value which is an undefined value.");
});
QUnit.test("checkParameter", (assert) =>
{
TS.Utils.checkParameter("object", {}, "checkParameter");
assert.ok(true, "Should pass for a parameter value which is an object.");
TS.Utils.checkParameter("string", "", "checkParameter");
assert.ok(true, "Should pass for a parameter value which is a string.");
assert.throws(() =>
{
TS.Utils.checkParameter("null", null, "checkParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a parameter value which is a null value.");
assert.throws(() =>
{
TS.Utils.checkParameter("undefined", undefined, "checkParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a parameter value which is undefined.");
});
QUnit.test("checkStringParameter", (assert) =>
{
TS.Utils.checkStringParameter("string", "String", "checkStringParameter");
assert.ok(true, "Should pass for a parameter value which is a string.");
assert.throws(() =>
{
TS.Utils.checkStringParameter("noString", {}, "checkStringParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which is not a string.");
assert.throws(() =>
{
TS.Utils.checkStringParameter("emptyString", "", "checkStringParameter");
}, TS.ArgumentNullUndefOrWhiteSpaceException, "The call should fail with a \"TS.ArgumentNullUndefOrWhiteSpaceException\" for a parameter value which is an empty string.");
assert.throws(() =>
{
TS.Utils.checkStringParameter("whitespaceString", " \r\n", "checkStringParameter");
}, TS.ArgumentNullUndefOrWhiteSpaceException, "The call should fail with a \"TS.ArgumentNullUndefOrWhiteSpaceException\" for a parameter value which is a whitespace string.");
assert.throws(() =>
{
TS.Utils.checkStringParameter("null", null, "checkStringParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a parameter value which is a null value.");
assert.throws(() =>
{
TS.Utils.checkStringParameter("undefined", undefined, "checkStringParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a parameter value which is undefined.");
});
QUnit.test("checkUByteArrayParameter", (assert) =>
{
TS.Utils.checkUByteArrayParameter("byteArray", [1, 2, 3, 4, 5], "checkUByteArrayParameter");
assert.ok(true, "Should pass for a parameter value which is a valid uByte array.");
assert.throws(() =>
{
TS.Utils.checkUByteArrayParameter("emptyArray", [], "checkUByteArrayParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which is an empty array.");
assert.throws(() =>
{
TS.Utils.checkUByteArrayParameter("invalidArray", [1, 2, null, 4, 5], "checkUByteArrayParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which is an empty array with an invalid element.");
assert.throws(() =>
{
TS.Utils.checkUByteArrayParameter("stringArray", ["one", "two"], "checkUByteArrayParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which is a string array.");
assert.throws(() =>
{
TS.Utils.checkUByteArrayParameter("noArray", {}, "checkUByteArrayParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which isn't an array.");
assert.throws(() =>
{
TS.Utils.checkUByteArrayParameter("null", null, "checkUByteArrayParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for a null parameter value.");
assert.throws(() =>
{
TS.Utils.checkUByteArrayParameter("undefined", undefined, "checkUByteArrayParameter");
}, TS.ArgumentNullOrUndefinedException, "The call should fail with a \"TS.ArgumentNullOrUndefinedException\" for an undefined parameter value.");
});
QUnit.test("checkUByteParameter", (assert) =>
{
TS.Utils.checkUByteParameter("uByte", 12, "checkUByteParameter");
assert.ok(true, "Should pass for a parameter value which is a valid uByte.");
assert.throws(() =>
{
TS.Utils.checkUByteParameter("string", "0", "checkUByteParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which is a string.");
assert.throws(() =>
{
TS.Utils.checkUByteParameter("negative", -12, "checkUByteParameter");
}, TS.InvalidTypeException, "The call should fail with a \"TS.InvalidTypeException\" for a parameter value which is a signed byte.");
assert.throws(() =>
{