Skip to content

Commit 83dc99e

Browse files
committed
add_TVM_Grammar_test
1 parent 7cd06a7 commit 83dc99e

File tree

3 files changed

+122
-122
lines changed

3 files changed

+122
-122
lines changed

src/test/java/stest/tron/wallet/contract/grammar/ContractGrammar001.java

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public class ContractGrammar001 {
4949
byte[] contractAddress = null;
5050

5151
ECKey ecKey1 = new ECKey(Utils.getRandom());
52-
byte[] asset016Address = ecKey1.getAddress();
53-
String testKeyForAssetIssue016 = ByteArray.toHexString(ecKey1.getPrivKeyBytes());
52+
byte[] grammarAddress = ecKey1.getAddress();
53+
String testKeyForGrammarAddress = ByteArray.toHexString(ecKey1.getPrivKeyBytes());
5454

5555

5656
@BeforeSuite
@@ -61,7 +61,7 @@ public void beforeSuite() {
6161

6262
@BeforeClass(enabled = true)
6363
public void beforeClass() {
64-
PublicMethed.printAddress(testKeyForAssetIssue016);
64+
PublicMethed.printAddress(testKeyForGrammarAddress);
6565
channelFull = ManagedChannelBuilder.forTarget(fullnode)
6666
.usePlaintext(true)
6767
.build();
@@ -78,7 +78,7 @@ public void beforeClass() {
7878
@Test(enabled = true)
7979
public void testGrammar001() {
8080
PublicMethed
81-
.sendcoin(asset016Address, 100000000000L, testNetAccountAddress, testNetAccountKey,
81+
.sendcoin(grammarAddress, 100000000000L, testNetAccountAddress, testNetAccountKey,
8282
blockingStubFull);
8383
String contractName = "FunctionSelector";
8484
String code = "608060405234801561001057600080fd5b50610105806100206000396000f30060806040526004"
@@ -98,13 +98,13 @@ public void testGrammar001() {
9898
+ ",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\""
9999
+ ":\"function\"}]";
100100
contractAddress = PublicMethed.deployContract(contractName, abi, code, "", maxFeeLimit,
101-
0L, 100, null, testKeyForAssetIssue016,
102-
asset016Address, blockingStubFull);
101+
0L, 100, null, testKeyForGrammarAddress,
102+
grammarAddress, blockingStubFull);
103103
String txid = "";
104104
String num = "true" + "," + "10";
105105
txid = PublicMethed.triggerContract(contractAddress,
106106
"select(bool,uint256)", num, false,
107-
0, maxFeeLimit, asset016Address, testKeyForAssetIssue016, blockingStubFull);
107+
0, maxFeeLimit, grammarAddress, testKeyForGrammarAddress, blockingStubFull);
108108
Optional<TransactionInfo> infoById = null;
109109
infoById = PublicMethed.getTransactionInfoById(txid, blockingStubFull);
110110
Long returnnumber = ByteArray.toLong(ByteArray.fromHexString(ByteArray.toHexString(
@@ -115,7 +115,7 @@ public void testGrammar001() {
115115
String num2 = "false" + "," + "10";
116116
txid = PublicMethed.triggerContract(contractAddress,
117117
"select(bool,uint256)", num2, false,
118-
0, maxFeeLimit, asset016Address, testKeyForAssetIssue016, blockingStubFull);
118+
0, maxFeeLimit, grammarAddress, testKeyForGrammarAddress, blockingStubFull);
119119
infoById = PublicMethed.getTransactionInfoById(txid, blockingStubFull);
120120
Long returnnumber2 = ByteArray.toLong(ByteArray.fromHexString(
121121
ByteArray.toHexString(infoById.get().getContractResult(0).toByteArray())));
@@ -148,8 +148,8 @@ public void testGrammar002() {
148148
+ "\"insert\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\""
149149
+ "stateMutability\":\"nonpayable\",\"type\":\"function\"}]";
150150
contractAddress = PublicMethed.deployContract(contractName, abi, code, "", maxFeeLimit,
151-
0L, 100, null, testKeyForAssetIssue016,
152-
asset016Address, blockingStubFull);
151+
0L, 100, null, testKeyForGrammarAddress,
152+
grammarAddress, blockingStubFull);
153153
String txid = "";
154154
String num = "1";
155155
byte[] contractAddress1 = null;
@@ -169,11 +169,11 @@ public void testGrammar002() {
169169
String libraryAddress =
170170
"browser/TvmTest_p1_Grammar_002.sol:S:" + Base58.encode58Check(contractAddress);
171171
contractAddress1 = PublicMethed.deployContract(contractName1, abi1, code1, "", maxFeeLimit,
172-
0L, 100, libraryAddress, testKeyForAssetIssue016,
173-
asset016Address, blockingStubFull);
172+
0L, 100, libraryAddress, testKeyForGrammarAddress,
173+
grammarAddress, blockingStubFull);
174174
txid = PublicMethed.triggerContract(contractAddress1,
175175
"register(uint256)", num, false,
176-
0, maxFeeLimit, asset016Address, testKeyForAssetIssue016, blockingStubFull);
176+
0, maxFeeLimit, grammarAddress, testKeyForGrammarAddress, blockingStubFull);
177177
Optional<TransactionInfo> infoById = null;
178178
infoById = PublicMethed.getTransactionInfoById(txid, blockingStubFull1);
179179

@@ -205,8 +205,8 @@ public void testGrammar003() {
205205
+ ":\"insert\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\""
206206
+ "stateMutability\":\"nonpayable\",\"type\":\"function\"}]";
207207
contractAddress = PublicMethed.deployContract(contractName, abi, code, "", maxFeeLimit,
208-
0L, 100, null, testKeyForAssetIssue016,
209-
asset016Address, blockingStubFull);
208+
0L, 100, null, testKeyForGrammarAddress,
209+
grammarAddress, blockingStubFull);
210210
String txid = "";
211211
String num = "1";
212212
byte[] contractAddress1 = null;
@@ -225,11 +225,11 @@ public void testGrammar003() {
225225
String libraryAddress =
226226
"browser/TvmTest_p1_Grammar_003.sol:S:" + Base58.encode58Check(contractAddress);
227227
contractAddress1 = PublicMethed.deployContract(contractName1, abi1, code1, "", maxFeeLimit,
228-
0L, 100, libraryAddress, testKeyForAssetIssue016,
229-
asset016Address, blockingStubFull);
228+
0L, 100, libraryAddress, testKeyForGrammarAddress,
229+
grammarAddress, blockingStubFull);
230230
txid = PublicMethed.triggerContract(contractAddress1,
231231
"register(uint256)", num, false,
232-
0, maxFeeLimit, asset016Address, testKeyForAssetIssue016, blockingStubFull);
232+
0, maxFeeLimit, grammarAddress, testKeyForGrammarAddress, blockingStubFull);
233233
Optional<TransactionInfo> infoById = null;
234234
infoById = PublicMethed.getTransactionInfoById(txid, blockingStubFull1);
235235

@@ -252,8 +252,8 @@ public void testGrammar004() {
252252
+ "[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\""
253253
+ "nonpayable\",\"type\":\"function\"}]";
254254
contractAddress = PublicMethed.deployContract(contractName, abi, code, "", maxFeeLimit,
255-
0L, 100, null, testKeyForAssetIssue016,
256-
asset016Address, blockingStubFull);
255+
0L, 100, null, testKeyForGrammarAddress,
256+
grammarAddress, blockingStubFull);
257257
String txid = "";
258258
String num = "1";
259259
byte[] contractAddress1 = null;
@@ -289,15 +289,15 @@ public void testGrammar004() {
289289
libraryAddress =
290290
"browser/TvmTest_p1_Grammar_004.sol:S:" + Base58.encode58Check(contractAddress);
291291
contractAddress1 = PublicMethed.deployContract(contractName1, abi1, code1, "", maxFeeLimit,
292-
0L, 100, libraryAddress, testKeyForAssetIssue016,
293-
asset016Address, blockingStubFull);
292+
0L, 100, libraryAddress, testKeyForGrammarAddress,
293+
grammarAddress, blockingStubFull);
294294
txid = PublicMethed.triggerContract(contractAddress1,
295295
"append(uint256)", num, false,
296-
0, maxFeeLimit, asset016Address, testKeyForAssetIssue016, blockingStubFull);
296+
0, maxFeeLimit, grammarAddress, testKeyForGrammarAddress, blockingStubFull);
297297
String num1 = "0";
298298
String txid1 = PublicMethed.triggerContract(contractAddress1,
299299
"getData(uint256)", num1, false,
300-
0, maxFeeLimit, asset016Address, testKeyForAssetIssue016, blockingStubFull);
300+
0, maxFeeLimit, grammarAddress, testKeyForGrammarAddress, blockingStubFull);
301301
Optional<TransactionInfo> infoById = null;
302302
infoById = PublicMethed.getTransactionInfoById(txid1, blockingStubFull);
303303
Long returnnumber = ByteArray.toLong(ByteArray
@@ -308,13 +308,13 @@ public void testGrammar004() {
308308
String num2 = "1" + "," + "2";
309309
String txid2 = PublicMethed.triggerContract(contractAddress1,
310310
"replace(uint256,uint256)", num2, false,
311-
0, maxFeeLimit, asset016Address, testKeyForAssetIssue016, blockingStubFull);
311+
0, maxFeeLimit, grammarAddress, testKeyForGrammarAddress, blockingStubFull);
312312
Optional<TransactionInfo> infoById2 = null;
313313
infoById2 = PublicMethed.getTransactionInfoById(txid2, blockingStubFull);
314314
Assert.assertTrue(infoById2.get().getResultValue() == 0);
315315
String txid3 = PublicMethed.triggerContract(contractAddress1,
316316
"getData(uint256)", num1, false,
317-
0, maxFeeLimit, asset016Address, testKeyForAssetIssue016, blockingStubFull);
317+
0, maxFeeLimit, grammarAddress, testKeyForGrammarAddress, blockingStubFull);
318318
Optional<TransactionInfo> infoById1 = null;
319319
infoById1 = PublicMethed.getTransactionInfoById(txid3, blockingStubFull);
320320
Long returnnumber1 = ByteArray.toLong(ByteArray
@@ -352,67 +352,67 @@ public void testGrammar006() {
352352
+ "\":[{\"name\":\"x\",\"type\":\"uint256\"}],\"name\":\"d2\",\"outputs\":[],\"payable"
353353
+ "\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]";
354354
contractAddress = PublicMethed.deployContract(contractName, abi, code, "", maxFeeLimit,
355-
0L, 100, null, testKeyForAssetIssue016,
356-
asset016Address, blockingStubFull);
355+
0L, 100, null, testKeyForGrammarAddress,
356+
grammarAddress, blockingStubFull);
357357
String txid = "";
358358
String number = "1";
359359
String txid1 = PublicMethed.triggerContract(contractAddress,
360360
"f(uint256)", number, false,
361-
0, maxFeeLimit, asset016Address, testKeyForAssetIssue016, blockingStubFull);
361+
0, maxFeeLimit, grammarAddress, testKeyForGrammarAddress, blockingStubFull);
362362
Optional<TransactionInfo> infoById1 = PublicMethed
363363
.getTransactionInfoById(txid1, blockingStubFull1);
364364

365365
Assert.assertTrue(infoById1.get().getResultValue() == 0);
366366

367367
String txid2 = PublicMethed.triggerContract(contractAddress,
368368
"d(bytes32)", number, false,
369-
0, maxFeeLimit, asset016Address, testKeyForAssetIssue016, blockingStubFull);
369+
0, maxFeeLimit, grammarAddress, testKeyForGrammarAddress, blockingStubFull);
370370
Optional<TransactionInfo> infoById2 = PublicMethed
371371
.getTransactionInfoById(txid2, blockingStubFull1);
372372

373373
Assert.assertTrue(infoById2.get().getResultValue() == 0);
374374

375375
String txid3 = PublicMethed.triggerContract(contractAddress,
376376
"d1(bytes32)", number, false,
377-
0, maxFeeLimit, asset016Address, testKeyForAssetIssue016, blockingStubFull);
377+
0, maxFeeLimit, grammarAddress, testKeyForGrammarAddress, blockingStubFull);
378378
Optional<TransactionInfo> infoById3 = PublicMethed
379379
.getTransactionInfoById(txid3, blockingStubFull1);
380380

381381
Assert.assertTrue(infoById3.get().getResultValue() == 0);
382382

383383
String txid4 = PublicMethed.triggerContract(contractAddress,
384384
"d2(bytes32)", number, false,
385-
0, maxFeeLimit, asset016Address, testKeyForAssetIssue016, blockingStubFull);
385+
0, maxFeeLimit, grammarAddress, testKeyForGrammarAddress, blockingStubFull);
386386
Optional<TransactionInfo> infoById4 = PublicMethed
387387
.getTransactionInfoById(txid4, blockingStubFull1);
388388

389389
Assert.assertTrue(infoById4.get().getResultValue() == 0);
390390

391391
String txid5 = PublicMethed.triggerContract(contractAddress,
392392
"d3(bytes32)", number, false,
393-
0, maxFeeLimit, asset016Address, testKeyForAssetIssue016, blockingStubFull);
393+
0, maxFeeLimit, grammarAddress, testKeyForGrammarAddress, blockingStubFull);
394394
Optional<TransactionInfo> infoById5 = PublicMethed
395395
.getTransactionInfoById(txid5, blockingStubFull1);
396396

397397
Assert.assertTrue(infoById5.get().getResultValue() == 0);
398398

399399
String txid6 = PublicMethed.triggerContract(contractAddress,
400400
"d4(bytes32)", number, false,
401-
0, maxFeeLimit, asset016Address, testKeyForAssetIssue016, blockingStubFull);
401+
0, maxFeeLimit, grammarAddress, testKeyForGrammarAddress, blockingStubFull);
402402
Optional<TransactionInfo> infoById6 = PublicMethed
403403
.getTransactionInfoById(txid6, blockingStubFull1);
404404

405405
Assert.assertTrue(infoById6.get().getResultValue() == 0);
406406

407407
String txid7 = PublicMethed.triggerContract(contractAddress,
408408
"d7(bytes32)", number, false,
409-
0, maxFeeLimit, asset016Address, testKeyForAssetIssue016, blockingStubFull);
409+
0, maxFeeLimit, grammarAddress, testKeyForGrammarAddress, blockingStubFull);
410410
Optional<TransactionInfo> infoById7 = PublicMethed
411411
.getTransactionInfoById(txid7, blockingStubFull1);
412412
Assert.assertTrue(infoById7.get().getResultValue() == 0);
413413
String txid8 = PublicMethed.triggerContract(contractAddress,
414414
"d6(bytes32)", number, false,
415-
0, maxFeeLimit, asset016Address, testKeyForAssetIssue016, blockingStubFull);
415+
0, maxFeeLimit, grammarAddress, testKeyForGrammarAddress, blockingStubFull);
416416
Optional<TransactionInfo> infoById8 = PublicMethed
417417
.getTransactionInfoById(txid8, blockingStubFull1);
418418
Assert.assertTrue(infoById8.get().getResultValue() == 0);

0 commit comments

Comments
 (0)