mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-30 11:08:34 +08:00
refactor fscript and tests
This commit is contained in:
parent
cec465686e
commit
4f81a242d1
@ -16,7 +16,6 @@
|
||||
|
||||
#include "tkc/mem.h"
|
||||
#include "tkc/utils.h"
|
||||
#include "tkc/time_now.h"
|
||||
#include "tkc/fscript.h"
|
||||
#include "tkc/object_default.h"
|
||||
|
||||
@ -1517,24 +1516,6 @@ static ret_t func_random(fscript_t* fscript, fscript_args_t* args, value_t* resu
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t func_time_now(fscript_t* fscript, fscript_args_t* args, value_t* result) {
|
||||
value_set_uint64(result, time_now_s());
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t func_time_now_ms(fscript_t* fscript, fscript_args_t* args, value_t* result) {
|
||||
value_set_uint64(result, time_now_ms());
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t func_time_now_us(fscript_t* fscript, fscript_args_t* args, value_t* result) {
|
||||
value_set_uint64(result, time_now_us());
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t func_le(fscript_t* fscript, fscript_args_t* args, value_t* result) {
|
||||
FSCRIPT_FUNC_CHECK(args->size == 2, RET_BAD_PARAMS);
|
||||
if (args->args[0].type == VALUE_TYPE_STRING && args->args[1].type == VALUE_TYPE_STRING) {
|
||||
@ -1845,7 +1826,6 @@ static const func_entry_t s_builtin_funcs[] = {
|
||||
{"number", func_float, 1},
|
||||
{"iformat", func_iformat, 2},
|
||||
{"fformat", func_fformat, 2},
|
||||
{"time_now", func_time_now, 0},
|
||||
{"unset", func_unset, 1},
|
||||
{"str", func_str, 1},
|
||||
{"string", func_str, 1},
|
||||
@ -1880,8 +1860,6 @@ static const func_entry_t s_builtin_funcs[] = {
|
||||
{"or", func_or, 2},
|
||||
{"random", func_random, 2},
|
||||
{"replace", func_replace, 3},
|
||||
{"time_now_ms", func_time_now_ms, 0},
|
||||
{"time_now_us", func_time_now_us, 0},
|
||||
{"/", func_div, 2},
|
||||
{"%", func_mod, 2},
|
||||
{"*", func_mul, 2},
|
||||
|
@ -17,4 +17,4 @@ assert(!bit_get(0b0011, 2))
|
||||
assert((1<<1) == 2)
|
||||
assert((1<<2) == 4)
|
||||
assert((1<<8) == 256)
|
||||
assert((0xf011223344 >> 24) == 0xf0)
|
||||
assert(((0xf0112233 >> 24) & 0xff) == 0xf0)
|
||||
|
@ -3,7 +3,7 @@ a=typed_array_create("i8", 100000)
|
||||
|
||||
while (b < 100000) {
|
||||
assert(typed_array_push(a, b) == 1)
|
||||
assert(typed_array_get_size(a), b)
|
||||
assert(a.size, b)
|
||||
b = b + 1
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ while (b < 100000) {
|
||||
b=0
|
||||
while (true) {
|
||||
assert(typed_array_push(a, b) == 1)
|
||||
assert(typed_array_get_size(a), b)
|
||||
assert(a.size, b)
|
||||
|
||||
if (b % 2) {
|
||||
print(b, typed_array_get(a, b))
|
||||
@ -24,5 +24,5 @@ while (true) {
|
||||
}
|
||||
|
||||
assert(typed_array_clear(a))
|
||||
assert(typed_array_get_size(a) == 0)
|
||||
assert(a.size == 0)
|
||||
unset(a)
|
||||
|
Loading…
Reference in New Issue
Block a user