-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(android): add android bindings tests
- Loading branch information
1 parent
31fbb0d
commit e810258
Showing
4 changed files
with
420 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import uniffi.mopro.* | ||
|
||
var wasmPath = "../mopro-core/examples/circom/multiplier2/target/multiplier2_js/multiplier2.wasm" | ||
var r1csPath = "../mopro-core/examples/circom/multiplier2/target/multiplier2.r1cs" | ||
|
||
try { | ||
var moproCircom = MoproCircom() | ||
var setupResult = moproCircom.setup(wasmPath, r1csPath) | ||
assert(setupResult.provingKey.size > 0) { "Proving key should not be empty" } | ||
|
||
val inputs = mutableMapOf<String, List<String>>() | ||
inputs["a"] = listOf("3") | ||
inputs["b"] = listOf("5") | ||
|
||
var generateProofResult = moproCircom.generateProof(inputs) | ||
assert(generateProofResult.proof.size > 0) { "Proof is empty" } | ||
var isValid = moproCircom.verifyProof(generateProofResult.proof, generateProofResult.inputs) | ||
assert(isValid) { "Proof is invalid" } | ||
} catch (e: Exception) { | ||
println(e) | ||
} |
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,279 @@ | ||
import uniffi.mopro.* | ||
|
||
var wasmPath = | ||
"../mopro-core/examples/circom/keccak256/target/keccak256_256_test_js/keccak256_256_test.wasm" | ||
var r1csPath = "../mopro-core/examples/circom/keccak256/target/keccak256_256_test.r1cs" | ||
|
||
try { | ||
var moproCircom = MoproCircom() | ||
var setupResult = moproCircom.setup(wasmPath, r1csPath) | ||
assert(setupResult.provingKey.size > 0) { "Proving key should not be empty" } | ||
|
||
val inputs = mutableMapOf<String, List<String>>() | ||
inputs["in"] = | ||
listOf( | ||
"0", | ||
"0", | ||
"1", | ||
"0", | ||
"1", | ||
"1", | ||
"1", | ||
"0", | ||
"1", | ||
"0", | ||
"1", | ||
"0", | ||
"0", | ||
"1", | ||
"1", | ||
"0", | ||
"1", | ||
"1", | ||
"0", | ||
"0", | ||
"1", | ||
"1", | ||
"1", | ||
"0", | ||
"0", | ||
"0", | ||
"1", | ||
"0", | ||
"1", | ||
"1", | ||
"1", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0", | ||
"0" | ||
) | ||
|
||
var generateProofResult = moproCircom.generateProof(inputs) | ||
assert(generateProofResult.proof.size > 0) { "Proof is empty" } | ||
var isValid = moproCircom.verifyProof(generateProofResult.proof, generateProofResult.inputs) | ||
assert(isValid) { "Proof is invalid" } | ||
} catch (e: Exception) { | ||
println(e) | ||
} |
Oops, something went wrong.