@everyonesoftware/common 1.0.0 → 3.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/.github/workflows/publish.yml +54 -38
- package/package.json +9 -2
- package/sources/asyncIterator.ts +436 -436
- package/sources/asyncIteratorToJavascriptAsyncIteratorAdapter.ts +47 -47
- package/sources/asyncResult.ts +95 -95
- package/sources/byteList.ts +201 -201
- package/sources/byteListStream.ts +120 -120
- package/sources/byteReadStream.ts +23 -23
- package/sources/byteWriteStream.ts +15 -15
- package/sources/characterList.ts +194 -194
- package/sources/characterListStream.ts +150 -150
- package/sources/characterReadStream.ts +80 -80
- package/sources/characterReadStreamIterator.ts +127 -127
- package/sources/concatenateIterable.ts +118 -118
- package/sources/concatenateIterator.ts +164 -164
- package/sources/currentProcess.ts +157 -157
- package/sources/dateTime.ts +129 -129
- package/sources/depthFirstSearch.ts +229 -229
- package/sources/flatMapIterable.ts +103 -103
- package/sources/flatMapIterator.ts +151 -151
- package/sources/generator.ts +250 -250
- package/sources/index.ts +1 -1
- package/sources/iterator.ts +480 -480
- package/sources/javascriptAsyncIteratorToAsyncIteratorAdapter.ts +123 -123
- package/sources/javascriptSetSet.ts +133 -133
- package/sources/listQueue.ts +61 -61
- package/sources/listStack.ts +61 -61
- package/sources/luxonDateTime.ts +108 -108
- package/sources/mapAsyncIterator.ts +140 -140
- package/sources/mutableMap.ts +291 -291
- package/sources/node.ts +36 -36
- package/sources/promiseAsyncResult.ts +173 -173
- package/sources/queue.ts +48 -48
- package/sources/recreationDotGovClient.ts +258 -258
- package/sources/searchControl.ts +41 -41
- package/sources/set.ts +243 -243
- package/sources/skipAsyncIterator.ts +144 -144
- package/sources/stack.ts +47 -47
- package/sources/syncResult.ts +299 -299
- package/sources/takeAsyncIterator.ts +140 -140
- package/sources/whereAsyncIterator.ts +142 -142
- package/sources/wonderlandTrailClient.ts +1502 -1502
- package/tests/assertTestTests.ts +74 -74
- package/tests/byteListStreamTests.ts +389 -389
- package/tests/byteListTests.ts +26 -26
- package/tests/characterListStreamTests.ts +390 -390
- package/tests/characterListTests.ts +249 -249
- package/tests/dateTimeTests.ts +29 -29
- package/tests/depthFirstSearchTests.ts +105 -105
- package/tests/generatorTests.ts +85 -85
- package/tests/mutableMapTests.ts +153 -153
- package/tests/promiseAsyncResultTests.ts +687 -687
- package/tests/queueTests.ts +28 -28
- package/tests/recreationDotGovClientTests.ts +190 -190
- package/tests/setTests.ts +139 -139
- package/tests/stackTests.ts +65 -65
- package/tests/syncResultTests.ts +1250 -1250
- package/tests/wonderlandTrailClientTests.ts +451 -451
- package/tsconfig.json +3 -0
- package/tsup.config.ts +12 -12
package/tests/setTests.ts
CHANGED
|
@@ -1,140 +1,140 @@
|
|
|
1
|
-
import { TestRunner } from "./testRunner";
|
|
2
|
-
import { Set } from "../sources/set";
|
|
3
|
-
import { Test } from "./test";
|
|
4
|
-
import { JavascriptSetSet } from "../sources/javascriptSetSet";
|
|
5
|
-
import { NotFoundError } from "../sources/notFoundError";
|
|
6
|
-
import { SyncResult } from "../sources/syncResult";
|
|
7
|
-
import { JavascriptIterable } from "../sources/javascript";
|
|
8
|
-
import { PreCondition } from "../sources/preCondition";
|
|
9
|
-
import { PreConditionError } from "../sources/preConditionError";
|
|
10
|
-
|
|
11
|
-
export function test(runner: TestRunner): void
|
|
12
|
-
{
|
|
13
|
-
runner.testFile("set.ts", () =>
|
|
14
|
-
{
|
|
15
|
-
runner.testType("Set<T>", () =>
|
|
16
|
-
{
|
|
17
|
-
runner.testFunction("create()", (test: Test) =>
|
|
18
|
-
{
|
|
19
|
-
const set: JavascriptSetSet<number> = Set.create();
|
|
20
|
-
test.assertNotUndefinedAndNotNull(set);
|
|
21
|
-
test.assertEqual(0, set.getCount().await());
|
|
22
|
-
test.assertEqual([], set.toArray().await());
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
runner.testFunction("add()", (test: Test) =>
|
|
26
|
-
{
|
|
27
|
-
const set: Set<number> = Set.create();
|
|
28
|
-
for (let i = 0; i < 3; i++)
|
|
29
|
-
{
|
|
30
|
-
const addResult: Set<number> = set.add(20);
|
|
31
|
-
test.assertSame(set, addResult);
|
|
32
|
-
test.assertTrue(set.contains(20).await());
|
|
33
|
-
test.assertEqual(set.getCount().await(), 1);
|
|
34
|
-
test.assertEqual([20], set.toArray().await());
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
runner.testFunction("addAll()", (test: Test) =>
|
|
39
|
-
{
|
|
40
|
-
const set: Set<number> = Set.create();
|
|
41
|
-
for (let i = 0; i < 3; i++)
|
|
42
|
-
{
|
|
43
|
-
const addResult: Set<number> = set.addAll([20, 20, 25, 26]);
|
|
44
|
-
test.assertSame(set, addResult);
|
|
45
|
-
test.assertTrue(set.contains(20).await());
|
|
46
|
-
test.assertTrue(set.contains(25).await());
|
|
47
|
-
test.assertTrue(set.contains(26).await());
|
|
48
|
-
test.assertEqual(set.getCount().await(), 3);
|
|
49
|
-
test.assertEqual([20, 25, 26], set.toArray().await());
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
runner.testFunction("remove()", (test: Test) =>
|
|
54
|
-
{
|
|
55
|
-
const set: Set<number> = Set.create();
|
|
56
|
-
|
|
57
|
-
test.assertThrows(set.remove(15), new NotFoundError("Could not find 15."));
|
|
58
|
-
|
|
59
|
-
set.add(16);
|
|
60
|
-
const removeResult: SyncResult<void> = set.remove(16);
|
|
61
|
-
test.assertNotUndefinedAndNotNull(removeResult);
|
|
62
|
-
test.assertFalse(set.contains(16).await());
|
|
63
|
-
test.assertUndefined(removeResult.await());
|
|
64
|
-
|
|
65
|
-
test.assertThrows(set.remove(16), new NotFoundError("Could not find 16."));
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
runner.testFunction("toString()", () =>
|
|
69
|
-
{
|
|
70
|
-
function toStringTest<T>(set: Set<T>, expected: string): void
|
|
71
|
-
{
|
|
72
|
-
runner.test(`with ${runner.toString(set)}`, (test: Test) =>
|
|
73
|
-
{
|
|
74
|
-
test.assertEqual(set.toString(), expected);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
toStringTest(Set.create(), "{}");
|
|
79
|
-
toStringTest(Set.create().addAll([1]), "{1}");
|
|
80
|
-
toStringTest(Set.create().addAll([1, 2]), "{1,2}");
|
|
81
|
-
toStringTest(Set.create().addAll([3, 1, 2]), "{3,1,2}");
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
runner.testFunction("equals()", () =>
|
|
85
|
-
{
|
|
86
|
-
function equalsTest<T>(set: Set<T>, right: JavascriptIterable<T>, expected: boolean): void
|
|
87
|
-
{
|
|
88
|
-
runner.test(`with ${runner.andList([set, right])}`, (test: Test) =>
|
|
89
|
-
{
|
|
90
|
-
test.assertEqual(set.equals(right).await(), expected);
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
equalsTest(Set.create(), [], true);
|
|
95
|
-
equalsTest(Set.create(), [1], false);
|
|
96
|
-
equalsTest(Set.create<number>().addAll([1]), [], false);
|
|
97
|
-
equalsTest(Set.create<number>().addAll([1]), [1], true);
|
|
98
|
-
equalsTest(Set.create<number>().addAll([1]), [1, 1], false);
|
|
99
|
-
equalsTest(Set.create<number>().addAll([1, 2]), [1, 2], true);
|
|
100
|
-
equalsTest(Set.create<number>().addAll([1, 2]), [2, 1], false);
|
|
101
|
-
equalsTest(Set.create<number>().addAll([1, 2]), Set.create<number>().addAll([2, 1]), true);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
runner.testFunction("union()", () =>
|
|
105
|
-
{
|
|
106
|
-
function unionErrorTest<T>(set: Set<T>, values: JavascriptIterable<T>, expected: Error): void
|
|
107
|
-
{
|
|
108
|
-
runner.test(`with ${runner.andList([set, values])}`, (test: Test) =>
|
|
109
|
-
{
|
|
110
|
-
test.assertThrows(() => set.union(values), expected);
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
unionErrorTest(Set.create<number>(), undefined!, new PreConditionError(
|
|
115
|
-
"Expression: values",
|
|
116
|
-
"Expected: not undefined and not null",
|
|
117
|
-
"Actual: undefined",
|
|
118
|
-
));
|
|
119
|
-
unionErrorTest(Set.create<number>(), null!, new PreConditionError(
|
|
120
|
-
"Expression: values",
|
|
121
|
-
"Expected: not undefined and not null",
|
|
122
|
-
"Actual: null",
|
|
123
|
-
));
|
|
124
|
-
|
|
125
|
-
function unionTest<T>(set: Set<T>, values: JavascriptIterable<T>, expected: JavascriptIterable<T>): void
|
|
126
|
-
{
|
|
127
|
-
runner.test(`with ${runner.andList([set, values])}`, (test: Test) =>
|
|
128
|
-
{
|
|
129
|
-
test.assertEqual(set.union(values).toArray().await(), expected);
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
unionTest(Set.create(), [], []);
|
|
134
|
-
unionTest(Set.create(), [1, 2], [1, 2]);
|
|
135
|
-
unionTest(Set.create([1]), [2], [1, 2]);
|
|
136
|
-
unionTest(Set.create([1, 2]), [1], [1, 2]);
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
});
|
|
1
|
+
import { TestRunner } from "./testRunner";
|
|
2
|
+
import { Set } from "../sources/set";
|
|
3
|
+
import { Test } from "./test";
|
|
4
|
+
import { JavascriptSetSet } from "../sources/javascriptSetSet";
|
|
5
|
+
import { NotFoundError } from "../sources/notFoundError";
|
|
6
|
+
import { SyncResult } from "../sources/syncResult";
|
|
7
|
+
import { JavascriptIterable } from "../sources/javascript";
|
|
8
|
+
import { PreCondition } from "../sources/preCondition";
|
|
9
|
+
import { PreConditionError } from "../sources/preConditionError";
|
|
10
|
+
|
|
11
|
+
export function test(runner: TestRunner): void
|
|
12
|
+
{
|
|
13
|
+
runner.testFile("set.ts", () =>
|
|
14
|
+
{
|
|
15
|
+
runner.testType("Set<T>", () =>
|
|
16
|
+
{
|
|
17
|
+
runner.testFunction("create()", (test: Test) =>
|
|
18
|
+
{
|
|
19
|
+
const set: JavascriptSetSet<number> = Set.create();
|
|
20
|
+
test.assertNotUndefinedAndNotNull(set);
|
|
21
|
+
test.assertEqual(0, set.getCount().await());
|
|
22
|
+
test.assertEqual([], set.toArray().await());
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
runner.testFunction("add()", (test: Test) =>
|
|
26
|
+
{
|
|
27
|
+
const set: Set<number> = Set.create();
|
|
28
|
+
for (let i = 0; i < 3; i++)
|
|
29
|
+
{
|
|
30
|
+
const addResult: Set<number> = set.add(20);
|
|
31
|
+
test.assertSame(set, addResult);
|
|
32
|
+
test.assertTrue(set.contains(20).await());
|
|
33
|
+
test.assertEqual(set.getCount().await(), 1);
|
|
34
|
+
test.assertEqual([20], set.toArray().await());
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
runner.testFunction("addAll()", (test: Test) =>
|
|
39
|
+
{
|
|
40
|
+
const set: Set<number> = Set.create();
|
|
41
|
+
for (let i = 0; i < 3; i++)
|
|
42
|
+
{
|
|
43
|
+
const addResult: Set<number> = set.addAll([20, 20, 25, 26]);
|
|
44
|
+
test.assertSame(set, addResult);
|
|
45
|
+
test.assertTrue(set.contains(20).await());
|
|
46
|
+
test.assertTrue(set.contains(25).await());
|
|
47
|
+
test.assertTrue(set.contains(26).await());
|
|
48
|
+
test.assertEqual(set.getCount().await(), 3);
|
|
49
|
+
test.assertEqual([20, 25, 26], set.toArray().await());
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
runner.testFunction("remove()", (test: Test) =>
|
|
54
|
+
{
|
|
55
|
+
const set: Set<number> = Set.create();
|
|
56
|
+
|
|
57
|
+
test.assertThrows(set.remove(15), new NotFoundError("Could not find 15."));
|
|
58
|
+
|
|
59
|
+
set.add(16);
|
|
60
|
+
const removeResult: SyncResult<void> = set.remove(16);
|
|
61
|
+
test.assertNotUndefinedAndNotNull(removeResult);
|
|
62
|
+
test.assertFalse(set.contains(16).await());
|
|
63
|
+
test.assertUndefined(removeResult.await());
|
|
64
|
+
|
|
65
|
+
test.assertThrows(set.remove(16), new NotFoundError("Could not find 16."));
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
runner.testFunction("toString()", () =>
|
|
69
|
+
{
|
|
70
|
+
function toStringTest<T>(set: Set<T>, expected: string): void
|
|
71
|
+
{
|
|
72
|
+
runner.test(`with ${runner.toString(set)}`, (test: Test) =>
|
|
73
|
+
{
|
|
74
|
+
test.assertEqual(set.toString(), expected);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
toStringTest(Set.create(), "{}");
|
|
79
|
+
toStringTest(Set.create().addAll([1]), "{1}");
|
|
80
|
+
toStringTest(Set.create().addAll([1, 2]), "{1,2}");
|
|
81
|
+
toStringTest(Set.create().addAll([3, 1, 2]), "{3,1,2}");
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
runner.testFunction("equals()", () =>
|
|
85
|
+
{
|
|
86
|
+
function equalsTest<T>(set: Set<T>, right: JavascriptIterable<T>, expected: boolean): void
|
|
87
|
+
{
|
|
88
|
+
runner.test(`with ${runner.andList([set, right])}`, (test: Test) =>
|
|
89
|
+
{
|
|
90
|
+
test.assertEqual(set.equals(right).await(), expected);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
equalsTest(Set.create(), [], true);
|
|
95
|
+
equalsTest(Set.create(), [1], false);
|
|
96
|
+
equalsTest(Set.create<number>().addAll([1]), [], false);
|
|
97
|
+
equalsTest(Set.create<number>().addAll([1]), [1], true);
|
|
98
|
+
equalsTest(Set.create<number>().addAll([1]), [1, 1], false);
|
|
99
|
+
equalsTest(Set.create<number>().addAll([1, 2]), [1, 2], true);
|
|
100
|
+
equalsTest(Set.create<number>().addAll([1, 2]), [2, 1], false);
|
|
101
|
+
equalsTest(Set.create<number>().addAll([1, 2]), Set.create<number>().addAll([2, 1]), true);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
runner.testFunction("union()", () =>
|
|
105
|
+
{
|
|
106
|
+
function unionErrorTest<T>(set: Set<T>, values: JavascriptIterable<T>, expected: Error): void
|
|
107
|
+
{
|
|
108
|
+
runner.test(`with ${runner.andList([set, values])}`, (test: Test) =>
|
|
109
|
+
{
|
|
110
|
+
test.assertThrows(() => set.union(values), expected);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
unionErrorTest(Set.create<number>(), undefined!, new PreConditionError(
|
|
115
|
+
"Expression: values",
|
|
116
|
+
"Expected: not undefined and not null",
|
|
117
|
+
"Actual: undefined",
|
|
118
|
+
));
|
|
119
|
+
unionErrorTest(Set.create<number>(), null!, new PreConditionError(
|
|
120
|
+
"Expression: values",
|
|
121
|
+
"Expected: not undefined and not null",
|
|
122
|
+
"Actual: null",
|
|
123
|
+
));
|
|
124
|
+
|
|
125
|
+
function unionTest<T>(set: Set<T>, values: JavascriptIterable<T>, expected: JavascriptIterable<T>): void
|
|
126
|
+
{
|
|
127
|
+
runner.test(`with ${runner.andList([set, values])}`, (test: Test) =>
|
|
128
|
+
{
|
|
129
|
+
test.assertEqual(set.union(values).toArray().await(), expected);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
unionTest(Set.create(), [], []);
|
|
134
|
+
unionTest(Set.create(), [1, 2], [1, 2]);
|
|
135
|
+
unionTest(Set.create([1]), [2], [1, 2]);
|
|
136
|
+
unionTest(Set.create([1, 2]), [1], [1, 2]);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
140
|
}
|
package/tests/stackTests.ts
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
import { EmptyError } from "../sources/emptyError";
|
|
2
|
-
import { ListStack } from "../sources/listStack";
|
|
3
|
-
import { Stack } from "../sources/stack";
|
|
4
|
-
import { Test } from "./test";
|
|
5
|
-
import { TestRunner } from "./testRunner";
|
|
6
|
-
|
|
7
|
-
export function test(runner: TestRunner): void
|
|
8
|
-
{
|
|
9
|
-
runner.testFile("stack.ts", () =>
|
|
10
|
-
{
|
|
11
|
-
runner.testType("Stack<T>", () =>
|
|
12
|
-
{
|
|
13
|
-
runner.testFunction("create()", (test: Test) =>
|
|
14
|
-
{
|
|
15
|
-
const stack: ListStack<number> = Stack.create();
|
|
16
|
-
test.assertNotUndefinedAndNotNull(stack);
|
|
17
|
-
test.assertFalse(stack.any().await());
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
runner.testFunction("add()", (test: Test) =>
|
|
21
|
-
{
|
|
22
|
-
const stack: ListStack<number> = Stack.create();
|
|
23
|
-
|
|
24
|
-
stack.add(10).await();
|
|
25
|
-
test.assertTrue(stack.any().await());
|
|
26
|
-
|
|
27
|
-
stack.add(20).await();
|
|
28
|
-
test.assertTrue(stack.any().await());
|
|
29
|
-
|
|
30
|
-
test.assertEqual(20, stack.remove().await());
|
|
31
|
-
test.assertEqual(10, stack.remove().await());
|
|
32
|
-
test.assertFalse(stack.any().await());
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
runner.testFunction("addAll()", () =>
|
|
36
|
-
{
|
|
37
|
-
function addAllTest(values: number[]): void
|
|
38
|
-
{
|
|
39
|
-
runner.test(`with ${runner.toString(values)}`, (test: Test) =>
|
|
40
|
-
{
|
|
41
|
-
const stack: ListStack<number> = Stack.create();
|
|
42
|
-
stack.addAll(values).await();
|
|
43
|
-
|
|
44
|
-
for (const value of values.reverse())
|
|
45
|
-
{
|
|
46
|
-
test.assertTrue(stack.any().await());
|
|
47
|
-
test.assertEqual(value, stack.remove().await());
|
|
48
|
-
}
|
|
49
|
-
test.assertFalse(stack.any().await());
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
addAllTest([]);
|
|
54
|
-
addAllTest([1]);
|
|
55
|
-
addAllTest([1, 2]);
|
|
56
|
-
addAllTest([1, 2, 3]);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
runner.testFunction("remove()", (test: Test) =>
|
|
60
|
-
{
|
|
61
|
-
const stack: ListStack<number> = Stack.create();
|
|
62
|
-
test.assertThrows(() => stack.remove().await(), new EmptyError());
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
});
|
|
1
|
+
import { EmptyError } from "../sources/emptyError";
|
|
2
|
+
import { ListStack } from "../sources/listStack";
|
|
3
|
+
import { Stack } from "../sources/stack";
|
|
4
|
+
import { Test } from "./test";
|
|
5
|
+
import { TestRunner } from "./testRunner";
|
|
6
|
+
|
|
7
|
+
export function test(runner: TestRunner): void
|
|
8
|
+
{
|
|
9
|
+
runner.testFile("stack.ts", () =>
|
|
10
|
+
{
|
|
11
|
+
runner.testType("Stack<T>", () =>
|
|
12
|
+
{
|
|
13
|
+
runner.testFunction("create()", (test: Test) =>
|
|
14
|
+
{
|
|
15
|
+
const stack: ListStack<number> = Stack.create();
|
|
16
|
+
test.assertNotUndefinedAndNotNull(stack);
|
|
17
|
+
test.assertFalse(stack.any().await());
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
runner.testFunction("add()", (test: Test) =>
|
|
21
|
+
{
|
|
22
|
+
const stack: ListStack<number> = Stack.create();
|
|
23
|
+
|
|
24
|
+
stack.add(10).await();
|
|
25
|
+
test.assertTrue(stack.any().await());
|
|
26
|
+
|
|
27
|
+
stack.add(20).await();
|
|
28
|
+
test.assertTrue(stack.any().await());
|
|
29
|
+
|
|
30
|
+
test.assertEqual(20, stack.remove().await());
|
|
31
|
+
test.assertEqual(10, stack.remove().await());
|
|
32
|
+
test.assertFalse(stack.any().await());
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
runner.testFunction("addAll()", () =>
|
|
36
|
+
{
|
|
37
|
+
function addAllTest(values: number[]): void
|
|
38
|
+
{
|
|
39
|
+
runner.test(`with ${runner.toString(values)}`, (test: Test) =>
|
|
40
|
+
{
|
|
41
|
+
const stack: ListStack<number> = Stack.create();
|
|
42
|
+
stack.addAll(values).await();
|
|
43
|
+
|
|
44
|
+
for (const value of values.reverse())
|
|
45
|
+
{
|
|
46
|
+
test.assertTrue(stack.any().await());
|
|
47
|
+
test.assertEqual(value, stack.remove().await());
|
|
48
|
+
}
|
|
49
|
+
test.assertFalse(stack.any().await());
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
addAllTest([]);
|
|
54
|
+
addAllTest([1]);
|
|
55
|
+
addAllTest([1, 2]);
|
|
56
|
+
addAllTest([1, 2, 3]);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
runner.testFunction("remove()", (test: Test) =>
|
|
60
|
+
{
|
|
61
|
+
const stack: ListStack<number> = Stack.create();
|
|
62
|
+
test.assertThrows(() => stack.remove().await(), new EmptyError());
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
66
|
}
|