-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhancement: Deprecating use of langspec (#367)
Co-authored-by: Michael Diamant <[email protected]>
- Loading branch information
1 parent
a0e5eb2
commit d9b2699
Showing
5 changed files
with
101 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/test/java/com/algorand/algosdk/unit/ProgramSanityCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.algorand.algosdk.unit; | ||
|
||
import com.algorand.algosdk.crypto.LogicsigSignature; | ||
import com.algorand.algosdk.util.Encoder; | ||
|
||
import io.cucumber.java.en.Given; | ||
import io.cucumber.java.en.Then; | ||
import io.cucumber.java.en.When; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class ProgramSanityCheck { | ||
byte[] seeminglyProgram; | ||
String actualErrMsg; | ||
|
||
@Given("a base64 encoded program bytes for heuristic sanity check {string}") | ||
public void takeB64encodedBytes(String b64encodedBytes) { | ||
seeminglyProgram = Encoder.decodeFromBase64(b64encodedBytes); | ||
} | ||
|
||
@When("I start heuristic sanity check over the bytes") | ||
public void heuristicCheckOverBytes() { | ||
try { | ||
new LogicsigSignature(seeminglyProgram); | ||
} catch (Exception e) { | ||
actualErrMsg = e.getMessage(); | ||
} | ||
} | ||
|
||
@Then("if the heuristic sanity check throws an error, the error contains {string}") | ||
public void checkErrorIfMatching(String errMsg) { | ||
if (errMsg != null && !errMsg.isEmpty()) | ||
assertThat(actualErrMsg).contains(errMsg); | ||
else | ||
assertThat(actualErrMsg).isNullOrEmpty(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters