Skip to content

Commit

Permalink
update .gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
ericlagergren committed Apr 8, 2019
1 parent b4c50b8 commit 5c07ca9
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 8 deletions.
27 changes: 19 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,39 @@ _cgo_export.*

_testmain.go

# Artifacts, profiles, etc.
*.exe
*.test
*.prof

*.tags

.git
*.swp
*.txt
*.tags
old.*
tags
*.test
*.out
*.zip
*.gz

# Internal
literature/
j/
*.txt
fuzz/

# Fuzzing
fuzz/**/corpus
fuzz/**/crashers
fuzz/**/suppressions

# Benchmark artifacts
benchmarks/decbench
*.xml
*.class
*.gz
.idea/

# Development
internal/nat/

# Testing
x.bash
tags
*.decTest
*.decTest
37 changes: 37 additions & 0 deletions fuzz/SetString/SetString.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package fuzz

import (
"fmt"
"runtime/debug"

"github.com/ericlagergren/decimal"
)

func Fuzz(data []byte) int {
debug.SetTraceback("system")

d := new(decimal.Big)
d, ok := d.SetString(string(data))
if !ok {
if decimal.Regexp.Match(data) && d.Context.Err() == nil {
panic(fmt.Sprintf("should work: %q", data))
}
return 0
}
d2 := new(decimal.Big)
ds := d.String()
d2, ok = d2.SetString(ds)
if !ok {
panic(fmt.Sprintf("SetString(%q) == nil, false", ds))
}
if d.Cmp(d2) != 0 {
panic(fmt.Sprintf(`
got : %#v (%q)
wanted: %#v (%q)
`, d2, d2, d, d))
}
if !decimal.Regexp.Match(data) {
panic(fmt.Sprintf("got: %q", data))
}
return 1
}

0 comments on commit 5c07ca9

Please sign in to comment.