arnaucube
arnaucube/go-snarkPublic Self-hosted repository
go-snark/circuitcompiler/circuit_test.go
circuitcompiler/circuit_test.goRaw
 1package circuitcompiler
 2
 3import (
 4	"fmt"
 5	"strings"
 6	"testing"
 7
 8	"github.com/stretchr/testify/assert"
 9)
10
11func TestCircuitParser(t *testing.T) {
12	/*
13		input:
14		def test():
15			y = x**3
16			return x + y + 5
17
18		flattened:
19			m1 = s1 * s1
20			m2 = m1 * s1
21			m3 = m2 + s1
22			out = m3 + 5
23	*/
24	raw := `
25	y = x^x
26	z = x + y
27	out = z + 5
28	`
29	parser := NewParser(strings.NewReader(raw))
30	res, err := parser.Parse()
31	assert.Nil(t, err)
32	fmt.Println(res)
33
34	// flat code
35	// flat code to R1CS
36}