test: add ethereum test case
test_002InitWallet_0015SetNodeUrlFailureErrorNodeUrlFormat
@@ -322,7 +322,7 @@ START_TEST(test_002InitWallet_0013SetNodeUrlSuccess)
}
END_TEST
-START_TEST(test_002InitWallet_0014SSetNodeUrlFailureNullParam)
+START_TEST(test_002InitWallet_0014SetNodeUrlFailureNullParam)
{
BSINT32 rtnVal;
BoatEthWallet *wallet_ptr = BoatMalloc(sizeof(BoatEthWallet));
@@ -360,6 +360,26 @@ START_TEST(test_002InitWallet_0014SSetNodeUrlFailureNullParam)
}
END_TEST
+START_TEST(test_002InitWallet_0015SetNodeUrlFailureErrorNodeUrlFormat)
+{
+ BSINT32 rtnVal;
+ BoatEthWallet *wallet_ptr = BoatMalloc(sizeof(BoatEthWallet));
+ BoatEthWalletConfig wallet_config;
+
+ /* 1. execute unit test */
+ strncpy(wallet_config.node_url_str, "abcd", strlen("abcd"));
+ wallet_ptr->network_info.node_url_ptr = NULL;
+ rtnVal = BoatEthWalletSetNodeUrl(wallet_ptr, wallet_config.node_url_str);
+ /* 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);
+
+}
+END_TEST
+
Suite *make_wallet_suite(void)
{
/* Create Suite */
@@ -384,7 +404,8 @@ Suite *make_wallet_suite(void)
tcase_add_test(tc_wallet_api, test_002InitWallet_0011SetChainIdSuccess);
tcase_add_test(tc_wallet_api, test_002InitWallet_0012SetChainIdFailureNullParam);
tcase_add_test(tc_wallet_api, test_002InitWallet_0013SetNodeUrlSuccess);
- tcase_add_test(tc_wallet_api, test_002InitWallet_0014SSetNodeUrlFailureNullParam);
+ tcase_add_test(tc_wallet_api, test_002InitWallet_0014SetNodeUrlFailureNullParam);
+ tcase_add_test(tc_wallet_api, test_002InitWallet_0015SetNodeUrlFailureErrorNodeUrlFormat);
return s_wallet;
}
