Ver Fonte

fix flashdb test assert

lyon1998 há 2 anos atrás
pai
commit
be098b033c

+ 1 - 0
examples/flashdb/flashdb_kvdb1.py

@@ -31,3 +31,4 @@ assert res is not None
 
 new_boot_count = struct.unpack("i", res)[0]      
 assert new_boot_count == boot_count
+print('PASS')

+ 1 - 0
examples/flashdb/flashdb_kvdb2.py

@@ -38,3 +38,4 @@ assert new_boot_count is not None
 print( "get the 'boot_count' value is %d" % new_boot_count)
 print("===========================================================")
 assert new_boot_count == boot_count
+print('PASS')

+ 1 - 1
package/flashdb/flashdb.py

@@ -12,7 +12,7 @@ class KVDB(_flashdb.KVDB):
         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):

+ 1 - 1
port/linux/package/pikascript/flashdb.py

@@ -12,7 +12,7 @@ class KVDB(_flashdb.KVDB):
         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):

+ 9 - 3
port/linux/test/module-test.cpp

@@ -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
 

+ 1 - 0
port/linux/test/python/flashdb/flashdb_kvdb1.py

@@ -31,3 +31,4 @@ assert res is not None
 
 new_boot_count = struct.unpack("i", res)[0]      
 assert new_boot_count == boot_count
+print('PASS')

+ 1 - 0
port/linux/test/python/flashdb/flashdb_kvdb2.py

@@ -38,3 +38,4 @@ assert new_boot_count is not None
 print( "get the 'boot_count' value is %d" % new_boot_count)
 print("===========================================================")
 assert new_boot_count == boot_count
+print('PASS')

+ 0 - 2
port/linux/test/test_common.h

@@ -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);                                      \

+ 1 - 1
src/PikaVersion.h

@@ -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"