diff --git a/Win32/Win32Demo/Win32Demo.cpp b/Win32/Win32Demo/Win32Demo.cpp index 7845c846..7d2dbf9f 100755 --- a/Win32/Win32Demo/Win32Demo.cpp +++ b/Win32/Win32Demo/Win32Demo.cpp @@ -428,6 +428,34 @@ void testNameSpace() { functionalTest(kv, false); } +void testImport() { + string mmapID = "test_import_src"; + auto src = MMKV::mmkvWithID(mmapID); + src->set(true, "bool"); + src->set(std::numeric_limits::min(), "int"); + src->set(std::numeric_limits::max(), "long"); + src->set("test import", "string"); + + auto dst = MMKV::mmkvWithID("test_import_dst"); + dst->clearAll(); + dst->enableAutoKeyExpire(1); + dst->set(true, "bool"); + dst->set(-1, "int"); + dst->set(0, "long"); + dst->set(mmapID, "string"); + + auto count = dst->importFrom(src); + assert(count == 4 && dst->count() == 4); + assert(dst->getBool("bool")); + assert(dst->getInt32("int") == std::numeric_limits::min()); + assert(dst->getUInt64("long") == std::numeric_limits::max()); + string result; + dst->getString("string", result); + assert(result == "test import"); + Sleep(2 * 1000); + assert(dst->count(true) == 0); +} + static void LogHandler(MMKVLogLevel level, const char *file, int line, const char *function, const std::string &message) { @@ -489,4 +517,5 @@ int main() { testExpectedCapacity(); testRemoveStorage(); testReadOnly(); + testImport(); } diff --git a/iOS/MMKV/MMKV.xcodeproj/project.pbxproj b/iOS/MMKV/MMKV.xcodeproj/project.pbxproj index 25b49f32..0cf760bb 100644 --- a/iOS/MMKV/MMKV.xcodeproj/project.pbxproj +++ b/iOS/MMKV/MMKV.xcodeproj/project.pbxproj @@ -609,7 +609,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 13.0; MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 2.2.0; + MARKETING_VERSION = 2.2.1; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvos appletvsimulator"; @@ -668,7 +668,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 13.0; MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 2.2.0; + MARKETING_VERSION = 2.2.1; MTL_ENABLE_DEBUG_INFO = NO; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvos appletvsimulator"; TVOS_DEPLOYMENT_TARGET = 13.0;