Return split values in a single interleaved Float32Array

This commit is contained in:
Tom Payne
2013-05-30 20:05:02 +02:00
parent 42f15f000b
commit db2f805ed9
2 changed files with 25 additions and 35 deletions

View File

@@ -231,14 +231,12 @@ describe('ol.structs.Buffer', function() {
it('returns the expected value', function() {
var split32 = b.getSplit32();
expect(split32.high).to.be.a(Float32Array);
expect(split32.low).to.be.a(Float32Array);
expect(split32.high).to.have.length(2);
expect(split32.low).to.have.length(2);
expect(split32.high[0]).to.roughlyEqual(1179648.0, 1e1);
expect(split32.low[0]).to.roughlyEqual(54919.12345670001, 1e-2);
expect(split32.high[1]).to.roughlyEqual(-7602176.0, 1e1);
expect(split32.low[1]).to.roughlyEqual(-52145.76543209981, 1e-2);
expect(split32).to.be.a(Float32Array);
expect(split32).to.have.length(4);
expect(split32[0]).to.roughlyEqual(1179648.0, 1e1);
expect(split32[1]).to.roughlyEqual(54919.12345670001, 1e-2);
expect(split32[2]).to.roughlyEqual(-7602176.0, 1e1);
expect(split32[3]).to.roughlyEqual(-52145.76543209981, 1e-2);
});
it('tracks updates', function() {
@@ -246,14 +244,12 @@ describe('ol.structs.Buffer', function() {
b.getArray()[0] = 0;
b.markDirty(1, 0);
var split32 = b.getSplit32();
expect(split32.high).to.be.a(Float32Array);
expect(split32.low).to.be.a(Float32Array);
expect(split32.high).to.have.length(2);
expect(split32.low).to.have.length(2);
expect(split32.high[0]).to.be(0);
expect(split32.low[0]).to.be(0);
expect(split32.high[1]).to.roughlyEqual(-7602176.0, 1e1);
expect(split32.low[1]).to.roughlyEqual(-52145.76543209981, 1e-2);
expect(split32).to.be.a(Float32Array);
expect(split32).to.have.length(4);
expect(split32[0]).to.be(0);
expect(split32[1]).to.be(0);
expect(split32[2]).to.roughlyEqual(-7602176.0, 1e1);
expect(split32[3]).to.roughlyEqual(-52145.76543209981, 1e-2);
});
});