Skip to content

Commit

Permalink
sys,testSys: updates for BufTest and read/write F8
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Giannini authored and Matthew Giannini committed Oct 31, 2023
1 parent 0e4f24d commit 1a88dd9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/sys/es/fan/InStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,14 @@ class InStream extends Obj {
const buf = new ArrayBuffer(4);
const data = new DataView(buf);
for (let i = 0; i < 4; ++i) { data.setUint8(i, this.read()); }
return data.getFloat32(0, !this.#bigEndian);
return Float.make(data.getFloat32(0, !this.#bigEndian));
}

readF8() {
const buf = new ArrayBuffer(8);
const data = new DataView(buf);
for (let i = 0; i < 8; ++i) { data.setUint8(i, this.read()); }
return data.getFloat64(0, !this.#bigEndian);
return Float.make(data.getFloat64(0, !this.#bigEndian));
}

readDecimal() {
Expand Down
7 changes: 3 additions & 4 deletions src/testSys/fan/BufTest.fan
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ class BufTest : AbstractBufTest
buf.writeI4(0xabcd0123)
if (!js) buf.writeI8(0xabcd0123ffffeeee)
buf.writeF4(2f)
if (!js) buf.writeF8(77.0f)
buf.writeF8(77.0f)
if (!js) buf.writeDecimal(50.03D)
buf.writeBool(true)
buf.print("harry").printLine(" potter")
Expand All @@ -631,7 +631,7 @@ class BufTest : AbstractBufTest
verifyEq(buf.readU4, 0xabcd0123)
if (!js) verifyEq(buf.readS8, 0xabcd0123ffffeeee)
verifyEq(buf.readF4, 2f)
if (!js) verifyEq(buf.readF8, 77f)
verifyEq(buf.readF8, 77f)
if (!js) verifyEq(buf.readDecimal, 50.03d)
verifyEq(buf.readBool, true)
verifyEq(buf.readLine, "harry potter")
Expand Down Expand Up @@ -1074,8 +1074,7 @@ if (!js) verifyErr(e) { buf.readS8 }
verifyErr(e) { buf.writeChars("abc") }
verifyErr(e) { buf.writeDecimal(10d) }
verifyErr(e) { buf.writeF4(10f) }
// TODO
if (!js) verifyErr(e) { buf.writeF8(10f) }
verifyErr(e) { buf.writeF8(10f) }
verifyErr(e) { buf.writeI2(10) }
verifyErr(e) { buf.writeI4(10) }
// TODO
Expand Down

0 comments on commit 1a88dd9

Please sign in to comment.