fix compile issue and flashdb test issue

This commit is contained in:
Lyon 2024-07-03 13:59:28 +08:00
parent 4e740fd2fa
commit 50d9920fa6
5 changed files with 23 additions and 7 deletions

View File

@ -17,17 +17,24 @@ toc = time.time() * 1000
assert ret == 0 assert ret == 0
sum_by_time = 0
def callback(tsl, user_data) -> int: def callback(tsl, user_data) -> int:
global sum_by_time
# print(tsl.get_time(), tsl.to_blob()) # print(tsl.get_time(), tsl.to_blob())
t = tsl.get_time() t = tsl.get_time()
blob_i = tsl.to_blob() blob_i = tsl.to_blob()
i = struct.unpack('i', blob_i)[0] i = struct.unpack('i', blob_i)[0]
print(t, i, user_data) print(t, i, user_data)
if user_data == 'user_data_by_time':
sum_by_time += i
return False # False: continue, True: stop return False # False: continue, True: stop
assert tsdb.tsl_iter(callback, 'user_data') == 0 assert tsdb.tsl_iter(callback, 'user_data') == 0
assert tsdb.tsl_iter_reverse(callback, 'user_data_reverse') == 0 assert tsdb.tsl_iter_reverse(callback, 'user_data_reverse') == 0
print('toc - tic', toc - tic)
assert tsdb.tsl_iter_by_time(tic, toc, callback, 'user_data_by_time') == 0 assert tsdb.tsl_iter_by_time(tic, toc, callback, 'user_data_by_time') == 0
assert sum_by_time == 45
print('PASS') print('PASS')

View File

@ -799,10 +799,12 @@ TEST_RUN_SINGLE_FILE_EXCEPT_OUTPUT(flashdb,
"test/python/flashdb/flashdb_kvdb2.py", "test/python/flashdb/flashdb_kvdb2.py",
"PASS\r\n") "PASS\r\n")
#if PIKA_FLOAT_TYPE_DOUBLE
TEST_RUN_SINGLE_FILE_EXCEPT_OUTPUT(flashdb, TEST_RUN_SINGLE_FILE_EXCEPT_OUTPUT(flashdb,
tsdb1, tsdb1,
"test/python/flashdb/flashdb_tsdb1.py", "test/python/flashdb/flashdb_tsdb1.py",
"PASS\r\n") "PASS\r\n")
#endif
#endif #endif

View File

@ -17,17 +17,24 @@ toc = time.time() * 1000
assert ret == 0 assert ret == 0
sum_by_time = 0
def callback(tsl, user_data) -> int: def callback(tsl, user_data) -> int:
global sum_by_time
# print(tsl.get_time(), tsl.to_blob()) # print(tsl.get_time(), tsl.to_blob())
t = tsl.get_time() t = tsl.get_time()
blob_i = tsl.to_blob() blob_i = tsl.to_blob()
i = struct.unpack('i', blob_i)[0] i = struct.unpack('i', blob_i)[0]
print(t, i, user_data) print(t, i, user_data)
if user_data == 'user_data_by_time':
sum_by_time += i
return False # False: continue, True: stop return False # False: continue, True: stop
assert tsdb.tsl_iter(callback, 'user_data') == 0 assert tsdb.tsl_iter(callback, 'user_data') == 0
assert tsdb.tsl_iter_reverse(callback, 'user_data_reverse') == 0 assert tsdb.tsl_iter_reverse(callback, 'user_data_reverse') == 0
print('toc - tic', toc - tic)
assert tsdb.tsl_iter_by_time(tic, toc, callback, 'user_data_by_time') == 0 assert tsdb.tsl_iter_by_time(tic, toc, callback, 'user_data_by_time') == 0
assert sum_by_time == 45
print('PASS') print('PASS')

View File

@ -138,9 +138,10 @@ struct PikaVMFrame {
pika_bool in_repl; pika_bool in_repl;
}; };
typedef PikaObj* (*NewFun)(Args* args);
struct PikaObj { struct PikaObj {
Args* list; Args* list;
void* constructor; NewFun constructor;
#if PIKA_GC_MARK_SWEEP_ENABLE #if PIKA_GC_MARK_SWEEP_ENABLE
PikaObj* gcNext; PikaObj* gcNext;
#endif #endif
@ -228,7 +229,6 @@ static inline void obj_clearFlag(PikaObj* self, uint16_t flag) {
#endif #endif
} }
typedef PikaObj* (*NewFun)(Args* args);
typedef PikaObj* (*InitFun)(PikaObj* self, Args* args); typedef PikaObj* (*InitFun)(PikaObj* self, Args* args);
typedef void (*Method)(PikaObj* self, Args* args); typedef void (*Method)(PikaObj* self, Args* args);
@ -395,7 +395,7 @@ Arg* obj_runMethodArg2(PikaObj* self, Arg* methodArg, Arg* arg1, Arg* arg2);
Arg* obj_runMethod0(PikaObj* self, char* methodName); Arg* obj_runMethod0(PikaObj* self, char* methodName);
Arg* obj_runMethod1(PikaObj* self, char* methodName, Arg* arg1); Arg* obj_runMethod1(PikaObj* self, char* methodName, Arg* arg1);
Arg* obj_runMethod2(PikaObj* self, char* methodName, Arg* arg1, Arg* arg2); Arg* obj_runMethod2(PikaObj* self, char* methodName, Arg* arg1, Arg* arg2);
PikaObj* New_PikaObj(void); PikaObj* New_PikaObj(Args* args);
PikaObj* New_PikaObj_noGC(void); PikaObj* New_PikaObj_noGC(void);
/* tools */ /* tools */
@ -745,7 +745,7 @@ const MethodProp floatMethod = {
#if defined(_WIN32) || \ #if defined(_WIN32) || \
(defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 6000000)) (defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 6000000)) || defined(__IAR_SYSTEMS_ICC__)
#define __BEFORE_MOETHOD_DEF \ #define __BEFORE_MOETHOD_DEF \
{ \ { \
._ = \ ._ = \

View File

@ -2,4 +2,4 @@
#define PIKA_VERSION_MINOR 13 #define PIKA_VERSION_MINOR 13
#define PIKA_VERSION_MICRO 3 #define PIKA_VERSION_MICRO 3
#define PIKA_EDIT_TIME "2024/07/03 00:31:02" #define PIKA_EDIT_TIME "2024/07/03 13:59:17"