test: Add test_008Contract_0004SetAndGetStringContractFuction
@@ -296,7 +296,36 @@ START_TEST(test_008Contract_0003SetAndGetUintContractFuction)
}
END_TEST
+START_TEST(test_008Contract_0004SetAndGetStringContractFuction)
+{
+ BoatEthTx tx_ctx;
+ BoatEthWallet *rtnVal;
+ BCHAR *result_str;
+ BOAT_RESULT result;
+ BoatFieldVariable parse_result = {NULL, 0};
+ BCHAR s[] = "AbCdEfGhIjKlMn";
+ BoatEthWalletConfig walletConfig = get_ethereum_wallet_settings();
+ /* 1. execute unit test */
+ rtnVal = BoatEthWalletInit(&walletConfig, sizeof(BoatEthWalletConfig));
+ ck_assert_ptr_ne(rtnVal, NULL);
+
+ result = BoatEthTxInit(rtnVal, &tx_ctx, BOAT_TRUE, NULL,
+ "0x333333",
+ (BCHAR *)TEST_CONTRACT_ADDRESS);
+ ck_assert_int_eq(result, BOAT_SUCCESS);
+
+ result_str = TestABIContract_setString(&tx_ctx, s);
+ ck_assert_ptr_ne(rtnVal, NULL);
+
+ result_str = TestABIContract_getString(&tx_ctx);
+ ck_assert_ptr_ne(rtnVal, NULL);
+ result = BoatEthParseRpcResponseStringResult(result_str, &parse_result);
+ ck_assert_int_eq(result, BOAT_SUCCESS);
+
+ BoatLog(BOAT_LOG_NORMAL, "readListByIndex returns: %s", parse_result.field_ptr);
+}
+END_TEST
Suite *make_general_suite(void)
{
@@ -324,6 +353,7 @@ Suite *make_general_suite(void)
tcase_add_test(tc_general_api, test_008Contract_0001CallNoneInputContractFuction);
tcase_add_test(tc_general_api, test_008Contract_0002SetAndGetBoolContractFuction);
tcase_add_test(tc_general_api, test_008Contract_0003SetAndGetUintContractFuction);
+ tcase_add_test(tc_general_api, test_008Contract_0004SetAndGetStringContractFuction);
return s_general;
