mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Merge branch 'master'
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { assert, assertEqual, assertFalse, assertNull, assertTrue, assertThrows } from "../TKUnit";
|
||||
import { enable, disable, profile, time, start, stop, timer, isRunning, resetProfiles } from "tns-core-modules/profiling";
|
||||
import { assert, assertEqual, assertFalse, assertNull, assertTrue, assertThrows } from "../tk-unit";
|
||||
import { enable, disable, profile, time, start, stop, timer, isRunning, resetProfiles } from "@nativescript/core/profiling";
|
||||
|
||||
enable();
|
||||
class TestClass {
|
||||
@@ -50,6 +50,7 @@ function retry(count: number, action: () => void) {
|
||||
for (var i = 1; i <= count; i++) {
|
||||
try {
|
||||
action();
|
||||
|
||||
return;
|
||||
} catch (e) {
|
||||
if (i === count) {
|
||||
@@ -61,7 +62,7 @@ function retry(count: number, action: () => void) {
|
||||
|
||||
export function test_time_returns_number() {
|
||||
assertEqual(typeof time(), "number");
|
||||
};
|
||||
}
|
||||
|
||||
export function test_isRunning() {
|
||||
resetProfiles();
|
||||
@@ -121,7 +122,7 @@ export function test_start_stop() {
|
||||
const res = timer(name);
|
||||
|
||||
assertEqual(res.count, 1);
|
||||
};
|
||||
}
|
||||
|
||||
export function test_start_stop_count() {
|
||||
resetProfiles();
|
||||
@@ -134,7 +135,7 @@ export function test_start_stop_count() {
|
||||
|
||||
const res = timer(name);
|
||||
assertEqual(res.count, 10);
|
||||
};
|
||||
}
|
||||
|
||||
export function test_profile_decorator_count() {
|
||||
resetProfiles();
|
||||
@@ -178,7 +179,7 @@ export function test_start_stop_performance() {
|
||||
assertEqual(res.count, count);
|
||||
assert(res.totalTime <= 500, `Total time for ${count} timer operations is too much: ${res.totalTime}`);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function test_profile_decorator_performance() {
|
||||
retry(5, () => {
|
||||
|
||||
Reference in New Issue
Block a user