Skip to content

Commit

Permalink
add vector gen and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vmidyllic committed Mar 28, 2024
1 parent 1343185 commit 999beb2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
4 changes: 3 additions & 1 deletion test/linked/linked.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ describe("Test linkedMultiQuery10.circom", function () {

const basePath = '../../testvectorgen/credentials/linked/testdata/linked'
const tests = [
// sig

require(`${basePath}/one_query.json`),
require(`${basePath}/two_queries.json`),

];

tests.forEach(({ desc, inputs, expOut }) => {
Expand Down
21 changes: 18 additions & 3 deletions testvectorgen/credentials/linked/linked_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,26 @@ func Test_OneQuery(t *testing.T) {

queries := []Query{
{
Operator: 2, // lt
Operator: utils.LT, // lt
Values: []*big.Int{new(big.Int).SetInt64(20020101)},
},
}
generate(t, desc, "linked/one_query", 2, queries)
generate(t, desc, "linked/one_query", queries)
}
func Test_TwoQueries(t *testing.T) {
desc := "Linked query count: 2, operator: LT , NE"

queries := []Query{
{
Operator: utils.LT,
Values: []*big.Int{new(big.Int).SetInt64(20020101)},
},
{
Operator: utils.NE,
Values: []*big.Int{new(big.Int).SetInt64(20030101)},
},
}
generate(t, desc, "linked/two_queries", queries)
}

// Query represents basic request to claim field with MTP and without
Expand All @@ -69,7 +84,7 @@ type Query struct {
Values []*big.Int
}

func generate(t *testing.T, desc string, fileName string, operator int, queries []Query) {
func generate(t *testing.T, desc string, fileName string, queries []Query) {
var err error

isJSONLD := true
Expand Down

0 comments on commit 999beb2

Please sign in to comment.