xdbc 1.0.217 → 1.0.219

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/.gitattributes +16 -8
  2. package/.vscode/settings.json +3 -3
  3. package/.vscode/tasks.json +23 -23
  4. package/ASSESSMENT.md +249 -0
  5. package/README.md +538 -408
  6. package/__tests__/DBC/AE.test.ts +62 -62
  7. package/__tests__/DBC/ARRAY.test.ts +91 -91
  8. package/__tests__/DBC/DEFINED.test.ts +53 -53
  9. package/__tests__/DBC/DOM.test.ts +786 -0
  10. package/__tests__/DBC/Decorators.test.ts +367 -367
  11. package/__tests__/DBC/EQ.test.ts +13 -13
  12. package/__tests__/DBC/GREATER.test.ts +31 -31
  13. package/__tests__/DBC/HasAttribute.test.ts +60 -60
  14. package/__tests__/DBC/IF.test.ts +62 -62
  15. package/__tests__/DBC/INSTANCE.test.ts +13 -13
  16. package/__tests__/DBC/JSON.OP.test.ts +47 -47
  17. package/__tests__/DBC/JSON.Parse.test.ts +17 -17
  18. package/__tests__/DBC/OR.test.ts +14 -14
  19. package/__tests__/DBC/PLAIN_OBJECT.test.ts +109 -109
  20. package/__tests__/DBC/REGEX.test.ts +17 -17
  21. package/__tests__/DBC/TYPE.test.ts +13 -13
  22. package/__tests__/DBC/UNDEFINED.test.ts +45 -45
  23. package/__tests__/DBC/ZOD.test.ts +54 -54
  24. package/__tests__/DBC/onInfringement.test.ts +262 -0
  25. package/biome.json +45 -40
  26. package/dist/DBC/AE.js +172 -0
  27. package/dist/DBC/ARR/PLAIN_OBJECT.d.ts +0 -3
  28. package/dist/DBC/ARR/PLAIN_OBJECT.js +95 -0
  29. package/dist/DBC/ARRAY.d.ts +0 -3
  30. package/dist/DBC/ARRAY.js +90 -0
  31. package/dist/DBC/COMPARISON/GREATER.js +21 -0
  32. package/dist/DBC/COMPARISON/GREATER_OR_EQUAL.js +21 -0
  33. package/dist/DBC/COMPARISON/LESS.js +21 -0
  34. package/dist/DBC/COMPARISON/LESS_OR_EQUAL.js +21 -0
  35. package/dist/DBC/COMPARISON.js +98 -0
  36. package/dist/DBC/DEFINED.js +87 -0
  37. package/dist/DBC/DOM.d.ts +123 -0
  38. package/dist/DBC/DOM.js +362 -0
  39. package/dist/DBC/EQ/DIFFERENT.js +34 -0
  40. package/dist/DBC/EQ.js +101 -0
  41. package/dist/DBC/GREATER.js +99 -0
  42. package/dist/DBC/HasAttribute.js +101 -0
  43. package/dist/DBC/IF.js +96 -0
  44. package/dist/DBC/INSTANCE.js +122 -0
  45. package/dist/DBC/JSON.OP.js +120 -0
  46. package/dist/DBC/JSON.Parse.js +104 -0
  47. package/dist/DBC/OR.js +125 -0
  48. package/dist/DBC/REGEX.js +136 -0
  49. package/dist/DBC/TYPE.js +112 -0
  50. package/dist/DBC/UNDEFINED.js +87 -0
  51. package/dist/DBC/ZOD.js +99 -0
  52. package/dist/DBC.d.ts +18 -4
  53. package/dist/DBC.js +645 -0
  54. package/dist/Demo.d.ts +10 -0
  55. package/dist/Demo.js +713 -0
  56. package/dist/Test.html +18 -0
  57. package/dist/bundle.js +6140 -405
  58. package/dist/index.d.ts +22 -0
  59. package/dist/index.html +18 -0
  60. package/dist/index.js +22 -0
  61. package/docs/assets/highlight.css +22 -22
  62. package/docs/assets/icons.js +17 -17
  63. package/docs/assets/main.js +60 -60
  64. package/docs/assets/style.css +1640 -1640
  65. package/docs/classes/DBC.DBC.html +98 -98
  66. package/docs/classes/DBC_AE.AE.html +160 -160
  67. package/docs/classes/DBC_EQ.EQ.html +131 -131
  68. package/docs/classes/DBC_GREATER.GREATER.html +139 -139
  69. package/docs/classes/DBC_INSTANCE.INSTANCE.html +130 -130
  70. package/docs/classes/DBC_JSON.OP.JSON_OP.html +138 -138
  71. package/docs/classes/DBC_JSON.Parse.JSON_Parse.html +129 -129
  72. package/docs/classes/DBC_OR.OR.html +137 -137
  73. package/docs/classes/DBC_REGEX.REGEX.html +136 -136
  74. package/docs/classes/DBC_TYPE.TYPE.html +130 -130
  75. package/docs/classes/Demo.Demo.html +14 -14
  76. package/docs/hierarchy.html +1 -1
  77. package/docs/index.html +1 -1
  78. package/docs/modules/DBC.html +1 -1
  79. package/docs/modules/DBC_AE.html +1 -1
  80. package/docs/modules/DBC_EQ.html +1 -1
  81. package/docs/modules/DBC_GREATER.html +1 -1
  82. package/docs/modules/DBC_INSTANCE.html +1 -1
  83. package/docs/modules/DBC_JSON.OP.html +1 -1
  84. package/docs/modules/DBC_JSON.Parse.html +1 -1
  85. package/docs/modules/DBC_OR.html +1 -1
  86. package/docs/modules/DBC_REGEX.html +1 -1
  87. package/docs/modules/DBC_TYPE.html +1 -1
  88. package/docs/modules/Demo.html +1 -1
  89. package/jest.config.js +32 -32
  90. package/package.json +71 -55
  91. package/src/DBC/AE.ts +269 -288
  92. package/src/DBC/ARR/PLAIN_OBJECT.ts +122 -133
  93. package/src/DBC/ARRAY.ts +117 -127
  94. package/src/DBC/COMPARISON/GREATER.ts +41 -46
  95. package/src/DBC/COMPARISON/GREATER_OR_EQUAL.ts +41 -45
  96. package/src/DBC/COMPARISON/LESS.ts +41 -45
  97. package/src/DBC/COMPARISON/LESS_OR_EQUAL.ts +41 -45
  98. package/src/DBC/COMPARISON.ts +149 -159
  99. package/src/DBC/DEFINED.ts +117 -122
  100. package/src/DBC/DOM.ts +453 -0
  101. package/src/DBC/EQ/DIFFERENT.ts +51 -57
  102. package/src/DBC/EQ.ts +154 -163
  103. package/src/DBC/HasAttribute.ts +149 -154
  104. package/src/DBC/IF.ts +173 -179
  105. package/src/DBC/INSTANCE.ts +168 -171
  106. package/src/DBC/JSON.OP.ts +178 -186
  107. package/src/DBC/JSON.Parse.ts +150 -157
  108. package/src/DBC/OR.ts +183 -187
  109. package/src/DBC/REGEX.ts +195 -196
  110. package/src/DBC/TYPE.ts +142 -149
  111. package/src/DBC/UNDEFINED.ts +115 -117
  112. package/src/DBC/ZOD.ts +130 -135
  113. package/src/DBC.ts +902 -904
  114. package/src/Demo.ts +537 -404
  115. package/src/index.ts +22 -0
  116. package/tsconfig.json +18 -18
  117. package/tsconfig.test.json +7 -7
  118. package/typedoc.json +16 -16
  119. package/webpack.config.js +27 -27
  120. package/Assessment.md +0 -507
package/src/Demo.ts CHANGED
@@ -1,404 +1,537 @@
1
- import { DBC } from "./DBC";
2
- import { AE } from "./DBC/AE";
3
- import { GREATER } from "./DBC/COMPARISON/GREATER";
4
- import { GREATER_OR_EQUAL } from "./DBC/COMPARISON/GREATER_OR_EQUAL";
5
- import { LESS } from "./DBC/COMPARISON/LESS";
6
- import { LESS_OR_EQUAL } from "./DBC/COMPARISON/LESS_OR_EQUAL";
7
- import { EQ } from "./DBC/EQ";
8
- import { DIFFERENT } from "./DBC/EQ/DIFFERENT";
9
- import { INSTANCE } from "./DBC/INSTANCE";
10
- import { REGEX } from "./DBC/REGEX";
11
- import { TYPE } from "./DBC/TYPE";
12
- /** Demonstrative use of **D**esign **B**y **C**ontract Decorators */
13
- export class Demo {
14
- // #region Check Property Decorator
15
- @REGEX.INVARIANT(/^a$/)
16
- public testProperty = "a";
17
- // #endregion Check Property Decorator
18
- // #region Check Parameter. & Returnvalue Decorator
19
- @REGEX.POST(/^xxxx.*$/)
20
- @DBC.ParamvalueProvider
21
- public testParamvalueAndReturnvalue(@REGEX.PRE(/holla*/g) a: string): string {
22
- return `xxxx${a}`;
23
- }
24
- // #endregion Check Parameter. & Returnvalue Decorator
25
- // #region Check Returnvalue Decorator
26
- @REGEX.POST(/^xxxx.*$/)
27
- public testReturnvalue(a: string): string {
28
- return a;
29
- }
30
- // #endregion Check Returnvalue Decorator
31
- // #region Check EQ-DBC & Path to property of Parameter-value
32
- @DBC.ParamvalueProvider
33
- public testEQAndPath(
34
- @EQ.PRE("SELECT" as unknown as object, false, "tagName") o: HTMLElement,
35
- ) {}
36
- // #endregion Check EQ-DBC & Path to property of Parameter-value
37
- // #region Check EQ-DBC & Path to property of Parameter-value with Inversion
38
- @DBC.ParamvalueProvider
39
- public testEQAndPathWithInversion(
40
- @EQ.PRE("SELECT" as unknown as object, true, "tagName") o: HTMLElement,
41
- ) {}
42
- // #endregion Check EQ-DBC & Path to property of Parameter-value with Inversion
43
- // #region Check TYPE
44
- @DBC.ParamvalueProvider
45
- public testTYPE(@TYPE.PRE("string") o: unknown) {}
46
- // #endregion Check TYPE
47
- // #region Check AE
48
- @DBC.ParamvalueProvider
49
- public testAE(@AE.PRE([new TYPE("string")]) x: Array<unknown>) {}
50
- // #endregion Check AE
51
- // #region Check REGEX with AE
52
- @DBC.ParamvalueProvider
53
- public testREGEXWithAE(
54
- @AE.PRE(new REGEX(/^(?i:(NOW)|([+-]\d+[dmy]))$/i)) x: Array<string>,
55
- ) {}
56
- // #endregion Check REGEX with AE
57
- // #region Check INSTANCE
58
- @DBC.ParamvalueProvider
59
- // biome-ignore lint/suspicious/noExplicitAny: Test
60
- public testINSTANCE(@INSTANCE.PRE(Date) candidate: any): undefined {}
61
- // #endregion Check INSTANCE
62
- // #region Check AE Range
63
- @DBC.ParamvalueProvider
64
- public testAERange(
65
- @AE.PRE([new TYPE("string"), new REGEX(/^abc$/)], 1, 2) x: Array<unknown>,
66
- ) {}
67
- // #endregion Check AE Range
68
- // #region Check AE Index
69
- @DBC.ParamvalueProvider
70
- public testAEIndex(
71
- @AE.PRE([new TYPE("string"), new REGEX(/^abc$/)], 1) x: Array<unknown>,
72
- ) {}
73
- // #endregion Check AE Index
74
- // #region Check Comparison
75
- @DBC.ParamvalueProvider
76
- public testGREATER(@GREATER.PRE(2) input: number) {}
77
-
78
- @DBC.ParamvalueProvider
79
- public testGREATER_OR_EQUAL(@GREATER_OR_EQUAL.PRE(2) input: number) {}
80
-
81
- @DBC.ParamvalueProvider
82
- public testLESS(@LESS.PRE(20) input: number) {}
83
-
84
- @DBC.ParamvalueProvider
85
- public testLESS_OR_EQUAL(@LESS_OR_EQUAL.PRE(20) input: number) {}
86
-
87
- @DBC.ParamvalueProvider
88
- public testDIFFERENT(@DIFFERENT.PRE(20) input: number) {}
89
- // #endregion Check Comparison
90
-
91
- // #region Check Static Method with ParamvalueProvider
92
- @DBC.ParamvalueProvider
93
- public static testStaticMethod(
94
- @TYPE.PRE("string") message: string,
95
- @TYPE.PRE("number") count: number,
96
- ): string {
97
- return `${message} repeated ${count} times`;
98
- }
99
- // #endregion Check Static Method with ParamvalueProvider
100
- }
101
-
102
- const demo = new Demo();
103
-
104
- try {
105
- demo.testProperty = "abd";
106
- } catch (X) {
107
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
108
- console.log("INVARIANT Infringement", "OK");
109
- console.log(X);
110
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
111
- }
112
-
113
- demo.testProperty = "a";
114
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
115
- console.log("INVARIANT OK");
116
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
117
-
118
- demo.testParamvalueAndReturnvalue("holla");
119
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
120
- console.log("PARAMETER- & RETURNVALUE OK");
121
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
122
-
123
- try {
124
- demo.testParamvalueAndReturnvalue("yyyy");
125
- } catch (X) {
126
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
127
- console.log("PARAMETER- & RETURNVALUE Infringement", "OK");
128
- console.log(X);
129
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
130
- }
131
-
132
- demo.testReturnvalue("xxxx");
133
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
134
- console.log("RETURNVALUE OK");
135
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
136
-
137
- try {
138
- demo.testReturnvalue("yyyy");
139
- } catch (X) {
140
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
141
- console.log("RETURNVALUE Infringement", "OK");
142
- console.log(X);
143
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
144
- }
145
-
146
- demo.testEQAndPath(document.createElement("select"));
147
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
148
- console.log("EQ with Path Infringement OK");
149
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
150
-
151
- try {
152
- demo.testEQAndPathWithInversion(document.createElement("select"));
153
- } catch (X) {
154
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
155
- console.log("EQ with Path and Inversion Infringement OK");
156
- console.log(X);
157
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
158
- }
159
-
160
- demo.testTYPE("x");
161
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
162
- console.log("TYPE OK");
163
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
164
-
165
- try {
166
- demo.testTYPE(0);
167
- } catch (X) {
168
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
169
- console.log("TYPE Infringement OK");
170
- console.log(X);
171
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
172
- }
173
-
174
- demo.testAE(["11", "10", "b"]);
175
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
176
- console.log("AE OK");
177
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
178
-
179
- try {
180
- demo.testAE(["11", 11, "b"]);
181
- } catch (X) {
182
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
183
- console.log("AE Infringement OK");
184
- console.log(X);
185
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
186
- }
187
-
188
- demo.testREGEXWithAE(["+1d", "NOW", "-10y"]);
189
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
190
- console.log("REGEX with AE OK");
191
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
192
-
193
- try {
194
- demo.testREGEXWithAE(["+1d", "+5d", "-x10y"]);
195
- } catch (X) {
196
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
197
- console.log("REGEX with AE Infringement OK");
198
- console.log(X);
199
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
200
- }
201
-
202
- demo.testINSTANCE(new Date());
203
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
204
- console.log("INSTANCE OK");
205
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
206
-
207
- try {
208
- demo.testINSTANCE(demo);
209
- } catch (X) {
210
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
211
- console.log("INSTANCE Infringement OK");
212
- console.log(X);
213
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
214
- }
215
-
216
- demo.testAERange([11, "abc", "abc"]);
217
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
218
- console.log("AE Range OK");
219
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
220
-
221
- try {
222
- demo.testAERange([11, "abc", /a/g]);
223
- } catch (X) {
224
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
225
- console.log("AE Range Infringement OK");
226
- console.log(X);
227
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
228
- }
229
-
230
- demo.testAEIndex([11, "abc", "abc"]);
231
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
232
- console.log("AE Index OK");
233
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
234
-
235
- try {
236
- demo.testAEIndex(["11", 12, "/a/g"]);
237
- } catch (X) {
238
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
239
- console.log("AE Index Infringement OK");
240
- console.log(X);
241
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
242
- }
243
-
244
- demo.testGREATER(11);
245
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
246
- console.log("GREATER OK");
247
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
248
-
249
- try {
250
- demo.testGREATER(2);
251
- } catch (X) {
252
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
253
- console.log("GREATER Infringement OK");
254
- console.log(X);
255
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
256
- }
257
-
258
- demo.testGREATER_OR_EQUAL(2);
259
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
260
- console.log("GREATER_OR_EQUAL OK");
261
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
262
-
263
- try {
264
- demo.testGREATER_OR_EQUAL(1);
265
- } catch (X) {
266
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
267
- console.log("GREATER_OR_EQUAL Infringement OK");
268
- console.log(X);
269
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
270
- }
271
-
272
- demo.testLESS(10);
273
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
274
- console.log("LESS OK");
275
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
276
-
277
- try {
278
- demo.testLESS(20);
279
- } catch (X) {
280
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
281
- console.log("LESS Infringement OK");
282
- console.log(X);
283
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
284
- }
285
-
286
- demo.testLESS_OR_EQUAL(20);
287
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
288
- console.log("LESS OK");
289
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
290
-
291
- try {
292
- demo.testLESS_OR_EQUAL(21);
293
- } catch (X) {
294
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
295
- console.log("LESS_OR_EQUAL Infringement OK");
296
- console.log(X);
297
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
298
- }
299
-
300
- demo.testDIFFERENT(21);
301
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
302
- console.log("DIFFERENT OK");
303
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
304
-
305
- try {
306
- demo.testDIFFERENT(20);
307
- } catch (X) {
308
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
309
- console.log("DIFFERENT Infringement OK");
310
- console.log(X);
311
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
312
- }
313
- // #region Inactivity Checks
314
- (
315
- window as unknown as { [key: string]: { DBC: DBC } }
316
- ).WaXCode.DBC.executionSettings.checkPreconditions = false;
317
-
318
- try {
319
- demo.testLESS_OR_EQUAL(21);
320
-
321
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
322
- console.log("INACTIVE PRECONDITIONS OK");
323
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
324
- } catch (X) {
325
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
326
- console.log("INACTIVE PRECONDITIONS FAILED");
327
- console.log(X);
328
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
329
- }
330
-
331
- (
332
- window as unknown as { [key: string]: { DBC: DBC } }
333
- ).WaXCode.DBC.executionSettings.checkPostconditions = false;
334
-
335
- try {
336
- demo.testReturnvalue("qqqqq");
337
-
338
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
339
- console.log("INACTIVE POSTCONDITIONS OK");
340
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
341
- } catch (X) {
342
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
343
- console.log("INACTIVE POSTCONDITIONS FAILED");
344
- console.log(X);
345
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
346
- }
347
-
348
- (
349
- window as unknown as { [key: string]: { DBC: DBC } }
350
- ).WaXCode.DBC.executionSettings.checkInvariants = false;
351
-
352
- try {
353
- demo.testProperty = "b";
354
-
355
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
356
- console.log("INACTIVE INVARIANTS OK");
357
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
358
- } catch (X) {
359
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
360
- console.log("INACTIVE INVARIANTS FAILED");
361
- console.log(X);
362
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
363
- }
364
- // #endregion Inactivity Checks
365
-
366
- // Re-enable all checks for subsequent tests
367
- (
368
- window as unknown as { [key: string]: { DBC: DBC } }
369
- ).WaXCode.DBC.executionSettings.checkPreconditions = true;
370
- (
371
- window as unknown as { [key: string]: { DBC: DBC } }
372
- ).WaXCode.DBC.executionSettings.checkPostconditions = true;
373
- (
374
- window as unknown as { [key: string]: { DBC: DBC } }
375
- ).WaXCode.DBC.executionSettings.checkInvariants = true;
376
-
377
- // #region Static Method Test
378
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
379
- console.log("TESTING STATIC METHOD WITH PARAMVALUEPROVIDER");
380
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
381
-
382
- Demo.testStaticMethod("Hello", 3);
383
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
384
- console.log("STATIC METHOD OK");
385
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
386
-
387
- try {
388
- Demo.testStaticMethod("Hello", "not a number" as unknown as number);
389
- } catch (X) {
390
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
391
- console.log("STATIC METHOD Infringement OK");
392
- console.log(X);
393
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
394
- }
395
-
396
- try {
397
- Demo.testStaticMethod(123 as unknown as string, 5);
398
- } catch (X) {
399
- console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
400
- console.log("STATIC METHOD Infringement (first param) OK");
401
- console.log(X);
402
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
403
- }
404
- // #endregion Static Method Test
1
+ import { z } from "zod";
2
+ import { DBC } from "./DBC";
3
+ import { AE } from "./DBC/AE";
4
+ import { PLAIN_OBJECT } from "./DBC/ARR/PLAIN_OBJECT";
5
+ import { ARRAY } from "./DBC/ARRAY";
6
+ import { GREATER } from "./DBC/COMPARISON/GREATER";
7
+ import { GREATER_OR_EQUAL } from "./DBC/COMPARISON/GREATER_OR_EQUAL";
8
+ import { LESS } from "./DBC/COMPARISON/LESS";
9
+ import { LESS_OR_EQUAL } from "./DBC/COMPARISON/LESS_OR_EQUAL";
10
+ import { DEFINED } from "./DBC/DEFINED";
11
+ import { EQ } from "./DBC/EQ";
12
+ import { DIFFERENT } from "./DBC/EQ/DIFFERENT";
13
+ import { HasAttribute } from "./DBC/HasAttribute";
14
+ import { IF } from "./DBC/IF";
15
+ import { INSTANCE } from "./DBC/INSTANCE";
16
+ import { JSON_OP } from "./DBC/JSON.OP";
17
+ import { JSON_Parse } from "./DBC/JSON.Parse";
18
+ import { OR } from "./DBC/OR";
19
+ import { REGEX } from "./DBC/REGEX";
20
+ import { TYPE } from "./DBC/TYPE";
21
+ import { UNDEFINED } from "./DBC/UNDEFINED";
22
+ import { ZOD } from "./DBC/ZOD";
23
+ /** Demonstrative use of **D**esign **B**y **C**ontract Decorators */
24
+ export class Demo {
25
+ // #region Check Property Decorator
26
+ @REGEX.INVARIANT(/^a$/)
27
+ public testProperty = "a";
28
+ // #endregion Check Property Decorator
29
+ // #region Check Parameter. & Returnvalue Decorator
30
+ @REGEX.POST(/^xxxx.*$/)
31
+ @DBC.ParamvalueProvider
32
+ public testParamvalueAndReturnvalue(@REGEX.PRE(/holla*/g) a: string): string {
33
+ return `xxxx${a}`;
34
+ }
35
+ // #endregion Check Parameter. & Returnvalue Decorator
36
+ // #region Check Returnvalue Decorator
37
+ @REGEX.POST(/^xxxx.*$/)
38
+ public testReturnvalue(a: string): string {
39
+ return a;
40
+ }
41
+ // #endregion Check Returnvalue Decorator
42
+ // #region Check EQ-DBC & Path to property of Parameter-value
43
+ @DBC.ParamvalueProvider
44
+ public testEQAndPath(
45
+ @EQ.PRE("SELECT" as unknown as object, false, "tagName") o: HTMLElement,
46
+ ) {}
47
+ // #endregion Check EQ-DBC & Path to property of Parameter-value
48
+ // #region Check EQ-DBC & Path to property of Parameter-value with Inversion
49
+ @DBC.ParamvalueProvider
50
+ public testEQAndPathWithInversion(
51
+ @EQ.PRE("SELECT" as unknown as object, true, "tagName") o: HTMLElement,
52
+ ) {}
53
+ // #endregion Check EQ-DBC & Path to property of Parameter-value with Inversion
54
+ // #region Check TYPE
55
+ @DBC.ParamvalueProvider
56
+ public testTYPE(@TYPE.PRE("string") o: unknown) {}
57
+ // #endregion Check TYPE
58
+ // #region Check AE
59
+ @DBC.ParamvalueProvider
60
+ public testAE(@AE.PRE([new TYPE("string")]) x: Array<unknown>) {}
61
+ // #endregion Check AE
62
+ // #region Check REGEX with AE
63
+ @DBC.ParamvalueProvider
64
+ public testREGEXWithAE(
65
+ @AE.PRE(new REGEX(/^(?i:(NOW)|([+-]\d+[dmy]))$/i)) x: Array<string>,
66
+ ) {}
67
+ // #endregion Check REGEX with AE
68
+ // #region Check INSTANCE
69
+ @DBC.ParamvalueProvider
70
+ public testINSTANCE(@INSTANCE.PRE(Date) candidate: any): undefined {}
71
+ // #endregion Check INSTANCE
72
+ // #region Check AE Range
73
+ @DBC.ParamvalueProvider
74
+ public testAERange(
75
+ @AE.PRE([new TYPE("string"), new REGEX(/^abc$/)], 1, 2) x: Array<unknown>,
76
+ ) {}
77
+ // #endregion Check AE Range
78
+ // #region Check AE Index
79
+ @DBC.ParamvalueProvider
80
+ public testAEIndex(
81
+ @AE.PRE([new TYPE("string"), new REGEX(/^abc$/)], 1) x: Array<unknown>,
82
+ ) {}
83
+ // #endregion Check AE Index
84
+ // #region Check Comparison
85
+ @DBC.ParamvalueProvider
86
+ public testGREATER(@GREATER.PRE(2) input: number) {}
87
+ @DBC.ParamvalueProvider
88
+ public testGREATER_OR_EQUAL(@GREATER_OR_EQUAL.PRE(2) input: number) {}
89
+ @DBC.ParamvalueProvider
90
+ public testLESS(@LESS.PRE(20) input: number) {}
91
+ @DBC.ParamvalueProvider
92
+ public testLESS_OR_EQUAL(@LESS_OR_EQUAL.PRE(20) input: number) {}
93
+ @DBC.ParamvalueProvider
94
+ public testDIFFERENT(@DIFFERENT.PRE(20) input: number) {}
95
+ // #endregion Check Comparison
96
+ // #region Check ARRAY
97
+ @DBC.ParamvalueProvider
98
+ public testARRAY(@ARRAY.PRE() x: unknown) {}
99
+ // #endregion Check ARRAY
100
+ // #region Check PLAIN_OBJECT
101
+ @DBC.ParamvalueProvider
102
+ public testPLAIN_OBJECT(@PLAIN_OBJECT.PRE() x: unknown) {}
103
+ // #endregion Check PLAIN_OBJECT
104
+ // #region Check DEFINED
105
+ @DBC.ParamvalueProvider
106
+ public testDEFINED(@DEFINED.PRE() x: unknown) {}
107
+ // #endregion Check DEFINED
108
+ // #region Check UNDEFINED
109
+ @DBC.ParamvalueProvider
110
+ public testUNDEFINED(@UNDEFINED.PRE() x: unknown) {}
111
+ // #endregion Check UNDEFINED
112
+ // #region Check HasAttribute
113
+ @DBC.ParamvalueProvider
114
+ public testHasAttribute(@HasAttribute.PRE("data-test") el: HTMLElement) {}
115
+ // #endregion Check HasAttribute
116
+ // #region Check IF
117
+ @DBC.ParamvalueProvider
118
+ public testIF(@IF.PRE(new TYPE("string"), new REGEX(/^hello/)) x: unknown) {}
119
+ // #endregion Check IF
120
+ // #region Check OR
121
+ @DBC.ParamvalueProvider
122
+ public testOR(@OR.PRE([new TYPE("string"), new TYPE("number")]) x: unknown) {}
123
+ // #endregion Check OR
124
+ // #region Check JSON_OP
125
+ @DBC.ParamvalueProvider
126
+ public testJSON_OP(
127
+ @JSON_OP.PRE([{ name: "id", type: "number" }]) x: unknown,
128
+ ) {}
129
+ // #endregion Check JSON_OP
130
+ // #region Check JSON_Parse
131
+ @DBC.ParamvalueProvider
132
+ public testJSON_Parse(@JSON_Parse.PRE((_json) => {}) x: string) {}
133
+ // #endregion Check JSON_Parse
134
+ // #region Check ZOD
135
+ @DBC.ParamvalueProvider
136
+ public testZOD(@ZOD.PRE(z.string()) x: unknown) {}
137
+ // #endregion Check ZOD
138
+ // #region Check Static Method with ParamvalueProvider
139
+ @DBC.ParamvalueProvider
140
+ public static testStaticMethod(
141
+ @TYPE.PRE("string") message: string,
142
+ @TYPE.PRE("number") count: number,
143
+ ): string {
144
+ return `${message} repeated ${count} times`;
145
+ }
146
+ // #endregion Check Static Method with ParamvalueProvider
147
+ }
148
+ const demo = new Demo();
149
+ try {
150
+ demo.testProperty = "abd";
151
+ } catch (X) {
152
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
153
+ console.log("INVARIANT Infringement", "OK");
154
+ console.log(X);
155
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
156
+ }
157
+ demo.testProperty = "a";
158
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
159
+ console.log("INVARIANT OK");
160
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
161
+ demo.testParamvalueAndReturnvalue("holla");
162
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
163
+ console.log("PARAMETER- & RETURNVALUE OK");
164
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
165
+ try {
166
+ demo.testParamvalueAndReturnvalue("yyyy");
167
+ } catch (X) {
168
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
169
+ console.log("PARAMETER- & RETURNVALUE Infringement", "OK");
170
+ console.log(X);
171
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
172
+ }
173
+ demo.testReturnvalue("xxxx");
174
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
175
+ console.log("RETURNVALUE OK");
176
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
177
+ try {
178
+ demo.testReturnvalue("yyyy");
179
+ } catch (X) {
180
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
181
+ console.log("RETURNVALUE Infringement", "OK");
182
+ console.log(X);
183
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
184
+ }
185
+ demo.testEQAndPath(document.createElement("select"));
186
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
187
+ console.log("EQ with Path Infringement OK");
188
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
189
+ try {
190
+ demo.testEQAndPathWithInversion(document.createElement("select"));
191
+ } catch (X) {
192
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
193
+ console.log("EQ with Path and Inversion Infringement OK");
194
+ console.log(X);
195
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
196
+ }
197
+ demo.testTYPE("x");
198
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
199
+ console.log("TYPE OK");
200
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
201
+ try {
202
+ demo.testTYPE(0);
203
+ } catch (X) {
204
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
205
+ console.log("TYPE Infringement OK");
206
+ console.log(X);
207
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
208
+ }
209
+ demo.testAE(["11", "10", "b"]);
210
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
211
+ console.log("AE OK");
212
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
213
+ try {
214
+ demo.testAE(["11", 11, "b"]);
215
+ } catch (X) {
216
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
217
+ console.log("AE Infringement OK");
218
+ console.log(X);
219
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
220
+ }
221
+ demo.testREGEXWithAE(["+1d", "NOW", "-10y"]);
222
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
223
+ console.log("REGEX with AE OK");
224
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
225
+ try {
226
+ demo.testREGEXWithAE(["+1d", "+5d", "-x10y"]);
227
+ } catch (X) {
228
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
229
+ console.log("REGEX with AE Infringement OK");
230
+ console.log(X);
231
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
232
+ }
233
+ demo.testINSTANCE(new Date());
234
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
235
+ console.log("INSTANCE OK");
236
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
237
+ try {
238
+ demo.testINSTANCE(demo);
239
+ } catch (X) {
240
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
241
+ console.log("INSTANCE Infringement OK");
242
+ console.log(X);
243
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
244
+ }
245
+ demo.testAERange([11, "abc", "abc"]);
246
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
247
+ console.log("AE Range OK");
248
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
249
+ try {
250
+ demo.testAERange([11, "abc", /a/g]);
251
+ } catch (X) {
252
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
253
+ console.log("AE Range Infringement OK");
254
+ console.log(X);
255
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
256
+ }
257
+ demo.testAEIndex([11, "abc", "abc"]);
258
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
259
+ console.log("AE Index OK");
260
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
261
+ try {
262
+ demo.testAEIndex(["11", 12, "/a/g"]);
263
+ } catch (X) {
264
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
265
+ console.log("AE Index Infringement OK");
266
+ console.log(X);
267
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
268
+ }
269
+ demo.testGREATER(11);
270
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
271
+ console.log("GREATER OK");
272
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
273
+ try {
274
+ demo.testGREATER(2);
275
+ } catch (X) {
276
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
277
+ console.log("GREATER Infringement OK");
278
+ console.log(X);
279
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
280
+ }
281
+ demo.testGREATER_OR_EQUAL(2);
282
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
283
+ console.log("GREATER_OR_EQUAL OK");
284
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
285
+ try {
286
+ demo.testGREATER_OR_EQUAL(1);
287
+ } catch (X) {
288
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
289
+ console.log("GREATER_OR_EQUAL Infringement OK");
290
+ console.log(X);
291
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
292
+ }
293
+ demo.testLESS(10);
294
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
295
+ console.log("LESS OK");
296
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
297
+ try {
298
+ demo.testLESS(20);
299
+ } catch (X) {
300
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
301
+ console.log("LESS Infringement OK");
302
+ console.log(X);
303
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
304
+ }
305
+ demo.testLESS_OR_EQUAL(20);
306
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
307
+ console.log("LESS OK");
308
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
309
+ try {
310
+ demo.testLESS_OR_EQUAL(21);
311
+ } catch (X) {
312
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
313
+ console.log("LESS_OR_EQUAL Infringement OK");
314
+ console.log(X);
315
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
316
+ }
317
+ demo.testDIFFERENT(21);
318
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
319
+ console.log("DIFFERENT OK");
320
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
321
+ try {
322
+ demo.testDIFFERENT(20);
323
+ } catch (X) {
324
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
325
+ console.log("DIFFERENT Infringement OK");
326
+ console.log(X);
327
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
328
+ }
329
+ // #region Inactivity Checks
330
+ (
331
+ window as unknown as { [key: string]: { DBC: DBC } }
332
+ ).WaXCode.DBC.executionSettings.checkPreconditions = false;
333
+ try {
334
+ demo.testLESS_OR_EQUAL(21);
335
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
336
+ console.log("INACTIVE PRECONDITIONS OK");
337
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
338
+ } catch (X) {
339
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
340
+ console.log("INACTIVE PRECONDITIONS FAILED");
341
+ console.log(X);
342
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
343
+ }
344
+ (
345
+ window as unknown as { [key: string]: { DBC: DBC } }
346
+ ).WaXCode.DBC.executionSettings.checkPostconditions = false;
347
+ try {
348
+ demo.testReturnvalue("qqqqq");
349
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
350
+ console.log("INACTIVE POSTCONDITIONS OK");
351
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
352
+ } catch (X) {
353
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
354
+ console.log("INACTIVE POSTCONDITIONS FAILED");
355
+ console.log(X);
356
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
357
+ }
358
+ (
359
+ window as unknown as { [key: string]: { DBC: DBC } }
360
+ ).WaXCode.DBC.executionSettings.checkInvariants = false;
361
+ try {
362
+ demo.testProperty = "b";
363
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
364
+ console.log("INACTIVE INVARIANTS OK");
365
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
366
+ } catch (X) {
367
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
368
+ console.log("INACTIVE INVARIANTS FAILED");
369
+ console.log(X);
370
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
371
+ }
372
+ // #endregion Inactivity Checks
373
+ // Re-enable all checks for subsequent tests
374
+ (
375
+ window as unknown as { [key: string]: { DBC: DBC } }
376
+ ).WaXCode.DBC.executionSettings.checkPreconditions = true;
377
+ (
378
+ window as unknown as { [key: string]: { DBC: DBC } }
379
+ ).WaXCode.DBC.executionSettings.checkPostconditions = true;
380
+ (
381
+ window as unknown as { [key: string]: { DBC: DBC } }
382
+ ).WaXCode.DBC.executionSettings.checkInvariants = true;
383
+ // #region Static Method Test
384
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
385
+ console.log("TESTING STATIC METHOD WITH PARAMVALUEPROVIDER");
386
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
387
+ Demo.testStaticMethod("Hello", 3);
388
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
389
+ console.log("STATIC METHOD OK");
390
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
391
+ try {
392
+ Demo.testStaticMethod("Hello", "not a number" as unknown as number);
393
+ } catch (X) {
394
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
395
+ console.log("STATIC METHOD Infringement OK");
396
+ console.log(X);
397
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
398
+ }
399
+ try {
400
+ Demo.testStaticMethod(123 as unknown as string, 5);
401
+ } catch (X) {
402
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
403
+ console.log("STATIC METHOD Infringement (first param) OK");
404
+ console.log(X);
405
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
406
+ }
407
+ // #endregion Static Method Test
408
+ demo.testARRAY([1, 2, 3]);
409
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
410
+ console.log("ARRAY OK");
411
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
412
+ try {
413
+ demo.testARRAY("not an array");
414
+ } catch (X) {
415
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
416
+ console.log("ARRAY Infringement OK");
417
+ console.log(X);
418
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
419
+ }
420
+ demo.testPLAIN_OBJECT({ key: "value" });
421
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
422
+ console.log("PLAIN_OBJECT OK");
423
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
424
+ try {
425
+ demo.testPLAIN_OBJECT([1, 2, 3]);
426
+ } catch (X) {
427
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
428
+ console.log("PLAIN_OBJECT Infringement OK");
429
+ console.log(X);
430
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
431
+ }
432
+ demo.testDEFINED("something");
433
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
434
+ console.log("DEFINED OK");
435
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
436
+ try {
437
+ demo.testDEFINED(null);
438
+ } catch (X) {
439
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
440
+ console.log("DEFINED Infringement OK");
441
+ console.log(X);
442
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
443
+ }
444
+ demo.testUNDEFINED(undefined);
445
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
446
+ console.log("UNDEFINED OK");
447
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
448
+ try {
449
+ demo.testUNDEFINED("not undefined");
450
+ } catch (X) {
451
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
452
+ console.log("UNDEFINED Infringement OK");
453
+ console.log(X);
454
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
455
+ }
456
+ const elWithAttr = document.createElement("div");
457
+ elWithAttr.setAttribute("data-test", "");
458
+ demo.testHasAttribute(elWithAttr);
459
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
460
+ console.log("HasAttribute OK");
461
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
462
+ try {
463
+ demo.testHasAttribute(document.createElement("div"));
464
+ } catch (X) {
465
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
466
+ console.log("HasAttribute Infringement OK");
467
+ console.log(X);
468
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
469
+ }
470
+ demo.testIF(42);
471
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
472
+ console.log("IF OK (non-string, condition not triggered)");
473
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
474
+ demo.testIF("helloWorld");
475
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
476
+ console.log("IF OK (string matching regex)");
477
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
478
+ try {
479
+ demo.testIF("world");
480
+ } catch (X) {
481
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
482
+ console.log("IF Infringement OK (string not matching regex)");
483
+ console.log(X);
484
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
485
+ }
486
+ demo.testOR("hello");
487
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
488
+ console.log("OR OK (string)");
489
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
490
+ demo.testOR(42);
491
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
492
+ console.log("OR OK (number)");
493
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
494
+ try {
495
+ demo.testOR(true);
496
+ } catch (X) {
497
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
498
+ console.log("OR Infringement OK");
499
+ console.log(X);
500
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
501
+ }
502
+ demo.testJSON_OP({ id: 1 });
503
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
504
+ console.log("JSON_OP OK");
505
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
506
+ try {
507
+ demo.testJSON_OP({ name: "missing id" });
508
+ } catch (X) {
509
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
510
+ console.log("JSON_OP Infringement OK");
511
+ console.log(X);
512
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
513
+ }
514
+ demo.testJSON_Parse('{"key":"value"}');
515
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
516
+ console.log("JSON_Parse OK");
517
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
518
+ try {
519
+ demo.testJSON_Parse("not valid json{");
520
+ } catch (X) {
521
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
522
+ console.log("JSON_Parse Infringement OK");
523
+ console.log(X);
524
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
525
+ }
526
+ demo.testZOD("hello");
527
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
528
+ console.log("ZOD OK");
529
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
530
+ try {
531
+ demo.testZOD(42);
532
+ } catch (X) {
533
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
534
+ console.log("ZOD Infringement OK");
535
+ console.log(X);
536
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
537
+ }