2022-06-15 06:20:34 +00:00
|
|
|
#include "GTestTask.h"
|
2022-09-23 14:10:37 +08:00
|
|
|
#include "GTestTask_ProxyTest.h"
|
2022-01-24 19:08:33 +08:00
|
|
|
#include "GTestTask_Task.h"
|
2022-09-09 13:10:20 +08:00
|
|
|
#include "PikaStdData_Dict.h"
|
2022-01-24 19:08:33 +08:00
|
|
|
|
2022-06-04 16:28:36 +08:00
|
|
|
static volatile uint64_t tick_ms = 0;
|
2022-01-24 19:08:33 +08:00
|
|
|
void GTestTask_Task_platformGetTick(PikaObj* self) {
|
2022-01-24 19:59:01 +08:00
|
|
|
tick_ms += 50;
|
2022-01-24 19:08:33 +08:00
|
|
|
obj_setInt(self, "tick", tick_ms);
|
|
|
|
}
|
2022-06-15 06:20:34 +00:00
|
|
|
|
2022-10-25 13:54:21 +08:00
|
|
|
void PikaStdTask_Task___init__(PikaObj* self);
|
|
|
|
void GTestTask_Task___init__(PikaObj *self){
|
|
|
|
PikaStdTask_Task___init__(self);
|
|
|
|
tick_ms = 0;
|
|
|
|
}
|
|
|
|
|
2022-06-15 06:20:34 +00:00
|
|
|
void GTestTask___init__(PikaObj* self) {
|
2022-06-15 14:49:17 +08:00
|
|
|
if (!obj_isArgExist(self, "testval")) {
|
|
|
|
obj_setInt(self, "testval", 8848);
|
|
|
|
} else {
|
|
|
|
obj_setInt(self, "testval", obj_getInt(self, "testval") + 1);
|
|
|
|
}
|
2022-06-15 06:20:34 +00:00
|
|
|
}
|
2022-07-06 10:54:04 +08:00
|
|
|
|
|
|
|
char* GTestTask_Task_returnNullString(PikaObj* self) {
|
2022-07-06 11:03:08 +08:00
|
|
|
obj_setErrorCode(self, 3);
|
|
|
|
__platform_printf("returnNullString\n");
|
2022-07-06 10:54:04 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
2022-09-07 14:25:25 +08:00
|
|
|
|
|
|
|
void GTestTask_test(PikaObj* self, int a, PikaObj* b) {
|
|
|
|
__platform_printf("GTestTask_test: %d, %lx\r\n", a, (uintptr_t)b);
|
|
|
|
}
|
2022-09-09 13:10:20 +08:00
|
|
|
|
|
|
|
PikaObj* GTestTask_test_dict(PikaObj* self) {
|
|
|
|
PikaObj* dict = newNormalObj(New_PikaStdData_Dict);
|
|
|
|
PikaStdData_Dict___init__(dict);
|
|
|
|
Arg* para1 = arg_newInt(1);
|
|
|
|
Arg* para2 = arg_newInt(2);
|
|
|
|
PikaStdData_Dict_set(dict, "para1", para1);
|
|
|
|
PikaStdData_Dict_set(dict, "para2", para2);
|
|
|
|
arg_deinit(para1);
|
|
|
|
arg_deinit(para2);
|
|
|
|
return dict;
|
|
|
|
}
|
2022-09-14 12:30:23 +08:00
|
|
|
|
2022-09-23 14:10:37 +08:00
|
|
|
int64_t GTestTask_test64(PikaObj* self, int64_t a, int64_t b) {
|
2022-09-14 12:30:23 +08:00
|
|
|
return a * b;
|
|
|
|
}
|
2022-09-23 14:10:37 +08:00
|
|
|
|
|
|
|
Arg* GTestTask_ProxyTest___getattribute__(PikaObj* self, char* __name) {
|
|
|
|
return arg_newStr(__name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GTestTask_ProxyTest___setattr__(PikaObj* self,
|
|
|
|
char* __name,
|
|
|
|
Arg* __value) {
|
|
|
|
__platform_printf("GTestTask_ProxyTest___setattr__: %s, %s\r\n", __name,
|
|
|
|
arg_getStr(__value));
|
|
|
|
}
|
2022-11-04 14:23:54 +08:00
|
|
|
|
|
|
|
void GTestTask_test_raise(PikaObj *self){
|
|
|
|
obj_setErrorCode(self, 1);
|
|
|
|
}
|