-
-
Notifications
You must be signed in to change notification settings - Fork 480
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix EnumValueType value initialisation
- Loading branch information
1 parent
4c64a14
commit 408db1d
Showing
4 changed files
with
43 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const should = require("should"); | ||
const { BinaryStream } = require("node-opcua-binary-stream"); | ||
const { EnumValueType } = require("../dist"); // node-opcua-types" | ||
|
||
function doTest(r) { | ||
const binaryStream = new BinaryStream(); | ||
|
||
r.encode(binaryStream); | ||
|
||
binaryStream.rewind(); | ||
|
||
const r2 = new EnumValueType(); | ||
r2.decode(binaryStream); | ||
|
||
r2.toString().should.eql(r.toString()); | ||
console.log(r2.toString()); | ||
} | ||
|
||
describe("Issue 688", () => { | ||
it("EnumValue with empty constructor", () => { | ||
const r = new EnumValueType({}); | ||
doTest(r); | ||
}); | ||
it("EnumValue with value=10", () => { | ||
const r = new EnumValueType({ | ||
value: 10 | ||
}); | ||
doTest(r); | ||
}); | ||
it("EnumValue with value=-10", () => { | ||
const r = new EnumValueType({ | ||
value: -32168, | ||
|
||
}); | ||
doTest(r); | ||
}); | ||
}); |