提交 8ec174d0 编写于 作者: M mahaifeng

[array-buffer]修改条件编译

上级 95cc26fa
...@@ -23,7 +23,8 @@ const int16 = new TInt16Array() ...@@ -23,7 +23,8 @@ const int16 = new TInt16Array()
export function testArrayBuffer() : Result { export function testArrayBuffer() : Result {
return describe("ArrayBuffer", () => { return describe("ArrayBuffer", () => {
// #ifdef APP-ANDROID // #ifndef APP-IOS
//dataview start //dataview start
test('dataview_constructor', () => { test('dataview_constructor', () => {
tDataView.setConstructor() tDataView.setConstructor()
...@@ -753,7 +754,8 @@ export function testArrayBuffer() : Result { ...@@ -753,7 +754,8 @@ export function testArrayBuffer() : Result {
test('uint32_testSome', () => { test('uint32_testSome', () => {
uint32.testSome() uint32.testSome()
}) })
// #endif
//uint32 end //uint32 end
// #endif
}) })
} }
\ No newline at end of file
...@@ -18,6 +18,7 @@ export class TDataView { ...@@ -18,6 +18,7 @@ export class TDataView {
// this.setUint8(); // this.setUint8();
// this.testMix(); // this.testMix();
} }
// #ifndef APP-IOS
setConstructor() { setConstructor() {
let buffer = new ArrayBuffer(16); let buffer = new ArrayBuffer(16);
let dataview = new DataView(buffer); let dataview = new DataView(buffer);
...@@ -40,7 +41,7 @@ export class TDataView { ...@@ -40,7 +41,7 @@ export class TDataView {
view.setInt8(1, 127); // Max signed 8-bit integer view.setInt8(1, 127); // Max signed 8-bit integer
expect(view.getInt8(1)).toEqual(127); expect(view.getInt8(1)).toEqual(127);
// #END // #END
} }
setFloat32() { setFloat32() {
// #TEST DataView.setFloat32,DataView.getFloat32 // #TEST DataView.setFloat32,DataView.getFloat32
...@@ -50,7 +51,7 @@ export class TDataView { ...@@ -50,7 +51,7 @@ export class TDataView {
view.setFloat32(1, 3); view.setFloat32(1, 3);
expect(this.numberEquals(3, view.getFloat32(1))).toEqual(true); expect(this.numberEquals(3, view.getFloat32(1))).toEqual(true);
// #END // #END
} }
setFloat64() { setFloat64() {
// #TEST DataView.setFloat64,DataView.getFloat64 // #TEST DataView.setFloat64,DataView.getFloat64
...@@ -60,7 +61,7 @@ export class TDataView { ...@@ -60,7 +61,7 @@ export class TDataView {
view.setFloat64(1, Math.PI); view.setFloat64(1, Math.PI);
expect(this.numberEquals(3.141592653589793, view.getFloat64(1))).toEqual(true); expect(this.numberEquals(3.141592653589793, view.getFloat64(1))).toEqual(true);
// #END // #END
} }
setInt16() { setInt16() {
// #TEST DataView.setInt16,DataView.getInt16 // #TEST DataView.setInt16,DataView.getInt16
...@@ -70,7 +71,7 @@ export class TDataView { ...@@ -70,7 +71,7 @@ export class TDataView {
view.setInt16(1, 32767); // Max signed 16-bit integer view.setInt16(1, 32767); // Max signed 16-bit integer
expect(view.getInt16(1)).toEqual(32767); expect(view.getInt16(1)).toEqual(32767);
// #END // #END
} }
setInt32() { setInt32() {
// #TEST DataView.setInt32,DataView.getInt32 // #TEST DataView.setInt32,DataView.getInt32
...@@ -80,7 +81,7 @@ export class TDataView { ...@@ -80,7 +81,7 @@ export class TDataView {
view.setInt32(1, 2147483647); // Max signed 32-bit integer view.setInt32(1, 2147483647); // Max signed 32-bit integer
expect(this.numberEquals(2147483647, view.getInt32(1))).toEqual(true); expect(this.numberEquals(2147483647, view.getInt32(1))).toEqual(true);
// #END // #END
} }
setUint16() { setUint16() {
// #TEST DataView.setUint16,DataView.getUint16 // #TEST DataView.setUint16,DataView.getUint16
...@@ -100,7 +101,7 @@ export class TDataView { ...@@ -100,7 +101,7 @@ export class TDataView {
view.setUint32(1, 4294967295); // Max unsigned 32-bit integer view.setUint32(1, 4294967295); // Max unsigned 32-bit integer
expect(this.numberEquals(4294967295, view.getUint32(1))).toEqual(true); expect(this.numberEquals(4294967295, view.getUint32(1))).toEqual(true);
// #END // #END
} }
setUint8() { setUint8() {
// #TEST DataView.setUint8,DataView.getUint8 // #TEST DataView.setUint8,DataView.getUint8
...@@ -342,4 +343,5 @@ class LittleEndian { ...@@ -342,4 +343,5 @@ class LittleEndian {
this.uint8View_[byteOffset + 3] * (1 << 24) this.uint8View_[byteOffset + 3] * (1 << 24)
); );
} }
// #endif
} }
\ No newline at end of file
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
export class TFloat32Array { export class TFloat32Array {
test() { test() {
// #ifdef APP-ANDROID // #ifndef APP-IOS
this.testfloat32(); this.testfloat32();
this.testConstructor(); this.testConstructor();
this.testSet(); this.testSet();
...@@ -34,7 +34,7 @@ export class TFloat32Array { ...@@ -34,7 +34,7 @@ export class TFloat32Array {
this.arrayBufferSlice(); this.arrayBufferSlice();
// #endif // #endif
} }
// #ifdef APP-ANDROID // #ifndef APP-IOS
from() { from() {
var float32Array = Float32Array.from([1, 2, 3], (v : number, _ : number) : number => v + v); var float32Array = Float32Array.from([1, 2, 3], (v : number, _ : number) : number => v + v);
expect(float32Array.toString()).toEqual('2,4,6'); expect(float32Array.toString()).toEqual('2,4,6');
......
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
export class TFloat64Array { export class TFloat64Array {
test() { test() {
// #ifdef APP-ANDROID // #ifndef APP-IOS
this.testfloat64(); this.testfloat64();
this.testConstructor(); this.testConstructor();
this.testSet(); this.testSet();
...@@ -34,7 +34,7 @@ export class TFloat64Array { ...@@ -34,7 +34,7 @@ export class TFloat64Array {
this.arrayBufferSlice(); this.arrayBufferSlice();
// #endif // #endif
} }
// #ifdef APP-ANDROID // #ifndef APP-IOS
testfloat64() { testfloat64() {
let float64 = new Float64Array(2); let float64 = new Float64Array(2);
float64[0] = 42; float64[0] = 42;
......
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
export class TInt16Array { export class TInt16Array {
test() { test() {
// #ifdef APP-ANDROID // #ifndef APP-IOS
this.testConstructor(); this.testConstructor();
this.testSet(); this.testSet();
this.testCopyWith(); this.testCopyWith();
...@@ -34,7 +34,7 @@ export class TInt16Array { ...@@ -34,7 +34,7 @@ export class TInt16Array {
// #endif // #endif
} }
// #ifdef APP-ANDROID // #ifndef APP-IOS
testConstructor() { testConstructor() {
let buffer = new ArrayBuffer(16); let buffer = new ArrayBuffer(16);
let int16 = new Int16Array(buffer); let int16 = new Int16Array(buffer);
......
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
export class TInt32Array { export class TInt32Array {
test() { test() {
// #ifdef APP-ANDROID // #ifndef APP-IOS
this.testInt32Array(); this.testInt32Array();
this.testConstructor(); this.testConstructor();
this.testSet(); this.testSet();
...@@ -35,7 +35,7 @@ export class TInt32Array { ...@@ -35,7 +35,7 @@ export class TInt32Array {
// #endif // #endif
} }
// #ifdef APP-ANDROID // #ifndef APP-IOS
testInt32Array() { testInt32Array() {
let int32 = new Int32Array(2); let int32 = new Int32Array(2);
int32[0] = 42; int32[0] = 42;
......
...@@ -8,7 +8,7 @@ import { ...@@ -8,7 +8,7 @@ import {
export class TInt8Array { export class TInt8Array {
test() { test() {
// #ifdef APP-ANDROID // #ifndef APP-IOS
this.testConstructor(); this.testConstructor();
this.testSet(); this.testSet();
this.testCopyWith(); this.testCopyWith();
...@@ -35,7 +35,7 @@ export class TInt8Array { ...@@ -35,7 +35,7 @@ export class TInt8Array {
//#endif //#endif
} }
// #ifdef APP-ANDROID // #ifndef APP-IOS
testConstructor() { testConstructor() {
let buffer = new ArrayBuffer(16); let buffer = new ArrayBuffer(16);
let int8View = new Int8Array(buffer); let int8View = new Int8Array(buffer);
...@@ -294,7 +294,7 @@ export class TInt8Array { ...@@ -294,7 +294,7 @@ export class TInt8Array {
} }
arrayBufferSlice() { arrayBufferSlice() {
// #TEST ArrayBuffer.slice // #TEST ArrayBuffer.slice
let buffer = new ArrayBuffer(16); let buffer = new ArrayBuffer(16);
let int8 = new Int8Array(buffer); let int8 = new Int8Array(buffer);
...@@ -305,7 +305,7 @@ export class TInt8Array { ...@@ -305,7 +305,7 @@ export class TInt8Array {
let sliced = new Int8Array(res); let sliced = new Int8Array(res);
expect(sliced[0]).toEqual(42); expect(sliced[0]).toEqual(42);
// #END // #END
} }
testSome() { testSome() {
......
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
export class TUint8Array { export class TUint8Array {
test() { test() {
// #ifdef APP-ANDROID // #ifndef APP-IOS
this.testMAX(); this.testMAX();
this.testConstructor(); this.testConstructor();
this.testSet(); this.testSet();
...@@ -34,7 +34,7 @@ export class TUint8Array { ...@@ -34,7 +34,7 @@ export class TUint8Array {
this.arrayBufferSlice(); this.arrayBufferSlice();
// #endif // #endif
} }
// #ifdef APP-ANDROID // #ifndef APP-IOS
from() { from() {
var s = new Set([1, 2, 3]); var s = new Set([1, 2, 3]);
var unit8 = Uint8Array.from(s); var unit8 = Uint8Array.from(s);
......
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
export class TUint8ClampedArray { export class TUint8ClampedArray {
test() { test() {
// #ifdef APP-ANDROID // #ifndef APP-IOS
this.testMAX(); this.testMAX();
this.testConstructor(); this.testConstructor();
this.testSet(); this.testSet();
...@@ -35,7 +35,7 @@ export class TUint8ClampedArray { ...@@ -35,7 +35,7 @@ export class TUint8ClampedArray {
// #endif // #endif
} }
// #ifdef APP-ANDROID // #ifndef APP-IOS
testMAX() { testMAX() {
let uint8Clamped = new Uint8ClampedArray(16); let uint8Clamped = new Uint8ClampedArray(16);
uint8Clamped[0] = 255; uint8Clamped[0] = 255;
......
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
export class TUint16Array { export class TUint16Array {
test() { test() {
// #ifdef APP-ANDROID // #ifndef APP-IOS
this.testuint16(); this.testuint16();
this.testConstructor(); this.testConstructor();
this.testSet(); this.testSet();
...@@ -35,7 +35,7 @@ export class TUint16Array { ...@@ -35,7 +35,7 @@ export class TUint16Array {
// #endif // #endif
} }
// #ifdef APP-ANDROID // #ifndef APP-IOS
testuint16() { testuint16() {
let uint16 = new Uint16Array(2); let uint16 = new Uint16Array(2);
uint16[0] = 42; uint16[0] = 42;
......
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
export class TUint32Array { export class TUint32Array {
test() { test() {
// #ifdef APP-ANDROID // #ifndef APP-IOS
this.testuint32(); this.testuint32();
this.testConstructor(); this.testConstructor();
this.testSet(); this.testSet();
...@@ -35,7 +35,7 @@ export class TUint32Array { ...@@ -35,7 +35,7 @@ export class TUint32Array {
// #endif // #endif
} }
// #ifdef APP-ANDROID // #ifndef APP-IOS
testuint32() { testuint32() {
let uint32 = new Uint32Array(2); let uint32 = new Uint32Array(2);
uint32[0] = 42; uint32[0] = 42;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册