test: Add CreateOneTimeWalletSuccess case
@@ -67,6 +67,38 @@ BoatPlatONWalletConfig get_platon_wallet_settings()
return wallet_config;
}
+START_TEST(test_001CreateWallet_0001CreateOneTimeWalletSuccess)
+{
+ BSINT32 rtnVal;
+ BoatPlatONWallet *g_platon_wallet_ptr = NULL;
+ BoatPlatONWalletConfig wallet = get_platon_wallet_settings();
+ extern BoatIotSdkContext g_boat_iot_sdk_context;
+
+ /* 1. execute unit test */
+ rtnVal = BoatWalletCreate(BOAT_PROTOCOL_PLATON, NULL, &wallet, sizeof(BoatPlatONWalletConfig));
+
+ /* 2. verify test result */
+ /* 2-1. verify the return value */
+ ck_assert_int_eq(rtnVal, 0);
+
+ /* 1. execute unit test */
+ rtnVal = BoatWalletCreate(BOAT_PROTOCOL_PLATON, NULL, &wallet, sizeof(BoatPlatONWalletConfig));
+
+ /* 2. verify test result */
+ /* 2-1. verify the return value */
+ ck_assert_int_eq(rtnVal, 1);
+
+ /* 2-2. verify the global variables that be affected */
+ ck_assert(g_boat_iot_sdk_context.wallet_list[0].is_used == true);
+ ck_assert(g_boat_iot_sdk_context.wallet_list[1].is_used == true);
+
+ g_platon_wallet_ptr = BoatGetWalletByIndex(rtnVal);
+ ck_assert(g_platon_wallet_ptr != NULL);
+ ck_assert(check_platon_wallet(g_platon_wallet_ptr) == BOAT_SUCCESS);
+ BoatIotSdkDeInit();
+}
+END_TEST
+
Suite *make_wallet_suite(void)
{
/* Create Suite */
@@ -78,7 +110,7 @@ Suite *make_wallet_suite(void)
/* Add a test case to the Suite */
suite_add_tcase(s_wallet, tc_wallet_api);
/* Test cases are added to the test set */
- // tcase_add_test(tc_wallet_api, test_001CreateWallet_0001CreateOneTimeWalletSuccess);
+ tcase_add_test(tc_wallet_api, test_001CreateWallet_0001CreateOneTimeWalletSuccess);
return s_wallet;
}
\ No newline at end of file
