提交 68ecb051 编写于 作者: lizhongyi_'s avatar lizhongyi_

调整部分示例避免iOS编译失败

上级 326c71dd
import { RequestTask, SyncOptions } from "./interface.uts";
import { RequestTask, SyncOptions, AsyncOptions, SyntaxResult, SyncResult, TestOptions } from "./interface.uts";
import { log } from "./utils.uts";
export type AsyncOptions = {
type : string;
success : (res : string) => void;
fail : (res : string) => void;
complete : (res : string) => void;
};
export type {
SyncOptions
} from "./interface.uts";
type SyntaxResult = {
name : string
};
type SyncResult = {
msg : string
}
/**
* 导出一个属性
......@@ -115,11 +98,6 @@ export async function testAsyncParam3(id : number, name : string, opts : AsyncOp
}
export type TestOptions = {
name : string;
callback : (res : string) => void;
};
export class Test {
id : number;
name : string;
......
......@@ -9,3 +9,23 @@ export interface RequestTask {
onCallback(callback : (res : string) => void) : void
sync(options : SyncOptions) : string
}
export type AsyncOptions = {
type : string;
success : (res : string) => void;
fail : (res : string) => void;
complete : (res : string) => void;
};
export type SyntaxResult = {
name : string
};
export type SyncResult = {
msg : string
}
export type TestOptions = {
name : string;
callback : (res : string) => void;
};
\ No newline at end of file
......@@ -23,6 +23,7 @@ const int16 = new TInt16Array()
export function testArrayBuffer() : Result {
return describe("ArrayBuffer", () => {
// #ifdef APP-ANDROID
//dataview start
test('dataview_constructor', () => {
tDataView.setConstructor()
......@@ -725,7 +726,7 @@ export function testArrayBuffer() : Result {
test('uint32_arrayBufferSlice', () => {
uint32.arrayBufferSlice()
})
// #endif
//uint32 end
})
}
\ No newline at end of file
......@@ -18,6 +18,7 @@ export class TDataView {
// this.setUint8();
// this.testMix();
}
// #ifdef APP-ANDROID
setConstructor() {
let buffer = new ArrayBuffer(16);
let dataview = new DataView(buffer);
......@@ -327,4 +328,5 @@ class LittleEndian {
this.uint8View_[byteOffset + 3] * (1 << 24)
);
}
// #endif
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import {
export class TFloat32Array {
test() {
// #ifdef APP-ANDROID
this.testfloat32();
this.testConstructor();
this.testSet();
......@@ -31,7 +32,9 @@ export class TFloat32Array {
this.subarray();
this.values();
this.arrayBufferSlice();
// #endif
}
// #ifdef APP-ANDROID
from(){
var float32Array= Float32Array.from([1, 2, 3], (v: number, _: number):number => v + v);
expect(float32Array.toString()).toEqual('2,4,6');
......@@ -285,4 +288,5 @@ export class TFloat32Array {
let sliced = new Float32Array(res);
expect(sliced[1]).toEqual(42);
}
// #endif
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import {
export class TFloat64Array {
test() {
// #ifdef APP-ANDROID
this.testfloat64();
this.testConstructor();
this.testSet();
......@@ -31,8 +32,9 @@ export class TFloat64Array {
this.subarray();
this.values();
this.arrayBufferSlice();
// #endif
}
// #ifdef APP-ANDROID
testfloat64() {
let float32 = new Float64Array(2);
float32[0] = 42;
......@@ -276,4 +278,5 @@ export class TFloat64Array {
let sliced = new Float64Array(res);
expect(sliced[0]).toEqual(42);
}
// #endif
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import {
export class TInt16Array {
test() {
// #ifdef APP-ANDROID
this.testConstructor();
this.testSet();
this.testCopyWith();
......@@ -30,9 +31,10 @@ export class TInt16Array {
this.subarray();
this.values();
this.arrayBufferSlice();
// #endif
}
// #ifdef APP-ANDROID
testConstructor() {
let buffer = new ArrayBuffer(16);
let float32 = new Int16Array(buffer);
......@@ -250,4 +252,5 @@ export class TInt16Array {
let sliced = new Int16Array(res);
expect(sliced[0]).toEqual(42);
}
// #endif
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import {
export class TInt32Array {
test() {
// #ifdef APP-ANDROID
this.testfloat32();
this.testConstructor();
this.testSet();
......@@ -31,8 +32,10 @@ export class TInt32Array {
this.subarray();
this.values();
this.arrayBufferSlice();
// #endif
}
// #ifdef APP-ANDROID
testfloat32() {
let float32 = new Int32Array(2);
float32[0] = 42;
......@@ -266,4 +269,5 @@ export class TInt32Array {
let sliced = new Int32Array(res);
expect(sliced[1]).toEqual(42);
}
// #endif
}
......@@ -8,6 +8,7 @@ import {
export class TInt8Array {
test() {
// #ifdef APP-ANDROID
this.testConstructor();
this.testSet();
this.testCopyWith();
......@@ -31,9 +32,10 @@ export class TInt8Array {
this.subarray();
this.values();
this.arrayBufferSlice();
//#endif
}
// #ifdef APP-ANDROID
testConstructor() {
let buffer = new ArrayBuffer(16);
let int8View = new Int8Array(buffer);
......@@ -261,4 +263,5 @@ export class TInt8Array {
let sliced = new Int8Array(res);
expect(sliced[0]).toEqual(42);
}
// #endif
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import {
export class TUint8Array {
test() {
// #ifdef APP-ANDROID
this.testMAX();
this.testConstructor();
this.testSet();
......@@ -31,7 +32,9 @@ export class TUint8Array {
this.subarray();
this.values();
this.arrayBufferSlice();
// #endif
}
// #ifdef APP-ANDROID
from() {
var s = new Set([1, 2, 3]);
var unit8 = Uint8Array.from(s);
......@@ -264,4 +267,5 @@ export class TUint8Array {
let sliced = new Uint8Array(res);
expect(sliced[0]).toEqual(42);
}
// #endif
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import {
export class TUint8ClampedArray {
test() {
// #ifdef APP-ANDROID
this.testMAX();
this.testConstructor();
this.testSet();
......@@ -31,8 +32,10 @@ export class TUint8ClampedArray {
this.subarray();
this.values();
this.arrayBufferSlice();
// #endif
}
// #ifdef APP-ANDROID
testMAX() {
let float32 = new Uint8ClampedArray(16);
float32[0] = 255;
......@@ -259,4 +262,5 @@ export class TUint8ClampedArray {
let sliced = new Uint8ClampedArray(res);
expect(sliced[0]).toEqual(42);
}
// #endif
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import {
export class TUint16Array {
test() {
// #ifdef APP-ANDROID
this.testfloat32();
this.testConstructor();
this.testSet();
......@@ -31,8 +32,10 @@ export class TUint16Array {
this.subarray();
this.values();
this.arrayBufferSlice();
// #endif
}
// #ifdef APP-ANDROID
testfloat32() {
let float32 = new Uint16Array(2);
float32[0] = 42;
......@@ -273,4 +276,6 @@ export class TUint16Array {
let sliced = new Uint16Array(res);
expect(sliced[0]).toEqual(42);
}
// #endif
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import {
export class TUint32Array {
test() {
// #ifdef APP-ANDROID
this.testfloat32();
this.testConstructor();
this.testSet();
......@@ -31,8 +32,10 @@ export class TUint32Array {
this.subarray();
this.values();
this.arrayBufferSlice();
// #endif
}
// #ifdef APP-ANDROID
testfloat32() {
let float32 = new Uint32Array(2);
float32[0] = 42;
......@@ -273,4 +276,5 @@ export class TUint32Array {
let sliced = new Uint32Array(res);
expect(sliced[1]).toEqual(42);
}
// #endif
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册