risei 1.1.1 → 1.1.2

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 (42) hide show
  1. package/README.md +3 -1
  2. package/index.js +1 -1
  3. package/package.json +4 -4
  4. package/tests/other-tests/ASpoofingFixture.tests.js +0 -242
  5. package/tests/other-tests/SpoofClassesFixture.tests.js +0 -130
  6. package/tests/other-tests/SpoofObjectsFixture.tests.js +0 -95
  7. package/tests/other-tests/SpoofTuple.tests.js +0 -93
  8. package/tests/other-tests/TotalComparer.tests.js +0 -920
  9. package/tests/other-tests/package.json +0 -7
  10. package/tests/risei-tests/ASpoofingFixtureTests.rt.js +0 -51
  11. package/tests/risei-tests/MomentTests.rt.js +0 -103
  12. package/tests/risei-tests/SpoofTupleTests.rt.js +0 -274
  13. package/tests/risei-tests/TestFrameChooserTests.rt.js +0 -74
  14. package/tests/risei-tests/TestFrameTests.rt.js +0 -84
  15. package/tests/risei-tests/TestStagesTests.rt.js +0 -99
  16. package/tests/risei-tests/TestTupleTests.rt.js +0 -140
  17. package/tests/risei-tests/TotalComparerTests.rt.js +0 -184
  18. package/tests/risei-tests/TotalCopierTests.rt.js +0 -74
  19. package/tests/risei-tests/TotalDisplayerTests.rt.js +0 -186
  20. package/tests/risei-tests/TypeAnalyzerTests.rt.js +0 -29
  21. package/tests/risei-tests/TypeIdentifierTests.rt.js +0 -44
  22. package/tests/self-tests/SelfTests.outward-rt.js +0 -583
  23. package/tests/target-objects/CompositionModel.js +0 -38
  24. package/tests/target-objects/ConditionalThrowModel.js +0 -11
  25. package/tests/target-objects/CountModel.js +0 -46
  26. package/tests/target-objects/DomModel.js +0 -37
  27. package/tests/target-objects/MixedContents.js +0 -33
  28. package/tests/target-objects/MutationModel.js +0 -27
  29. package/tests/target-objects/ObjectCompositionModel.js +0 -34
  30. package/tests/target-objects/PolySpoofableInner.js +0 -30
  31. package/tests/target-objects/PolySpoofableOuter.js +0 -52
  32. package/tests/target-objects/PropertiesModel.js +0 -47
  33. package/tests/target-objects/Returner.js +0 -9
  34. package/tests/target-objects/SearchModel.js +0 -25
  35. package/tests/target-objects/SortModel.js +0 -91
  36. package/tests/target-objects/SpoofCaller.js +0 -24
  37. package/tests/target-objects/Spoofable.js +0 -36
  38. package/tests/target-objects/SpoofableArgsCaller.js +0 -33
  39. package/tests/target-objects/StateModel.js +0 -34
  40. package/tests/target-objects/StaticModel.js +0 -17
  41. package/tests/target-objects/TestableModel.js +0 -47
  42. package/tests/topic-tests/TopicTests.outward-rt.js +0 -354
@@ -1,46 +0,0 @@
1
- /**/
2
-
3
- export class CountModel {
4
- constructor() {
5
- /* No operations. */
6
- }
7
-
8
- howMany(subject, target) /* passed */ {
9
- // Bad-call edge case.
10
- if (arguments.length < 2) {
11
- return 0;
12
- }
13
-
14
- // Bad-arg edge cases.
15
- if (this.#isEdgeCase(subject, target)) {
16
- return 0;
17
- }
18
-
19
- // Initial values and ops reducer.
20
- let at = 0;
21
- let count = 0;
22
- let span = target.length;
23
-
24
- // Tracking found site and jumping past it each time the target is found.
25
- while ((at = subject.indexOf(target, at)) !== -1) {
26
- count++;
27
- at += span;
28
- }
29
-
30
- // Back to caller.
31
- return count;
32
- }
33
-
34
- #isEdgeCase(subject, target) /* verified */ {
35
- if (subject === null || target === null) {
36
- return true;
37
- }
38
-
39
- if (target === "") {
40
- return true;
41
- }
42
-
43
- return false;
44
- }
45
-
46
- }
@@ -1,37 +0,0 @@
1
- /**/
2
-
3
- export class DomModel {
4
- // region Private fields
5
-
6
- #id;
7
- #node;
8
-
9
- // endregion Private fields
10
-
11
- // region Properties
12
-
13
- get id() {
14
- return this.#id;
15
- }
16
-
17
- get node() {
18
- return this.#node;
19
- }
20
-
21
- // endregion Properties
22
-
23
- constructor(id) {
24
- this.#id = id;
25
- this.#node = this.domNodeFrom(id);
26
- }
27
-
28
- domNodeFrom(id) {
29
- let node = document.getElementById(id);
30
- return node;
31
- }
32
-
33
- changeDomItem(id) {
34
- this.#id = id;
35
- this.#node = this.domNodeFrom(id);
36
- }
37
- }
@@ -1,33 +0,0 @@
1
- /**/
2
-
3
- export class MixedContents {
4
- first = 1;
5
- second = "2";
6
- third = { three: 3 };
7
-
8
- static fourth = 4;
9
- static fifth = "5";
10
-
11
- getInstanceValueOf(name) {
12
- return this[name];
13
- }
14
-
15
- getInstanceProduct() {
16
- let a = this.first;
17
- let b = Number(this.second);
18
- let c = this.third.three;
19
-
20
- return a * b * c;
21
- }
22
-
23
- static getStaticValueOf(name) {
24
- return MixedContents[name];
25
- }
26
-
27
- static getStaticProduct() {
28
- let a = MixedContents.fourth;
29
- let b = Number(MixedContents.fifth);
30
-
31
- return a * b;
32
- }
33
- }
@@ -1,27 +0,0 @@
1
- /**/
2
-
3
- export class MutationModel {
4
- #map;
5
- #array;
6
-
7
- constructor(map, array) {
8
- this.#map = map;
9
- this.#array = array;
10
- }
11
-
12
- mutateInitors() {
13
- // Map mutation allows for consecutive mutations.
14
- let rawKey = this.#map.size + 1;
15
- this.#map.set(rawKey.toString(), "C");
16
- this.#array.shift();
17
-
18
- return { map: this.#map, array: this.#array };
19
- }
20
-
21
- mutateArgs(array, tuple) {
22
- array.push(10);
23
- tuple.changes += 10;
24
-
25
- return { array, tuple };
26
- }
27
- }
@@ -1,34 +0,0 @@
1
- /**/
2
-
3
- export class ObjectCompositionModel {
4
- constructor() {
5
- /* No operations. */
6
- }
7
-
8
- /* Target of spoofing. */
9
- supplySomeObject() {
10
- throw new Error("supplyObjectA() must be spoofed in tests.");
11
- }
12
-
13
- enact(chain, method) {
14
- // Invoke the method to be spoofed.
15
- let target = this.supplySomeObject();
16
-
17
- // Traverse the spoofed return
18
- // value's object tree.
19
- for (let link of chain) {
20
- target = target[link];
21
- }
22
-
23
- // Invoke the method at chain end for its return value.
24
- let output = target[method]();
25
- return output;
26
- }
27
-
28
- doubleEnact(chainOne, methodOne, chainTwo, methodTwo) {
29
- let outputOne = this.enact(chainOne, methodOne);
30
- let outputTwo = this.enact(chainTwo, methodTwo);
31
-
32
- return [ outputOne, outputTwo ];
33
- }
34
- }
@@ -1,30 +0,0 @@
1
- /**/
2
-
3
-
4
- export class PolySpoofableInner {
5
- constructor() {
6
- /* No operations. */
7
- }
8
-
9
- /* Spoofing target. */
10
- addOrTimes(numbers) {
11
- let a = numbers.supplyA();
12
- let b = numbers.supplyB();
13
-
14
- return a + b;
15
- }
16
-
17
- /* Spoofing target. */
18
- minusOrOver(numbers) {
19
- let a = numbers.supplyA();
20
- let b = numbers.supplyB();
21
-
22
- return a - b;
23
- }
24
-
25
- /* Spoofing target. Nested object. */
26
- numberHost = {
27
- supplyC: () => { return 15; },
28
- supplyD: () => { return 18; }
29
- }
30
- }
@@ -1,52 +0,0 @@
1
- /**/
2
-
3
- import { PolySpoofableInner } from "./PolySpoofableInner.js";
4
-
5
- export class PolySpoofableOuter {
6
- /* Spoofing target. */
7
- #inner;
8
-
9
- constructor() {
10
- this.#inner = new PolySpoofableInner();
11
- }
12
-
13
- /* Not intended to be spoofed, but to use spoofs. */
14
- combinedNumbers(numbers) {
15
- let first = this.#inner.addOrTimes(numbers);
16
- let second = this.#inner.minusOrOver(numbers);
17
-
18
- let combined = this.combiner(first, second);
19
- return combined;
20
- }
21
-
22
- /* Spoofing target. */
23
- combiner(first, second) {
24
- let combined = Math.pow(first, second);
25
- return combined;
26
- }
27
-
28
- /* Not intended to be spoofed, but to use spoofs. */
29
- combinedPlusHosted(numbers) {
30
- let combined = this.combinedNumbers(numbers);
31
- let third = this.#inner.numberHost.supplyC();
32
- let fourth = this.#inner.numberHost.supplyD();
33
-
34
- return combined + third - fourth;
35
- }
36
-
37
- /* Not intended to be spoofed, but to use arg with spoofs. */
38
- combinedArgAAndB(inner) {
39
- let first = inner.supplyA();
40
- let second = inner.supplyB();
41
-
42
- return first + second;
43
- }
44
-
45
- /* Not intended to be spoofed, but to use arg with spoofs. */
46
- combinedArgHostedCAndD(inner) {
47
- let third = inner.numberHost.supplyC();
48
- let fourth = inner.numberHost.supplyD();
49
-
50
- return third - fourth;
51
- }
52
- }
@@ -1,47 +0,0 @@
1
- /**/
2
-
3
- export class PropertiesModel {
4
- // region Static members
5
-
6
- static staticValueProp = 3;
7
-
8
- static #staticAccessorValue = "4th";
9
-
10
- static get staticAccessorProp() {
11
- return this.#staticAccessorValue;
12
- }
13
-
14
- static set staticAccessorProp(value) {
15
- this.#staticAccessorValue = value;
16
- }
17
-
18
- static staticMethod() {
19
- return "static";
20
- }
21
-
22
- // endregion Static members
23
-
24
- constructor() {
25
- /* No operations. */
26
- }
27
-
28
- // region Instance members
29
-
30
- valueProp = 1;
31
-
32
- #accessorValue = "2nd";
33
-
34
- get accessorProp() {
35
- return this.#accessorValue;
36
- }
37
-
38
- set accessorProp(value) {
39
- this.#accessorValue = value;
40
- }
41
-
42
- instanceMethod() {
43
- return "instance";
44
- }
45
-
46
- // endregion Instance members
47
- }
@@ -1,9 +0,0 @@
1
- /**/
2
-
3
- export class Returner {
4
- returnArg(arg) {
5
- // return "fails"; /* &cruft */
6
-
7
- return arg;
8
- }
9
- }
@@ -1,25 +0,0 @@
1
- /**/
2
-
3
- export class SearchModel {
4
- constructor() {
5
- /* No operations.*/
6
- }
7
-
8
- findLinear(sought, subject) /* passed */ {
9
- // Fail path. All edge cases return false.
10
- if (subject === undefined) {
11
- return false;
12
- }
13
-
14
- // Main path.
15
- for (let item of subject) {
16
- if (item === sought) {
17
- return true;
18
- }
19
- }
20
-
21
- // Never found.
22
- return false;
23
- }
24
-
25
- }
@@ -1,91 +0,0 @@
1
- /**/
2
-
3
- export class SortModel {
4
- constructor() {
5
- /* No operations. */
6
- }
7
-
8
- countSort(subject) /* passed */ {
9
- // To store indices for sorting to.
10
- let sites = subject
11
- .map(x => 0);
12
-
13
- // Finding positions.
14
- for (let at = 0; at < subject.length; at++) {
15
- for (let on = 0; on < subject.length; on++) {
16
- if (subject[on] < subject[at]) {
17
- sites[at]++;
18
- }
19
- }
20
- }
21
-
22
- // To retain reordered items.
23
- let output = sites
24
- .map(x => 0);
25
-
26
- // Placing into output positions.
27
- for (let at = 0; at < sites.length; at++) {
28
- let to = sites[at];
29
- output[to] = subject[at];
30
- }
31
-
32
- // Back to caller.
33
- return output;
34
- }
35
-
36
- mergeSort(subject) /* passed */ {
37
- return this.#mergeRecursor(subject);
38
- }
39
-
40
- // region Private dependencies of mergeSort()
41
-
42
- #mergeRecursor(subject, level) /* verified */ {
43
- // Can't split for further merging.
44
- if (subject.length === 1) {
45
- return subject;
46
- }
47
-
48
- // Splitting for recursing at next level.
49
- let { left, right } = this.#splitInHalf(subject);
50
-
51
- // Actual recursion, calling next level directly.
52
- let lefts = this.#mergeRecursor(left);
53
- let rights = this.#mergeRecursor(right);
54
-
55
- // Actually merging, then back to caller.
56
- let merged = this.#merge(lefts, rights);
57
- return merged;
58
- }
59
-
60
- #splitInHalf(subject) /* verified */ {
61
- // These slicing args ensure no lost items.
62
- let left = subject.slice(0, subject.length / 2);
63
- let right = subject.slice(left.length, subject.length);
64
-
65
- return { left, right };
66
- }
67
-
68
- #merge(lefts, rights) /* verified */ {
69
- // To hold output.
70
- let merged = [];
71
-
72
- // While both sides have items, pop the lowest
73
- // of the two at the top to the output.
74
- while (lefts.length > 0 && rights.length > 0) {
75
- let side = lefts[0] < rights[0] ? lefts : rights;
76
- let next = side.shift();
77
-
78
- merged.push(next);
79
- }
80
-
81
- // When one side is done, pop the rest of the other.
82
- let surplus = lefts.length > rights.length ? lefts : rights;
83
- merged.push(...surplus);
84
-
85
- // Back to caller.
86
- return merged;
87
- }
88
-
89
- // endregion Private dependencies of mergeSort()
90
-
91
- }
@@ -1,24 +0,0 @@
1
- /**/
2
-
3
- import { SpoofObjectMethodsFixture } from "../../system/SpoofObjectMethodsFixture.js";
4
- import { SpoofTuple } from "../../system/SpoofTuple.js";
5
-
6
- export class SpoofCaller {
7
- #spoofer;
8
-
9
- constructor() {
10
- this.#spoofer = new SpoofObjectMethodsFixture();
11
- }
12
-
13
- runSpoof(name, output) {
14
- // Making the nonce spoof from the args.
15
- let nonce = { of: name, as: output };
16
-
17
- // Actually spoofing.
18
- let spoofed = this.#spoofer.spoofTarget(nonce);
19
-
20
- // Using the spoof.
21
- let result = spoofed[name]();
22
- return result;
23
- }
24
- }
@@ -1,36 +0,0 @@
1
- /**/
2
-
3
- export class Spoofable {
4
- #member;
5
-
6
- constructor(member) {
7
- /* Optional member to test spoofing with SOF. */
8
- if (member) {
9
- this.#member = member;
10
- }
11
- }
12
-
13
- /* Member to test spoofing with SCF. */
14
- spoofNumber(a, b) { return a + b; }
15
-
16
- /* Member to test spoofing with SCF.
17
- * Enables testing of spoofNumber() spoofing that
18
- * returns no value (the spoofed method is empty). */
19
- callSpoofNumber(a, b) {
20
- let result = this.spoofNumber(a, b);
21
-
22
- if (result === undefined) {
23
- return "spoofNumber() internal call: no return value";
24
- }
25
-
26
- return result;
27
- }
28
-
29
- /* Member to test spoofing with SCF. */
30
- spoofText(t, u) { return `Texts "${ t }" and "${ u }".`; }
31
-
32
- /* Member to test spoofing with SOF. */
33
- callMemberMethod() {
34
- return member.something();
35
- }
36
- }
@@ -1,33 +0,0 @@
1
- /**/
2
-
3
- export class SpoofableArgsCaller {
4
- #cArg;
5
-
6
- constructor(cArg) {
7
- this.#cArg = cArg;
8
- }
9
-
10
- callConstructorArg() {
11
- let arg = this.#cArg;
12
-
13
- // When spoofed, number() exists.
14
- // When not, .of and .as exist.
15
- let output
16
- = arg.number
17
- ? arg.number()
18
- : `this.#cArg.of: ${ arg.of }, this.#cArg.as: ${ arg.as }`;
19
-
20
- return output;
21
- }
22
-
23
- callMethodArg(mArg) {
24
- // When spoofed, text() exists.
25
- // When not, .of and .as exist.
26
- let output
27
- = mArg.text
28
- ? mArg.text()
29
- : `mArg.of: ${ mArg.of }, mArg.as: ${ mArg.as }`;
30
-
31
- return output;
32
- }
33
- }
@@ -1,34 +0,0 @@
1
- /**/
2
-
3
- export class StateModel {
4
- #numberState;
5
- #textState;
6
-
7
- get numberState() {
8
- return this.#numberState;
9
- }
10
-
11
- get textState() {
12
- return this.#textState;
13
- }
14
-
15
- constructor() {
16
- this.#numberState = 1;
17
- this.#textState = "1";
18
- }
19
-
20
- setNumberState(number) {
21
- this.#numberState = number;
22
- }
23
-
24
- setTextState(text) {
25
- this.#textState = text;
26
- }
27
-
28
- changeNumberAndTextState(number, text) {
29
- this.#numberState = number;
30
- this.#textState = text;
31
-
32
- return { number: this.#numberState, text: this.#textState };
33
- }
34
- }
@@ -1,17 +0,0 @@
1
- /**/
2
-
3
- export class StaticModel {
4
- static #property = "default-static-property";
5
-
6
- static get staticProperty() {
7
- return StaticModel.#property;
8
- }
9
-
10
- static setStaticProperty(value) {
11
- StaticModel.#property = value;
12
- }
13
-
14
- static multiplyThenDivide(a, b, c) {
15
- return (a * b) / c;
16
- }
17
- }
@@ -1,47 +0,0 @@
1
- /**/
2
-
3
- export class TestableModel {
4
- // region Static members
5
-
6
- static staticValueProp = 3;
7
-
8
- static #staticAccessorValue = "4th";
9
-
10
- static get staticAccessorProp() {
11
- return this.#staticAccessorValue;
12
- }
13
-
14
- static set staticAccessorProp(value) {
15
- this.#staticAccessorValue = value;
16
- }
17
-
18
- static staticMethod() {
19
- return "static";
20
- }
21
-
22
- // endregion Static members
23
-
24
- constructor() {
25
- /* No operations. */
26
- }
27
-
28
- // region Instance members
29
-
30
- valueProp = 1;
31
-
32
- #accessorValue = "2nd";
33
-
34
- get accessorProp() {
35
- return this.#accessorValue;
36
- }
37
-
38
- set accessorProp(value) {
39
- this.#accessorValue = value;
40
- }
41
-
42
- instanceMethod(argOne, argTwo) {
43
- return `instance-method-${ argOne }-${ argTwo }`;
44
- }
45
-
46
- // endregion Instance members
47
- }