Allows pass signal arrays to a function

This commit is contained in:
Jordi Baylina
2020-11-26 07:22:59 +01:00
parent 334697dd0c
commit 9f15dd2e29
10 changed files with 133 additions and 22 deletions

View File

@@ -46,7 +46,7 @@ async function doTest(tester, circuit, testVectors) {
describe("basic cases", function () {
this.timeout(100000);
for (let i=0; i<basicCases.length; i++) {
for (let i=0; i< basicCases.length; i++) {
it("c/c++ " + basicCases[i].name, async () => {
await doTest(c_tester, basicCases[i].circuit, basicCases[i].tv);
});

View File

@@ -14,6 +14,17 @@
}]
]
},
{
"name": "fnarray",
"circuit": "fnarray.circom",
"tv": [
[{
"in": [1, 8, 25]
}, {
"out": [2, 16, 50]
}]
]
},
{
"name": "add",
"circuit": "add.circom",

View File

@@ -0,0 +1,21 @@
function calc(h) {
var res[3];
for (var i=0; i<3; i++) res[i] = h[i]*2;
return res;
}
template Test() {
signal input in[3];
signal output out[3];
var cout[3] = calc(in);
for (var i=0; i<3; i++) out[i] <-- cout[i];
for (var i=0; i<3; i++) out[i] === in[i]*2;
}
component main = Test();