@everyonesoftware/common 2.0.0 → 4.0.0
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/outputs/chunk-AY3YWKOM.js +7741 -0
- package/outputs/chunk-AY3YWKOM.js.map +1 -0
- package/outputs/sources.cjs +9007 -0
- package/outputs/sources.cjs.map +1 -0
- package/outputs/sources.d.cts +4082 -0
- package/outputs/sources.d.ts +4082 -0
- package/outputs/sources.js +1370 -0
- package/outputs/sources.js.map +1 -0
- package/outputs/tests.cjs +17208 -0
- package/outputs/tests.cjs.map +1 -0
- package/outputs/tests.d.cts +3 -0
- package/outputs/tests.d.ts +3 -0
- package/outputs/tests.js +9798 -0
- package/outputs/tests.js.map +1 -0
- package/package.json +11 -2
- package/.c8rc.json +0 -12
- package/.github/workflows/publish.yml +0 -36
- package/.mocharc.json +0 -9
- package/sources/assertMessageParameters.ts +0 -22
- package/sources/asyncIterator.ts +0 -437
- package/sources/asyncIteratorToJavascriptAsyncIteratorAdapter.ts +0 -48
- package/sources/asyncResult.ts +0 -95
- package/sources/basicDisposable.ts +0 -57
- package/sources/byteList.ts +0 -202
- package/sources/byteListStream.ts +0 -121
- package/sources/byteReadStream.ts +0 -24
- package/sources/byteWriteStream.ts +0 -16
- package/sources/bytes.ts +0 -25
- package/sources/characterList.ts +0 -195
- package/sources/characterListStream.ts +0 -151
- package/sources/characterReadStream.ts +0 -81
- package/sources/characterReadStreamIterator.ts +0 -128
- package/sources/characterWriteStream.ts +0 -45
- package/sources/commandLineParameter.ts +0 -45
- package/sources/commandLineParameters.ts +0 -21
- package/sources/comparable.ts +0 -144
- package/sources/comparer.ts +0 -133
- package/sources/comparison.ts +0 -20
- package/sources/concatenateIterable.ts +0 -119
- package/sources/concatenateIterator.ts +0 -165
- package/sources/condition.ts +0 -329
- package/sources/currentProcess.ts +0 -158
- package/sources/dateTime.ts +0 -130
- package/sources/depthFirstSearch.ts +0 -230
- package/sources/disposable.ts +0 -31
- package/sources/emptyError.ts +0 -10
- package/sources/english.ts +0 -45
- package/sources/equalFunctions.ts +0 -123
- package/sources/fetchHttpClient.ts +0 -89
- package/sources/fetchHttpResponse.ts +0 -106
- package/sources/flatMapIterable.ts +0 -104
- package/sources/flatMapIterator.ts +0 -152
- package/sources/generator.ts +0 -251
- package/sources/httpClient.ts +0 -36
- package/sources/httpHeader.ts +0 -37
- package/sources/httpHeaders.ts +0 -216
- package/sources/httpIncomingRequest.ts +0 -30
- package/sources/httpIncomingResponse.ts +0 -19
- package/sources/httpMethod.ts +0 -164
- package/sources/httpOutgoingRequest.ts +0 -119
- package/sources/httpOutgoingResponse.ts +0 -113
- package/sources/httpServer.ts +0 -34
- package/sources/inMemoryCharacterWriteStream.ts +0 -78
- package/sources/index.ts +0 -101
- package/sources/iterable.ts +0 -345
- package/sources/iterator.ts +0 -481
- package/sources/iteratorToJavascriptIteratorAdapter.ts +0 -48
- package/sources/javascript.ts +0 -59
- package/sources/javascriptArrayList.ts +0 -175
- package/sources/javascriptAsyncIteratorToAsyncIteratorAdapter.ts +0 -124
- package/sources/javascriptIteratorToIteratorAdapter.ts +0 -133
- package/sources/javascriptMapMap.ts +0 -143
- package/sources/javascriptSetSet.ts +0 -134
- package/sources/list.ts +0 -330
- package/sources/listQueue.ts +0 -62
- package/sources/listStack.ts +0 -62
- package/sources/luxonDateTime.ts +0 -109
- package/sources/map.ts +0 -302
- package/sources/mapAsyncIterator.ts +0 -141
- package/sources/mapIterable.ts +0 -105
- package/sources/mapIterator.ts +0 -145
- package/sources/mutableCondition.ts +0 -451
- package/sources/mutableHttpHeaders.ts +0 -204
- package/sources/mutableMap.ts +0 -292
- package/sources/network.ts +0 -18
- package/sources/node.ts +0 -37
- package/sources/nodeJSCharacterWriteStream.ts +0 -42
- package/sources/nodeJSHttpIncomingRequest.ts +0 -132
- package/sources/nodeJSHttpServer.ts +0 -134
- package/sources/notFoundError.ts +0 -12
- package/sources/postCondition.ts +0 -284
- package/sources/postConditionError.ts +0 -12
- package/sources/preCondition.ts +0 -284
- package/sources/preConditionError.ts +0 -12
- package/sources/promiseAsyncResult.ts +0 -174
- package/sources/property.ts +0 -63
- package/sources/queue.ts +0 -49
- package/sources/realNetwork.ts +0 -28
- package/sources/recreationDotGovClient.ts +0 -259
- package/sources/searchControl.ts +0 -42
- package/sources/set.ts +0 -244
- package/sources/skipAsyncIterator.ts +0 -145
- package/sources/skipIterator.ts +0 -155
- package/sources/stack.ts +0 -48
- package/sources/stringComparer.ts +0 -33
- package/sources/stringIterator.ts +0 -149
- package/sources/strings.ts +0 -322
- package/sources/syncResult.ts +0 -300
- package/sources/takeAsyncIterator.ts +0 -141
- package/sources/takeIterator.ts +0 -151
- package/sources/toStringFunctions.ts +0 -185
- package/sources/types.ts +0 -371
- package/sources/whereAsyncIterator.ts +0 -143
- package/sources/whereIterable.ts +0 -108
- package/sources/whereIterator.ts +0 -157
- package/sources/wonderlandTrailClient.ts +0 -1503
- package/tests/assertTest.ts +0 -113
- package/tests/assertTestTests.ts +0 -75
- package/tests/basicTestSkip.ts +0 -51
- package/tests/byteListStreamTests.ts +0 -390
- package/tests/byteListTests.ts +0 -27
- package/tests/bytesTests.ts +0 -43
- package/tests/characterListStreamTests.ts +0 -391
- package/tests/characterListTests.ts +0 -250
- package/tests/characterWriteStreamTests.ts +0 -12
- package/tests/comparerTests.ts +0 -92
- package/tests/conditionTests.ts +0 -877
- package/tests/consoleTestRunner.ts +0 -404
- package/tests/consoleTestRunnerTests.ts +0 -651
- package/tests/dateTimeTests.ts +0 -30
- package/tests/depthFirstSearchTests.ts +0 -106
- package/tests/disposableTests.ts +0 -121
- package/tests/englishTests.ts +0 -103
- package/tests/equalFunctionsTests.ts +0 -223
- package/tests/failedTest.ts +0 -43
- package/tests/fetchHttpClientTests.ts +0 -33
- package/tests/generatorTests.ts +0 -86
- package/tests/httpClientTests.ts +0 -18
- package/tests/inMemoryCharacterWriteStreamTests.ts +0 -117
- package/tests/iterableTests.ts +0 -141
- package/tests/iteratorTests.ts +0 -1086
- package/tests/javascriptMapMapTests.ts +0 -21
- package/tests/listTests.ts +0 -338
- package/tests/mapIteratorTests.ts +0 -55
- package/tests/mapTests.ts +0 -104
- package/tests/mutableConditionTests.ts +0 -273
- package/tests/mutableMapTests.ts +0 -154
- package/tests/nodeJSHttpServerTests.ts +0 -75
- package/tests/notFoundErrorTests.ts +0 -24
- package/tests/postConditionErrorTests.ts +0 -24
- package/tests/preConditionErrorTests.ts +0 -24
- package/tests/promiseAsyncResultTests.ts +0 -688
- package/tests/propertyTests.ts +0 -63
- package/tests/queueTests.ts +0 -29
- package/tests/recreationDotGovClientTests.ts +0 -191
- package/tests/setTests.ts +0 -140
- package/tests/skippedTest.ts +0 -39
- package/tests/stackTests.ts +0 -66
- package/tests/stringComparerTests.ts +0 -60
- package/tests/stringIteratorTests.ts +0 -156
- package/tests/stringsTests.ts +0 -516
- package/tests/syncResultTests.ts +0 -1251
- package/tests/test.ts +0 -228
- package/tests/testAction.ts +0 -75
- package/tests/testActionTests.ts +0 -93
- package/tests/testFailureTests.ts +0 -12
- package/tests/testRunner.ts +0 -267
- package/tests/testRunnerTests.ts +0 -895
- package/tests/testSkip.ts +0 -34
- package/tests/tests.ts +0 -103
- package/tests/toStringFunctionsTests.ts +0 -55
- package/tests/typesTests.ts +0 -257
- package/tests/whereIteratorTests.ts +0 -77
- package/tests/wonderlandTrailClientTests.ts +0 -452
- package/tsconfig.json +0 -20
- package/tsup.config.ts +0 -13
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
import { CharacterList } from "../sources/characterList";
|
|
2
|
-
import { EqualFunctions } from "../sources/equalFunctions";
|
|
3
|
-
import { JavascriptIterable } from "../sources/javascript";
|
|
4
|
-
import { NotFoundError } from "../sources/notFoundError";
|
|
5
|
-
import { PreConditionError } from "../sources/preConditionError";
|
|
6
|
-
import { isNumber, isString } from "../sources/types";
|
|
7
|
-
import { Test } from "./test";
|
|
8
|
-
import { TestRunner } from "./testRunner";
|
|
9
|
-
|
|
10
|
-
export function test(runner: TestRunner): void
|
|
11
|
-
{
|
|
12
|
-
runner.testFile("characterList.ts", () =>
|
|
13
|
-
{
|
|
14
|
-
runner.testType("CharacterList", () =>
|
|
15
|
-
{
|
|
16
|
-
runner.testFunction("create()", () =>
|
|
17
|
-
{
|
|
18
|
-
runner.test("with no arguments", (test: Test) =>
|
|
19
|
-
{
|
|
20
|
-
const list: CharacterList = CharacterList.create();
|
|
21
|
-
test.assertNotUndefinedAndNotNull(list);
|
|
22
|
-
test.assertEqual(0, list.getCount().await());
|
|
23
|
-
test.assertFalse(list.any().await());
|
|
24
|
-
test.assertEqual([], list.toArray().await());
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
runner.test("with undefined", (test: Test) =>
|
|
28
|
-
{
|
|
29
|
-
const list: CharacterList = CharacterList.create(undefined);
|
|
30
|
-
test.assertNotUndefinedAndNotNull(list);
|
|
31
|
-
test.assertEqual(0, list.getCount().await());
|
|
32
|
-
test.assertFalse(list.any().await());
|
|
33
|
-
test.assertEqual([], list.toArray().await());
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
runner.test("with null", (test: Test) =>
|
|
37
|
-
{
|
|
38
|
-
const list: CharacterList = CharacterList.create(null!);
|
|
39
|
-
test.assertNotUndefinedAndNotNull(list);
|
|
40
|
-
test.assertEqual(0, list.getCount().await());
|
|
41
|
-
test.assertFalse(list.any().await());
|
|
42
|
-
test.assertEqual([], list.toArray().await());
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
runner.test("with empty initialValues", (test: Test) =>
|
|
46
|
-
{
|
|
47
|
-
const list: CharacterList = CharacterList.create([]);
|
|
48
|
-
test.assertNotUndefinedAndNotNull(list);
|
|
49
|
-
test.assertEqual(0, list.getCount().await());
|
|
50
|
-
test.assertFalse(list.any().await());
|
|
51
|
-
test.assertEqual([], list.toArray().await());
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
runner.test("with one value", (test: Test) =>
|
|
55
|
-
{
|
|
56
|
-
const list: CharacterList = CharacterList.create(["m"]);
|
|
57
|
-
test.assertNotUndefinedAndNotNull(list);
|
|
58
|
-
test.assertEqual(1, list.getCount().await());
|
|
59
|
-
test.assertTrue(list.any().await());
|
|
60
|
-
test.assertEqual(["m"], list.toArray().await());
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
runner.test("with two values", (test: Test) =>
|
|
64
|
-
{
|
|
65
|
-
const list: CharacterList = CharacterList.create(["n", "l"]);
|
|
66
|
-
test.assertNotUndefinedAndNotNull(list);
|
|
67
|
-
test.assertEqual(2, list.getCount().await());
|
|
68
|
-
test.assertTrue(list.any().await());
|
|
69
|
-
test.assertEqual(["n", "l"], list.toArray().await());
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
runner.testFunction("add()", () =>
|
|
74
|
-
{
|
|
75
|
-
function addErrorTest(value: string, expected: Error): void
|
|
76
|
-
{
|
|
77
|
-
runner.test(`with ${runner.toString(value)}`, (test: Test) =>
|
|
78
|
-
{
|
|
79
|
-
const list: CharacterList = CharacterList.create();
|
|
80
|
-
test.assertThrows(() => list.add(value), expected);
|
|
81
|
-
test.assertEqual([], list.toArray().await());
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
addErrorTest("", new PreConditionError(
|
|
86
|
-
"Expression: value",
|
|
87
|
-
"Expected: character",
|
|
88
|
-
"Actual: \"\"",
|
|
89
|
-
));
|
|
90
|
-
addErrorTest("ab", new PreConditionError(
|
|
91
|
-
"Expression: value",
|
|
92
|
-
"Expected: character",
|
|
93
|
-
"Actual: \"ab\"",
|
|
94
|
-
));
|
|
95
|
-
|
|
96
|
-
runner.test("with valid value", (test: Test) =>
|
|
97
|
-
{
|
|
98
|
-
const list: CharacterList = CharacterList.create();
|
|
99
|
-
|
|
100
|
-
const addResult1: CharacterList = list.add("a");
|
|
101
|
-
test.assertSame(list, addResult1);
|
|
102
|
-
test.assertEqual(["a"], addResult1.toArray().await());
|
|
103
|
-
|
|
104
|
-
const addResult2: CharacterList = list.add("b");
|
|
105
|
-
test.assertSame(list, addResult2);
|
|
106
|
-
test.assertEqual(["a", "b"], addResult2.toArray().await());
|
|
107
|
-
|
|
108
|
-
const addResult3: CharacterList = list.add("c");
|
|
109
|
-
test.assertSame(list, addResult3);
|
|
110
|
-
test.assertEqual(["a", "b", "c"], addResult3.toArray().await());
|
|
111
|
-
|
|
112
|
-
const addResult4: CharacterList = list.add("d");
|
|
113
|
-
test.assertSame(list, addResult4);
|
|
114
|
-
test.assertEqual(["a", "b", "c", "d"], addResult4.toArray().await());
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
runner.testFunction("addAll()", () =>
|
|
119
|
-
{
|
|
120
|
-
runner.test("with empty values", (test: Test) =>
|
|
121
|
-
{
|
|
122
|
-
const list: CharacterList = CharacterList.create();
|
|
123
|
-
|
|
124
|
-
const addAllResult: CharacterList = list.addAll([]);
|
|
125
|
-
test.assertSame(list, addAllResult);
|
|
126
|
-
test.assertEqual([], list.toArray().await());
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
runner.test("with non-empty values", (test: Test) =>
|
|
130
|
-
{
|
|
131
|
-
const list: CharacterList = CharacterList.create();
|
|
132
|
-
|
|
133
|
-
const addAllResult: CharacterList = list.addAll("abcde");
|
|
134
|
-
test.assertSame(list, addAllResult);
|
|
135
|
-
test.assertEqual(["a", "b", "c", "d", "e"], list.toArray().await());
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
runner.testFunction("insert()", () =>
|
|
140
|
-
{
|
|
141
|
-
function insertErrorTest(initialValues: string[], index: number, value: string, expected: Error): void
|
|
142
|
-
{
|
|
143
|
-
runner.test(`with ${runner.andList([initialValues, index, value])}`, (test: Test) =>
|
|
144
|
-
{
|
|
145
|
-
const list: CharacterList = CharacterList.create(initialValues);
|
|
146
|
-
test.assertThrows(() => list.insert(index, value), expected);
|
|
147
|
-
test.assertEqual(initialValues, list.toArray().await());
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
insertErrorTest([], -1, "a", new PreConditionError(
|
|
152
|
-
"Expression: index",
|
|
153
|
-
"Expected: 0",
|
|
154
|
-
"Actual: -1",
|
|
155
|
-
));
|
|
156
|
-
insertErrorTest([], 1, "a", new PreConditionError(
|
|
157
|
-
"Expression: index",
|
|
158
|
-
"Expected: 0",
|
|
159
|
-
"Actual: 1",
|
|
160
|
-
));
|
|
161
|
-
insertErrorTest(["z"], -1, "a", new PreConditionError(
|
|
162
|
-
"Expression: index",
|
|
163
|
-
"Expected: between 0 and 1",
|
|
164
|
-
"Actual: -1",
|
|
165
|
-
));
|
|
166
|
-
insertErrorTest(["z"], 2, "a", new PreConditionError(
|
|
167
|
-
"Expression: index",
|
|
168
|
-
"Expected: between 0 and 1",
|
|
169
|
-
"Actual: 2",
|
|
170
|
-
));
|
|
171
|
-
insertErrorTest([], 0, "", new PreConditionError(
|
|
172
|
-
"Expression: value",
|
|
173
|
-
"Expected: character",
|
|
174
|
-
"Actual: \"\"",
|
|
175
|
-
));
|
|
176
|
-
insertErrorTest([], 0, "ab", new PreConditionError(
|
|
177
|
-
"Expression: value",
|
|
178
|
-
"Expected: character",
|
|
179
|
-
"Actual: \"ab\"",
|
|
180
|
-
));
|
|
181
|
-
|
|
182
|
-
function insertTest(initialValues: JavascriptIterable<string>, index: number, value: string, expected: string[]): void
|
|
183
|
-
{
|
|
184
|
-
runner.test(`with ${runner.andList([initialValues, index, value])}`, (test: Test) =>
|
|
185
|
-
{
|
|
186
|
-
const list: CharacterList = CharacterList.create(initialValues);
|
|
187
|
-
|
|
188
|
-
const insertResult: CharacterList = list.insert(index, value);
|
|
189
|
-
test.assertSame(list, insertResult);
|
|
190
|
-
test.assertEqual(expected, list.toArray().await());
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
insertTest([], 0, "z", ["z"]);
|
|
195
|
-
insertTest(["a"], 0, "y", ["y", "a"]);
|
|
196
|
-
insertTest(["a"], 1, "y", ["a", "y"]);
|
|
197
|
-
insertTest(["a", "b", "c"], 0, "z", ["z", "a", "b", "c"]);
|
|
198
|
-
insertTest(["a", "b", "c"], 1, "z", ["a", "z", "b", "c"]);
|
|
199
|
-
insertTest(["a", "b", "c"], 2, "z", ["a", "b", "z", "c"]);
|
|
200
|
-
insertTest(["a", "b", "c"], 3, "z", ["a", "b", "c", "z"]);
|
|
201
|
-
insertTest(["a", "b", "c", "d", "e"], 2, "z", ["a", "b", "z", "c", "d", "e"]);
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
runner.testFunction("remove()", () =>
|
|
205
|
-
{
|
|
206
|
-
runner.test("with not-found value", (test: Test) =>
|
|
207
|
-
{
|
|
208
|
-
const list: CharacterList = CharacterList.create();
|
|
209
|
-
|
|
210
|
-
test.assertThrows(() => list.remove("a").await(), new NotFoundError("Could not find the value to remove: \"a\""));
|
|
211
|
-
test.assertEqual([], list.toArray().await());
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
runner.test("with found value", (test: Test) =>
|
|
215
|
-
{
|
|
216
|
-
const list: CharacterList = CharacterList.create(["a"]);
|
|
217
|
-
|
|
218
|
-
const removeResult: string = list.remove("a").await();
|
|
219
|
-
test.assertEqual("a", removeResult);
|
|
220
|
-
test.assertEqual([], list.toArray().await());
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
runner.test("with multiple found values", (test: Test) =>
|
|
224
|
-
{
|
|
225
|
-
const list: CharacterList = CharacterList.create(["a", "a", "a"]);
|
|
226
|
-
|
|
227
|
-
const removeResult: string = list.remove("a").await();
|
|
228
|
-
test.assertEqual("a", removeResult);
|
|
229
|
-
test.assertEqual(["a", "a"], list.toArray().await());
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
runner.test("with multiple found values and equalFunctions", (test: Test) =>
|
|
233
|
-
{
|
|
234
|
-
const list: CharacterList = CharacterList.create(["a", "b", "c", "d", "e"]);
|
|
235
|
-
const isVowel = (character: string) => ["a", "e", "i", "o", "u"].includes(character);
|
|
236
|
-
const equalFunctions: EqualFunctions = EqualFunctions.create()
|
|
237
|
-
.add((left: unknown, right: unknown) =>
|
|
238
|
-
{
|
|
239
|
-
return isString(left) && isString(right)
|
|
240
|
-
? isVowel(left) === isVowel(right)
|
|
241
|
-
: undefined;
|
|
242
|
-
});
|
|
243
|
-
const removeResult: string = list.remove("i", equalFunctions).await();
|
|
244
|
-
test.assertEqual("a", removeResult);
|
|
245
|
-
test.assertEqual(["b", "c", "d", "e"], list.toArray().await());
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
});
|
|
249
|
-
});
|
|
250
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { CharacterWriteStream } from "../sources/characterWriteStream";
|
|
2
|
-
import { TestRunner } from "./testRunner";
|
|
3
|
-
|
|
4
|
-
export function test(runner: TestRunner, creator: () => CharacterWriteStream): void
|
|
5
|
-
{
|
|
6
|
-
runner.testFile("characterWriteStream.ts", () =>
|
|
7
|
-
{
|
|
8
|
-
runner.testType("CharacterWriteStream", () =>
|
|
9
|
-
{
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
}
|
package/tests/comparerTests.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { Comparer } from "../sources/comparer";
|
|
2
|
-
import { Comparison } from "../sources/comparison";
|
|
3
|
-
import { Test } from "./test";
|
|
4
|
-
import { TestRunner } from "./testRunner";
|
|
5
|
-
|
|
6
|
-
export function test(runner: TestRunner): void
|
|
7
|
-
{
|
|
8
|
-
runner.testFile("comparer.ts", () =>
|
|
9
|
-
{
|
|
10
|
-
runner.testType("Comparer<TLeft,TRight>", () =>
|
|
11
|
-
{
|
|
12
|
-
runner.testFunction("compareSameUndefinedNull()", () =>
|
|
13
|
-
{
|
|
14
|
-
function compareSameUndefinedNullTest(left: unknown, right: unknown, expected: Comparison | undefined): void
|
|
15
|
-
{
|
|
16
|
-
runner.test(`with ${runner.andList([left, right])}`, (test: Test) =>
|
|
17
|
-
{
|
|
18
|
-
test.assertEqual(Comparer.compareSameUndefinedNull(left, right), expected);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
compareSameUndefinedNullTest(undefined, undefined, Comparison.Equal);
|
|
23
|
-
compareSameUndefinedNullTest(undefined, null, Comparison.LessThan);
|
|
24
|
-
compareSameUndefinedNullTest(undefined, "hello", Comparison.LessThan);
|
|
25
|
-
compareSameUndefinedNullTest(undefined, 50, Comparison.LessThan);
|
|
26
|
-
|
|
27
|
-
compareSameUndefinedNullTest(null, undefined, Comparison.GreaterThan);
|
|
28
|
-
compareSameUndefinedNullTest(null, null, Comparison.Equal);
|
|
29
|
-
compareSameUndefinedNullTest(null, "hello", Comparison.LessThan);
|
|
30
|
-
compareSameUndefinedNullTest(null, 50, Comparison.LessThan);
|
|
31
|
-
|
|
32
|
-
compareSameUndefinedNullTest("hello", undefined, Comparison.GreaterThan);
|
|
33
|
-
compareSameUndefinedNullTest("hello", null, Comparison.GreaterThan);
|
|
34
|
-
compareSameUndefinedNullTest("hello", "hello", Comparison.Equal);
|
|
35
|
-
compareSameUndefinedNullTest("hello", "abc", undefined);
|
|
36
|
-
compareSameUndefinedNullTest("hello", 50, undefined);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
runner.testFunction("equalSameUndefinedNull()", () =>
|
|
40
|
-
{
|
|
41
|
-
function equalSameUndefinedNullTest(left: unknown, right: unknown, expected: boolean | undefined): void
|
|
42
|
-
{
|
|
43
|
-
runner.test(`with ${runner.andList([left, right])}`, (test: Test) =>
|
|
44
|
-
{
|
|
45
|
-
test.assertEqual(Comparer.equalSameUndefinedNull(left, right), expected);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
equalSameUndefinedNullTest(undefined, undefined, true);
|
|
50
|
-
equalSameUndefinedNullTest(undefined, null, false);
|
|
51
|
-
equalSameUndefinedNullTest(undefined, "hello", false);
|
|
52
|
-
equalSameUndefinedNullTest(undefined, 50, false);
|
|
53
|
-
|
|
54
|
-
equalSameUndefinedNullTest(null, undefined, false);
|
|
55
|
-
equalSameUndefinedNullTest(null, null, true);
|
|
56
|
-
equalSameUndefinedNullTest(null, "hello", false);
|
|
57
|
-
equalSameUndefinedNullTest(null, 50, false);
|
|
58
|
-
|
|
59
|
-
equalSameUndefinedNullTest("hello", undefined, false);
|
|
60
|
-
equalSameUndefinedNullTest("hello", null, false);
|
|
61
|
-
equalSameUndefinedNullTest("hello", "hello", true);
|
|
62
|
-
equalSameUndefinedNullTest("hello", "abc", undefined);
|
|
63
|
-
equalSameUndefinedNullTest("hello", 50, undefined);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
runner.testFunction("compareNumbers()", () =>
|
|
67
|
-
{
|
|
68
|
-
function compareNumbersTest(left: number | null | undefined, right: number | null | undefined, expected: Comparison | undefined): void
|
|
69
|
-
{
|
|
70
|
-
runner.test(`with ${runner.andList([left, right])}`, (test: Test) =>
|
|
71
|
-
{
|
|
72
|
-
test.assertEqual(Comparer.compareNumbers(left, right), expected);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
compareNumbersTest(undefined, undefined, Comparison.Equal);
|
|
77
|
-
compareNumbersTest(undefined, null, Comparison.LessThan);
|
|
78
|
-
compareNumbersTest(undefined, 50, Comparison.LessThan);
|
|
79
|
-
|
|
80
|
-
compareNumbersTest(null, undefined, Comparison.GreaterThan);
|
|
81
|
-
compareNumbersTest(null, null, Comparison.Equal);
|
|
82
|
-
compareNumbersTest(null, 50, Comparison.LessThan);
|
|
83
|
-
|
|
84
|
-
compareNumbersTest(50, undefined, Comparison.GreaterThan);
|
|
85
|
-
compareNumbersTest(50, null, Comparison.GreaterThan);
|
|
86
|
-
compareNumbersTest(50, 30, Comparison.GreaterThan);
|
|
87
|
-
compareNumbersTest(50, 50, Comparison.Equal);
|
|
88
|
-
compareNumbersTest(50, 60, Comparison.LessThan);
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
}
|