test: add platone test case test_002InitWallet_0008SetNodeUrlFailureNodeUrlOutOfLimit
fix the issue aitos-io#1176
teambition task id:
@@ -735,6 +735,30 @@ START_TEST(test_002InitWallet_0007SetNodeUrlFailureErrorNodeUrlFormat)
}
END_TEST
+START_TEST(test_002InitWallet_0008SetNodeUrlFailureNodeUrlOutOfLimit)
+{
+ BSINT32 rtnVal;
+ BoatPlatoneWallet *wallet_ptr = BoatMalloc(sizeof(BoatPlatoneWallet));
+ char error_platone_node_url[EXCEED_STR_MAX_LEN];
+
+ for (int i = 0; i < EXCEED_STR_MAX_LEN; i++)
+ {
+ error_platone_node_url[i] = ':';
+ }
+
+ /* 1. execute unit test */
+ wallet_ptr->network_info.node_url_ptr = NULL;
+ rtnVal = BoatPlatoneWalletSetNodeUrl(wallet_ptr, error_platone_node_url);
+ /* 2. verify test result */
+ /* 2-1. verify the return value */
+ ck_assert_int_eq(rtnVal, BOAT_ERROR_COMMON_INVALID_ARGUMENT);
+
+ /* 2-2. verify the global variables that be affected */
+ ck_assert(wallet_ptr->network_info.node_url_ptr == NULL);
+ BoatFree(wallet_ptr);
+}
+END_TEST
+
Suite *make_wallet_suite(void)
{
/* Create Suite */
@@ -772,6 +796,7 @@ Suite *make_wallet_suite(void)
tcase_add_test(tc_wallet_api, test_002InitWallet_0005SetNodeUrlSuccess);
tcase_add_test(tc_wallet_api, test_002InitWallet_0006SetNodeUrlFailureNullParam);
tcase_add_test(tc_wallet_api, test_002InitWallet_0007SetNodeUrlFailureErrorNodeUrlFormat);
+ tcase_add_test(tc_wallet_api, test_002InitWallet_0008SetNodeUrlFailureNodeUrlOutOfLimit);
return s_wallet;
}
