Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | // Copyright (c) ZeroC, Inc.
import { Test, Inner } from "./Test.js";
import { TestHelper, test } from "../../Common/TestHelper.js";
export class Client extends TestHelper {
async allTests() {
const out = this.getWriter();
const communicator = this.communicator();
out.write("test using same type name in different Slice modules... ");
{
const i1 = new Test.MyInterfacePrx(communicator, `i1:${this.getTestEndpoint()}`);
const s1 = new Test.MyStruct(0);
const [s2, s3] = await i1.opMyStruct(s1);
test(s2.equals(s1));
test(s3.equals(s1));
const [sseq2, sseq3] = await i1.opMyStructSeq([s1]);
test(sseq2[0].equals(s1));
test(sseq3[0].equals(s1));
const smap1 = new Map([["a", s1]]);
const [smap2, smap3] = await i1.opMyStructMap(smap1);
test(smap2.get("a")?.equals(s1) ?? false);
test(smap3.get("a")?.equals(s1) ?? false);
const c1 = new Test.MyClass(s1);
const [c2, c3] = await i1.opMyClass(c1);
test(c2?.s.equals(s1) ?? false);
test(c3?.s.equals(s1) ?? false);
const [cseq2, cseq3] = await i1.opMyClassSeq([c1]);
test(cseq2[0]?.s.equals(s1) ?? false);
test(cseq3[0]?.s.equals(s1) ?? false);
const cmap1 = new Map([["a", c1]]);
const [cmap2, cmap3] = await i1.opMyClassMap(cmap1);
test(cmap2.get("a")?.s.equals(s1) ?? false);
test(cmap3.get("a")?.s.equals(s1) ?? false);
const e = await i1.opMyEnum(Test.MyEnum.v1);
test(e == Test.MyEnum.v1);
const s = await i1.opMyOtherStruct(new Test.MyOtherStruct("MyOtherStruct"));
test(s.s == "MyOtherStruct");
const c = await i1.opMyOtherClass(new Test.MyOtherClass("MyOtherClass"));
test(c?.s == "MyOtherClass");
}
{
const i2 = new Test.Inner.Inner2.MyInterfacePrx(communicator, `i2:${this.getTestEndpoint()}`);
const s1 = new Test.Inner.Inner2.MyStruct(0);
const [s2, s3] = await i2.opMyStruct(s1);
test(s2.equals(s1));
test(s3.equals(s1));
const [sseq2, sseq3] = await i2.opMyStructSeq([s1]);
test(sseq2[0].equals(s1));
test(sseq3[0].equals(s1));
const smap1 = new Map([["a", s1]]);
const [smap2, smap3] = await i2.opMyStructMap(smap1);
test(smap2.get("a")?.equals(s1) ?? false);
test(smap3.get("a")?.equals(s1) ?? false);
const c1 = new Test.Inner.Inner2.MyClass(s1);
const [c2, c3] = await i2.opMyClass(c1);
test(c2?.s.equals(s1) ?? false);
test(c3?.s.equals(s1) ?? false);
const [cseq2, cseq3] = await i2.opMyClassSeq([c1]);
test(cseq2[0]?.s.equals(s1) ?? false);
test(cseq3[0]?.s.equals(s1) ?? false);
const cmap1 = new Map([["a", c1]]);
const [cmap2, cmap3] = await i2.opMyClassMap(cmap1);
test(cmap2.get("a")?.s.equals(s1) ?? false);
test(cmap3.get("a")?.s.equals(s1) ?? false);
}
{
const i3 = new Test.Inner.MyInterfacePrx(communicator, `i3:${this.getTestEndpoint()}`);
const s1 = new Test.Inner.Inner2.MyStruct(0);
const [s2, s3] = await i3.opMyStruct(s1);
test(s2.equals(s1));
test(s3.equals(s1));
const [sseq2, sseq3] = await i3.opMyStructSeq([s1]);
test(sseq2[0].equals(s1));
test(sseq3[0].equals(s1));
const smap1 = new Map([["a", s1]]);
const [smap2, smap3] = await i3.opMyStructMap(smap1);
test(smap2.get("a")?.equals(s1) ?? false);
test(smap3.get("a")?.equals(s1) ?? false);
const c1 = new Test.Inner.Inner2.MyClass(s1);
const [c2, c3] = await i3.opMyClass(c1);
test(c2?.s.equals(s1) ?? false);
test(c3?.s.equals(s1) ?? false);
const [cseq2, cseq3] = await i3.opMyClassSeq([c1]);
test(cseq2[0]?.s.equals(s1) ?? false);
test(cseq3[0]?.s.equals(s1) ?? false);
const cmap1 = new Map([["a", c1]]);
const [cmap2, cmap3] = await i3.opMyClassMap(cmap1);
test(cmap2.get("a")?.s.equals(s1) ?? false);
test(cmap3.get("a")?.s.equals(s1) ?? false);
}
{
const i4 = new Inner.Test.Inner2.MyInterfacePrx(communicator, `i4:${this.getTestEndpoint()}`);
const s1 = new Test.MyStruct(0);
const [s2, s3] = await i4.opMyStruct(s1);
test(s2.equals(s1));
test(s3.equals(s1));
const [sseq2, sseq3] = await i4.opMyStructSeq([s1]);
test(sseq2[0].equals(s1));
test(sseq3[0].equals(s1));
const smap1 = new Map([["a", s1]]);
const [smap2, smap3] = await i4.opMyStructMap(smap1);
test(smap2.get("a")?.equals(s1) ?? false);
test(smap3.get("a")?.equals(s1) ?? false);
const c1 = new Test.MyClass(s1);
const [c2, c3] = await i4.opMyClass(c1);
test(c2?.s.equals(s1) ?? false);
test(c3?.s.equals(s1) ?? false);
const [cseq2, cseq3] = await i4.opMyClassSeq([c1]);
test(cseq2[0]?.s.equals(s1) ?? false);
test(cseq3[0]?.s.equals(s1) ?? false);
const cmap1 = new Map([["a", c1]]);
const [cmap2, cmap3] = await i4.opMyClassMap(cmap1);
test(cmap2.get("a")?.s.equals(s1) ?? false);
test(cmap3.get("a")?.s.equals(s1) ?? false);
}
{
const i1 = new Test.MyInterfacePrx(communicator, `i1:${this.getTestEndpoint()}`);
await i1.shutdown();
}
out.writeLine("ok");
}
async run(args) {
let communicator = null;
try {
[communicator] = this.initialize(args);
await this.allTests();
}
finally {
if (communicator) {
await communicator.destroy();
}
}
}
}
|