Skip to content

Commit

Permalink
Move test_files to testdata and fix deprecation notices
Browse files Browse the repository at this point in the history
  • Loading branch information
OBrezhniev committed Apr 28, 2023
1 parent bb27e9f commit ff2a862
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module github.com/iden3/go-rapidsnark/tests
go 1.18

require (
github.com/iden3/go-rapidsnark/prover v0.0.6
github.com/iden3/go-rapidsnark/verifier v0.0.3
github.com/iden3/go-rapidsnark/prover v0.0.10
github.com/iden3/go-rapidsnark/verifier v0.0.5
github.com/stretchr/testify v1.8.2
)

Expand Down
30 changes: 15 additions & 15 deletions witness/circom2witnesscalc_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package witness

import (
"io/ioutil"
"os"
"testing"

"github.com/stretchr/testify/require"
Expand All @@ -10,10 +10,10 @@ import (
const defaultFileMode = 0644

func TestCircom2CalculateWitness(t *testing.T) {
wasmBytes, err := ioutil.ReadFile("test_files/circom2/circuit.wasm")
wasmBytes, err := os.ReadFile("testdata/circom2/circuit.wasm")
require.NoError(t, err)

inputBytes, err := ioutil.ReadFile("test_files/circom2/input.json")
inputBytes, err := os.ReadFile("testdata/circom2/input.json")
require.NoError(t, err)

calc, err := NewCircom2WitnessCalculator(wasmBytes, true)
Expand All @@ -29,10 +29,10 @@ func TestCircom2CalculateWitness(t *testing.T) {
}

func TestCircom2CalculateBinWitness(t *testing.T) {
wasmBytes, err := ioutil.ReadFile("test_files/circom2/circuit.wasm")
wasmBytes, err := os.ReadFile("testdata/circom2/circuit.wasm")
require.NoError(t, err)

inputBytes, err := ioutil.ReadFile("test_files/circom2/input.json")
inputBytes, err := os.ReadFile("testdata/circom2/input.json")
require.NoError(t, err)

calc, err := NewCircom2WitnessCalculator(wasmBytes, true)
Expand All @@ -48,10 +48,10 @@ func TestCircom2CalculateBinWitness(t *testing.T) {
}

func TestCircom2CalculateWTNSBin(t *testing.T) {
wasmBytes, err := ioutil.ReadFile("test_files/circom2/circuit.wasm")
wasmBytes, err := os.ReadFile("testdata/circom2/circuit.wasm")
require.NoError(t, err)

inputBytes, err := ioutil.ReadFile("test_files/circom2/input.json")
inputBytes, err := os.ReadFile("testdata/circom2/input.json")
require.NoError(t, err)

calc, err := NewCircom2WitnessCalculator(wasmBytes, true)
Expand All @@ -65,15 +65,15 @@ func TestCircom2CalculateWTNSBin(t *testing.T) {
require.NoError(t, err)
require.NotEmpty(t, wtnsBytes)

//_ = ioutil.WriteFile("test_files/circom2/witness.wtns", wtnsBytes, fs.FileMode(defaultFileMode))
//_ = os.WriteFile("testdata/circom2/witness.wtns", wtnsBytes, fs.FileMode(defaultFileMode))
}

// TestCircom2CalculateWitness210 tests the calculation of the witness for the circom 2.1.0
func TestCircom2CalculateWitness210(t *testing.T) {
wasmBytes, err := ioutil.ReadFile("test_files/circom2_1_0/circuit.wasm")
wasmBytes, err := os.ReadFile("testdata/circom2_1_0/circuit.wasm")
require.NoError(t, err)

inputBytes, err := ioutil.ReadFile("test_files/circom2_1_0/input.json")
inputBytes, err := os.ReadFile("testdata/circom2_1_0/input.json")
require.NoError(t, err)

calc, err := NewCircom2WitnessCalculator(wasmBytes, true)
Expand All @@ -90,10 +90,10 @@ func TestCircom2CalculateWitness210(t *testing.T) {

// TestCircom2CalculateBinWitness210 tests the calculation of the witness for the circom 2.1.0
func TestCircom2CalculateBinWitness210(t *testing.T) {
wasmBytes, err := ioutil.ReadFile("test_files/circom2_1_0/circuit.wasm")
wasmBytes, err := os.ReadFile("testdata/circom2_1_0/circuit.wasm")
require.NoError(t, err)

inputBytes, err := ioutil.ReadFile("test_files/circom2_1_0/input.json")
inputBytes, err := os.ReadFile("testdata/circom2_1_0/input.json")
require.NoError(t, err)

calc, err := NewCircom2WitnessCalculator(wasmBytes, true)
Expand All @@ -110,10 +110,10 @@ func TestCircom2CalculateBinWitness210(t *testing.T) {

// TestCircom2CalculateWTNSBin210 tests the calculation of the witness for the circom 2.1.0
func TestCircom2CalculateWTNSBin210(t *testing.T) {
wasmBytes, err := ioutil.ReadFile("test_files/circom2_1_0/circuit.wasm")
wasmBytes, err := os.ReadFile("testdata/circom2_1_0/circuit.wasm")
require.NoError(t, err)

inputBytes, err := ioutil.ReadFile("test_files/circom2_1_0/input.json")
inputBytes, err := os.ReadFile("testdata/circom2_1_0/input.json")
require.NoError(t, err)

calc, err := NewCircom2WitnessCalculator(wasmBytes, true)
Expand All @@ -127,5 +127,5 @@ func TestCircom2CalculateWTNSBin210(t *testing.T) {
require.NoError(t, err)
require.NotEmpty(t, wtnsBytes)

//_ = ioutil.WriteFile("test_files/circom2_1_0/witness.wtns", wtnsBytes, fs.FileMode(defaultFileMode))
//_ = os.WriteFile("testdata/circom2_1_0/witness.wtns", wtnsBytes, fs.FileMode(defaultFileMode))
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ff2a862

Please sign in to comment.