Skip to content

Commit

Permalink
fix: engine.Println to take strings (#419)
Browse files Browse the repository at this point in the history
* fix: engine.Println to take strings

* feat: test.engine.Println do negative ints
  • Loading branch information
Tabaie authored Dec 19, 2022
1 parent f2c263e commit 935ab13
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions test/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,18 @@ func (e *engine) Println(a ...frontend.Variable) {
}

for i := 0; i < len(a); i++ {
v := e.toBigInt(a[i])
sbb.WriteString(v.String())
if s, ok := a[i].(string); ok {
sbb.WriteString(s)
} else {
v := e.toBigInt(a[i])
var vAsNeg big.Int
vAsNeg.Sub(v, e.q)
if vAsNeg.IsInt64() {
sbb.WriteString(strconv.FormatInt(vAsNeg.Int64(), 10))
} else {
sbb.WriteString(v.String())
}
}
sbb.WriteByte(' ')
}
fmt.Println(sbb.String())
Expand Down

0 comments on commit 935ab13

Please sign in to comment.