examples: add sum example (its not pretty)

This commit is contained in:
Michael McLoughlin
2018-12-11 23:02:50 -08:00
parent 19d1761694
commit 2189d38d1e
6 changed files with 71 additions and 4 deletions

20
examples/sum/sum_test.go Normal file
View File

@@ -0,0 +1,20 @@
package sum
import (
"testing"
"testing/quick"
)
//go:generate go run asm.go -out sum.s -stubs stub.go
func expect(xs []uint64) uint64 {
var s uint64
for _, x := range xs {
s += x
}
return s
}
func TestSum(t *testing.T) {
quick.CheckEqual(Sum, expect, nil)
}