Skip to content

Commit

Permalink
fix flashdb test assert
Browse files Browse the repository at this point in the history
  • Loading branch information
pikasTech committed Dec 7, 2023
1 parent 3efc448 commit be098b0
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions examples/flashdb/flashdb_kvdb1.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@

new_boot_count = struct.unpack("i", res)[0]
assert new_boot_count == boot_count
print('PASS')
1 change: 1 addition & 0 deletions examples/flashdb/flashdb_kvdb2.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@
print( "get the 'boot_count' value is %d" % new_boot_count)
print("===========================================================")
assert new_boot_count == boot_count
print('PASS')
2 changes: 1 addition & 1 deletion package/flashdb/flashdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def get_blob(self, key, size):
return None

def set_by_fmt(self, key, v, fmt):
if type(v) == type([]) or type(v) == type(()):
if type(v) == list or type(v) == tuple:
blob = struct.pack(fmt, *v)
return super().set_blob(key, blob)
if type(v) == type(0):
Expand Down
2 changes: 1 addition & 1 deletion port/linux/package/pikascript/flashdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def get_blob(self, key, size):
return None

def set_by_fmt(self, key, v, fmt):
if type(v) == type([]) or type(v) == type(()):
if type(v) == list or type(v) == tuple:
blob = struct.pack(fmt, *v)
return super().set_blob(key, blob)
if type(v) == type(0):
Expand Down
12 changes: 9 additions & 3 deletions port/linux/test/module-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,9 +788,15 @@ TEST(flashdb, base) {
EXPECT_EQ(test_flashdb(), 0);
}

TEST_RUN_SINGLE_FILE(flashdb, kvdb2, "test/python/flashdb/flashdb_kvdb2.py")

TEST_RUN_SINGLE_FILE(flashdb, kvdb1, "test/python/flashdb/flashdb_kvdb1.py")
TEST_RUN_SINGLE_FILE_EXCEPT_OUTPUT(flashdb,
kvdb2,
"test/python/flashdb/flashdb_kvdb2.py",
"PASS\r\n")

TEST_RUN_SINGLE_FILE_EXCEPT_OUTPUT(flashdb,
kvdb1,
"test/python/flashdb/flashdb_kvdb1.py",
"PASS\r\n")

#endif

Expand Down
1 change: 1 addition & 0 deletions port/linux/test/python/flashdb/flashdb_kvdb1.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@

new_boot_count = struct.unpack("i", res)[0]
assert new_boot_count == boot_count
print('PASS')
1 change: 1 addition & 0 deletions port/linux/test/python/flashdb/flashdb_kvdb2.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@
print( "get the 'boot_count' value is %d" % new_boot_count)
print("===========================================================")
assert new_boot_count == boot_count
print('PASS')
2 changes: 0 additions & 2 deletions port/linux/test/test_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,9 @@ void pikaScriptShell_withGetchar(PikaObj* self, sh_getchar getchar_fn);
extern unsigned char pikaModules_py_a[]; \
obj_linkLibrary(pikaMain, pikaModules_py_a); \
/* run */ \
__platform_printf("BEGIN\r\n"); \
pikaVM_runSingleFile(pikaMain, _file_name_); \
/* assert */ \
EXPECT_STREQ(log_buff[0], (_except_output_)); \
EXPECT_STREQ(log_buff[1], "BEGIN\r\n"); \
/* deinit */ \
obj_deinit(pikaMain); \
EXPECT_EQ(pikaMemNow(), 0); \
Expand Down
2 changes: 1 addition & 1 deletion src/PikaVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
#define PIKA_VERSION_MINOR 13
#define PIKA_VERSION_MICRO 0

#define PIKA_EDIT_TIME "2023/12/07 22:15:37"
#define PIKA_EDIT_TIME "2023/12/07 23:02:43"

0 comments on commit be098b0

Please sign in to comment.