xdbc 1.0.95 → 1.0.97
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.
- package/.vscode/settings.json +1 -1
- package/README.md +10 -3
- package/dist/DBC/COMPARISON/GREATER.js +6 -7
- package/dist/DBC/COMPARISON/GREATER_OR_EQUAL.js +21 -0
- package/dist/DBC/COMPARISON/LESS.js +21 -0
- package/dist/DBC/COMPARISON/LESS_OR_EQUAL.js +21 -0
- package/dist/DBC/COMPARISON.js +18 -18
- package/dist/Demo.js +24 -1
- package/dist/bundle.js +511 -25
- package/package.json +8 -3
- package/src/DBC/COMPARISON.ts +2 -2
- package/src/DBC/EQ/DIFFERENT.ts +35 -0
- package/src/DBC/HasAttribute.ts +140 -0
- package/src/DBC/IF.ts +147 -0
- package/src/DBC.ts +44 -1
- package/src/Demo.ts +163 -20
- package/webpack.config.js +1 -0
- package/src/DBC/GREATER.ts +0 -150
package/src/Demo.ts
CHANGED
|
@@ -4,6 +4,11 @@ import { EQ } from "./DBC/EQ";
|
|
|
4
4
|
import { TYPE } from "./DBC/TYPE";
|
|
5
5
|
import { AE } from "./DBC/AE";
|
|
6
6
|
import { INSTANCE } from "./DBC/INSTANCE";
|
|
7
|
+
import { GREATER } from "./DBC/COMPARISON/GREATER";
|
|
8
|
+
import { GREATER_OR_EQUAL } from "./DBC/COMPARISON/GREATER_OR_EQUAL";
|
|
9
|
+
import { LESS } from "./DBC/COMPARISON/LESS";
|
|
10
|
+
import { LESS_OR_EQUAL } from "./DBC/COMPARISON/LESS_OR_EQUAL";
|
|
11
|
+
import { DIFFERENT } from "./DBC/EQ/DIFFERENT";
|
|
7
12
|
/** Demonstrative use of **D**esign **B**y **C**ontract Decorators */
|
|
8
13
|
export class Demo {
|
|
9
14
|
// #region Check Property Decorator
|
|
@@ -66,6 +71,22 @@ export class Demo {
|
|
|
66
71
|
@AE.PRE([new TYPE("string"), new REGEX(/^abc$/)], 1) x: Array<unknown>,
|
|
67
72
|
) {}
|
|
68
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
|
|
69
90
|
}
|
|
70
91
|
|
|
71
92
|
const demo = new Demo();
|
|
@@ -76,18 +97,18 @@ try {
|
|
|
76
97
|
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
77
98
|
console.log("INVARIANT Infringement", "OK");
|
|
78
99
|
console.log(X);
|
|
79
|
-
console.log("
|
|
100
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
80
101
|
}
|
|
81
102
|
|
|
82
103
|
demo.testProperty = "a";
|
|
83
104
|
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
84
105
|
console.log("INVARIANT OK");
|
|
85
|
-
console.log("
|
|
106
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
86
107
|
|
|
87
108
|
demo.testParamvalueAndReturnvalue("holla");
|
|
88
109
|
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
89
110
|
console.log("PARAMETER- & RETURNVALUE OK");
|
|
90
|
-
console.log("
|
|
111
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
91
112
|
|
|
92
113
|
try {
|
|
93
114
|
demo.testParamvalueAndReturnvalue("yyyy");
|
|
@@ -95,13 +116,13 @@ try {
|
|
|
95
116
|
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
96
117
|
console.log("PARAMETER- & RETURNVALUE Infringement", "OK");
|
|
97
118
|
console.log(X);
|
|
98
|
-
console.log("
|
|
119
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
99
120
|
}
|
|
100
121
|
|
|
101
122
|
demo.testReturnvalue("xxxx");
|
|
102
123
|
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
103
124
|
console.log("RETURNVALUE OK");
|
|
104
|
-
console.log("
|
|
125
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
105
126
|
|
|
106
127
|
try {
|
|
107
128
|
demo.testReturnvalue("yyyy");
|
|
@@ -109,13 +130,13 @@ try {
|
|
|
109
130
|
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
110
131
|
console.log("RETURNVALUE Infringement", "OK");
|
|
111
132
|
console.log(X);
|
|
112
|
-
console.log("
|
|
133
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
113
134
|
}
|
|
114
135
|
|
|
115
136
|
demo.testEQAndPath(document.createElement("select"));
|
|
116
137
|
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
117
138
|
console.log("EQ with Path Infringement OK");
|
|
118
|
-
console.log("
|
|
139
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
119
140
|
|
|
120
141
|
try {
|
|
121
142
|
demo.testEQAndPathWithInversion(document.createElement("select"));
|
|
@@ -123,13 +144,13 @@ try {
|
|
|
123
144
|
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
124
145
|
console.log("EQ with Path and Inversion Infringement OK");
|
|
125
146
|
console.log(X);
|
|
126
|
-
console.log("
|
|
147
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
127
148
|
}
|
|
128
149
|
|
|
129
150
|
demo.testTYPE("x");
|
|
130
151
|
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
131
152
|
console.log("TYPE OK");
|
|
132
|
-
console.log("
|
|
153
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
133
154
|
|
|
134
155
|
try {
|
|
135
156
|
demo.testTYPE(0);
|
|
@@ -137,13 +158,13 @@ try {
|
|
|
137
158
|
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
138
159
|
console.log("TYPE Infringement OK");
|
|
139
160
|
console.log(X);
|
|
140
|
-
console.log("
|
|
161
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
141
162
|
}
|
|
142
163
|
|
|
143
164
|
demo.testAE(["11", "10", "b"]);
|
|
144
165
|
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
145
166
|
console.log("AE OK");
|
|
146
|
-
console.log("
|
|
167
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
147
168
|
|
|
148
169
|
try {
|
|
149
170
|
demo.testAE(["11", 11, "b"]);
|
|
@@ -151,13 +172,13 @@ try {
|
|
|
151
172
|
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
152
173
|
console.log("AE Infringement OK");
|
|
153
174
|
console.log(X);
|
|
154
|
-
console.log("
|
|
175
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
155
176
|
}
|
|
156
177
|
|
|
157
178
|
demo.testREGEXWithAE(["+1d", "NOW", "-10y"]);
|
|
158
179
|
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
159
180
|
console.log("REGEX with AE OK");
|
|
160
|
-
console.log("
|
|
181
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
161
182
|
|
|
162
183
|
try {
|
|
163
184
|
demo.testREGEXWithAE(["+1d", "+5d", "-x10y"]);
|
|
@@ -165,13 +186,13 @@ try {
|
|
|
165
186
|
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
166
187
|
console.log("REGEX with AE Infringement OK");
|
|
167
188
|
console.log(X);
|
|
168
|
-
console.log("
|
|
189
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
169
190
|
}
|
|
170
191
|
|
|
171
192
|
demo.testINSTANCE(new Date());
|
|
172
193
|
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
173
194
|
console.log("INSTANCE OK");
|
|
174
|
-
console.log("
|
|
195
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
175
196
|
|
|
176
197
|
try {
|
|
177
198
|
demo.testINSTANCE(demo);
|
|
@@ -179,13 +200,13 @@ try {
|
|
|
179
200
|
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
180
201
|
console.log("INSTANCE Infringement OK");
|
|
181
202
|
console.log(X);
|
|
182
|
-
console.log("
|
|
203
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
183
204
|
}
|
|
184
205
|
|
|
185
206
|
demo.testAERange([11, "abc", "abc"]);
|
|
186
207
|
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
187
208
|
console.log("AE Range OK");
|
|
188
|
-
console.log("
|
|
209
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
189
210
|
|
|
190
211
|
try {
|
|
191
212
|
demo.testAERange([11, "abc", /a/g]);
|
|
@@ -193,13 +214,13 @@ try {
|
|
|
193
214
|
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
194
215
|
console.log("AE Range Infringement OK");
|
|
195
216
|
console.log(X);
|
|
196
|
-
console.log("
|
|
217
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
197
218
|
}
|
|
198
219
|
|
|
199
220
|
demo.testAEIndex([11, "abc", "abc"]);
|
|
200
221
|
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
201
222
|
console.log("AE Index OK");
|
|
202
|
-
console.log("
|
|
223
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
203
224
|
|
|
204
225
|
try {
|
|
205
226
|
demo.testAEIndex(["11", 12, "/a/g"]);
|
|
@@ -207,5 +228,127 @@ try {
|
|
|
207
228
|
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
208
229
|
console.log("AE Index Infringement OK");
|
|
209
230
|
console.log(X);
|
|
210
|
-
console.log("
|
|
231
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
demo.testGREATER(11);
|
|
235
|
+
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
236
|
+
console.log("GREATER OK");
|
|
237
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
238
|
+
|
|
239
|
+
try {
|
|
240
|
+
demo.testGREATER(2);
|
|
241
|
+
} catch (X) {
|
|
242
|
+
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
243
|
+
console.log("GREATER Infringement OK");
|
|
244
|
+
console.log(X);
|
|
245
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
demo.testGREATER_OR_EQUAL(2);
|
|
249
|
+
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
250
|
+
console.log("GREATER_OR_EQUAL OK");
|
|
251
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
252
|
+
|
|
253
|
+
try {
|
|
254
|
+
demo.testGREATER_OR_EQUAL(1);
|
|
255
|
+
} catch (X) {
|
|
256
|
+
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
257
|
+
console.log("GREATER_OR_EQUAL Infringement OK");
|
|
258
|
+
console.log(X);
|
|
259
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
demo.testLESS(10);
|
|
263
|
+
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
264
|
+
console.log("LESS OK");
|
|
265
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
266
|
+
|
|
267
|
+
try {
|
|
268
|
+
demo.testLESS(20);
|
|
269
|
+
} catch (X) {
|
|
270
|
+
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
271
|
+
console.log("LESS Infringement OK");
|
|
272
|
+
console.log(X);
|
|
273
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
demo.testLESS_OR_EQUAL(20);
|
|
277
|
+
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
278
|
+
console.log("LESS OK");
|
|
279
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
280
|
+
|
|
281
|
+
try {
|
|
282
|
+
demo.testLESS_OR_EQUAL(21);
|
|
283
|
+
} catch (X) {
|
|
284
|
+
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
285
|
+
console.log("LESS_OR_EQUAL Infringement OK");
|
|
286
|
+
console.log(X);
|
|
287
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
demo.testDIFFERENT(21);
|
|
291
|
+
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
292
|
+
console.log("DIFFERENT OK");
|
|
293
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
294
|
+
|
|
295
|
+
try {
|
|
296
|
+
demo.testDIFFERENT(20);
|
|
297
|
+
} catch (X) {
|
|
298
|
+
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
299
|
+
console.log("DIFFERENT Infringement OK");
|
|
300
|
+
console.log(X);
|
|
301
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
302
|
+
}
|
|
303
|
+
// #region Inactivity Checks
|
|
304
|
+
(
|
|
305
|
+
window as unknown as { [key: string]: { DBC: DBC } }
|
|
306
|
+
).WaXCode.DBC.executionSettings.checkPreconditions = false;
|
|
307
|
+
|
|
308
|
+
try {
|
|
309
|
+
demo.testLESS_OR_EQUAL(21);
|
|
310
|
+
|
|
311
|
+
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
312
|
+
console.log("INACTIVE PRECONDITIONS OK");
|
|
313
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
314
|
+
} catch (X) {
|
|
315
|
+
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
316
|
+
console.log("INACTIVE PRECONDITIONS FAILED");
|
|
317
|
+
console.log(X);
|
|
318
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
(
|
|
322
|
+
window as unknown as { [key: string]: { DBC: DBC } }
|
|
323
|
+
).WaXCode.DBC.executionSettings.checkPostconditions = false;
|
|
324
|
+
|
|
325
|
+
try {
|
|
326
|
+
demo.testReturnvalue("qqqqq");
|
|
327
|
+
|
|
328
|
+
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
329
|
+
console.log("INACTIVE POSTCONDITIONS OK");
|
|
330
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
331
|
+
} catch (X) {
|
|
332
|
+
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
333
|
+
console.log("INACTIVE POSTCONDITIONS FAILED");
|
|
334
|
+
console.log(X);
|
|
335
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
(
|
|
339
|
+
window as unknown as { [key: string]: { DBC: DBC } }
|
|
340
|
+
).WaXCode.DBC.executionSettings.checkInvariants = false;
|
|
341
|
+
|
|
342
|
+
try {
|
|
343
|
+
demo.testProperty = "b";
|
|
344
|
+
|
|
345
|
+
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
346
|
+
console.log("INACTIVE INVARIANTS OK");
|
|
347
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
348
|
+
} catch (X) {
|
|
349
|
+
console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
|
|
350
|
+
console.log("INACTIVE INVARIANTS FAILED");
|
|
351
|
+
console.log(X);
|
|
352
|
+
console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
|
211
353
|
}
|
|
354
|
+
// #endregion Inactivity Checks
|
package/webpack.config.js
CHANGED
package/src/DBC/GREATER.ts
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { DBC } from "../DBC";
|
|
2
|
-
/**
|
|
3
|
-
* A {@link DBC } defining that two {@link object }s gotta be equal.
|
|
4
|
-
*
|
|
5
|
-
* @remarks
|
|
6
|
-
* Maintainer: Callari, Salvatore (XDBC@WaXCode.net) */
|
|
7
|
-
export class GREATER extends DBC {
|
|
8
|
-
// #region Condition checking.
|
|
9
|
-
/**
|
|
10
|
-
* Checks if the value **toCheck** is equal to the specified **equivalent**.
|
|
11
|
-
*
|
|
12
|
-
* @param toCheck The value that has to be equal to it's possible **equivalent** for this {@link DBC } to be fulfilled.
|
|
13
|
-
* @param equivalent The {@link object } the one **toCheck** has to be equal to in order for this {@link DBC } to be
|
|
14
|
-
* fulfilled.
|
|
15
|
-
*
|
|
16
|
-
* @returns TRUE if the value **toCheck** and the **equivalent** are equal to each other, otherwise FALSE. */
|
|
17
|
-
static checkAlgorithm(toCheck, equivalent, equalityPermitted, invert) {
|
|
18
|
-
if (equalityPermitted && !invert && toCheck < equivalent) {
|
|
19
|
-
return `Value has to to be greater than or equal to "${equivalent}"`;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (equalityPermitted && invert && toCheck > equivalent) {
|
|
23
|
-
return `Value must not to be less than or equal to "${equivalent}"`;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (!equalityPermitted && !invert && toCheck <= equivalent) {
|
|
27
|
-
return `Value has to to be greater than "${equivalent}"`;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (!equalityPermitted && invert && toCheck >= equivalent) {
|
|
31
|
-
return `Value must not to be less than "${equivalent}"`;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* A parameter-decorator factory using the {@link GREATER.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
|
|
38
|
-
* by the tagged parameter.
|
|
39
|
-
*
|
|
40
|
-
* @param equivalent See {@link GREATER.checkAlgorithm }.
|
|
41
|
-
* @param equalityPermitted See {@link GREATER.checkAlgorithm }.
|
|
42
|
-
* @param path See {@link DBC.decPrecondition }.
|
|
43
|
-
* @param dbc See {@link DBC.decPrecondition }.
|
|
44
|
-
*
|
|
45
|
-
* @returns See {@link DBC.decPrecondition }. */
|
|
46
|
-
static PRE(
|
|
47
|
-
equivalent,
|
|
48
|
-
equalityPermitted = false,
|
|
49
|
-
invert = false,
|
|
50
|
-
path: string = undefined,
|
|
51
|
-
dbc = "WaXCode.DBC",
|
|
52
|
-
) {
|
|
53
|
-
return DBC.decPrecondition(
|
|
54
|
-
(value, target, methodName, parameterIndex) => {
|
|
55
|
-
return GREATER.checkAlgorithm(
|
|
56
|
-
value,
|
|
57
|
-
equivalent,
|
|
58
|
-
equalityPermitted,
|
|
59
|
-
invert,
|
|
60
|
-
);
|
|
61
|
-
},
|
|
62
|
-
dbc,
|
|
63
|
-
path,
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* A method-decorator factory using the {@link GREATER.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
|
|
68
|
-
* by the tagged method's returnvalue.
|
|
69
|
-
*
|
|
70
|
-
* @param equivalent See {@link GREATER.checkAlgorithm }.
|
|
71
|
-
* @param equalityPermitted See {@link GREATER.checkAlgorithm }.
|
|
72
|
-
* @param path See {@link DBC.Postcondition }.
|
|
73
|
-
* @param dbc See {@link DBC.decPostcondition }.
|
|
74
|
-
*
|
|
75
|
-
* @returns See {@link DBC.decPostcondition }. */
|
|
76
|
-
static POST(
|
|
77
|
-
equivalent,
|
|
78
|
-
equalityPermitted = false,
|
|
79
|
-
invert = false,
|
|
80
|
-
path: string = undefined,
|
|
81
|
-
dbc = "WaXCode.DBC",
|
|
82
|
-
) {
|
|
83
|
-
return DBC.decPostcondition(
|
|
84
|
-
(value, target, propertyKey) => {
|
|
85
|
-
return GREATER.checkAlgorithm(
|
|
86
|
-
value,
|
|
87
|
-
equalityPermitted,
|
|
88
|
-
equivalent,
|
|
89
|
-
invert,
|
|
90
|
-
);
|
|
91
|
-
},
|
|
92
|
-
dbc,
|
|
93
|
-
path,
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* A field-decorator factory using the {@link GREATER.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
|
|
98
|
-
* by the tagged field.
|
|
99
|
-
*
|
|
100
|
-
* @param equivalent See {@link GREATER.checkAlgorithm }.
|
|
101
|
-
* @param equalityPermitted See {@link GREATER.checkAlgorithm }.
|
|
102
|
-
* @param path See {@link DBC.decInvariant }.
|
|
103
|
-
* @param dbc See {@link DBC.decInvariant }.
|
|
104
|
-
*
|
|
105
|
-
* @returns See {@link DBC.decInvariant }. */
|
|
106
|
-
static INVARIANT(
|
|
107
|
-
equivalent,
|
|
108
|
-
equalityPermitted = false,
|
|
109
|
-
invert = false,
|
|
110
|
-
path: string = undefined,
|
|
111
|
-
dbc = "WaXCode.DBC",
|
|
112
|
-
) {
|
|
113
|
-
return DBC.decInvariant(
|
|
114
|
-
[new GREATER(equivalent, equalityPermitted, invert)],
|
|
115
|
-
path,
|
|
116
|
-
dbc,
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
// #endregion Condition checking.
|
|
120
|
-
// #region Referenced Condition checking.
|
|
121
|
-
// #region Dynamic usage.
|
|
122
|
-
/**
|
|
123
|
-
* Invokes the {@link GREATER.checkAlgorithm } passing the value **toCheck**, {@link GREATER.equivalent } and {@link GREATER.invert }.
|
|
124
|
-
*
|
|
125
|
-
* @param toCheck See {@link GREATER.checkAlgorithm }.
|
|
126
|
-
*
|
|
127
|
-
* @returns See {@link GREATER.checkAlgorithm}. */
|
|
128
|
-
public check(toCheck) {
|
|
129
|
-
return GREATER.checkAlgorithm(
|
|
130
|
-
toCheck,
|
|
131
|
-
this.equivalent,
|
|
132
|
-
this.equalityPermitted,
|
|
133
|
-
this.invert,
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Creates this {@link GREATER } by setting the protected property {@link GREATER.equivalent }, {@link GREATER.equalityPermitted } and {@link GREATER.invert } used by {@link GREATER.check }.
|
|
138
|
-
*
|
|
139
|
-
* @param equivalent See {@link GREATER.check }.
|
|
140
|
-
* @param equalityPermitted See {@link GREATER.check }.
|
|
141
|
-
* @param invert See {@link GREATER.check }. */
|
|
142
|
-
constructor(
|
|
143
|
-
public equivalent,
|
|
144
|
-
public equalityPermitted = false,
|
|
145
|
-
public invert = false,
|
|
146
|
-
) {
|
|
147
|
-
super();
|
|
148
|
-
}
|
|
149
|
-
// #endregion Dynamic usage.
|
|
150
|
-
}
|