Fix Emoji benchmark

The Emoji implementations gives slightly different output. One of them pads with a space.
This commit is contained in:
Bjørn Erik Pedersen 2016-07-01 17:59:39 +02:00
parent aa66478c20
commit 6c0f705217

View file

@ -13,6 +13,7 @@
package helpers
import (
"math"
"reflect"
"strings"
"testing"
@ -129,7 +130,10 @@ func doBenchmarkEmoji(b *testing.B, f func(in []byte) []byte) {
currIn := in[cnt]
cnt++
result := f(currIn.in)
if len(result) != len(currIn.expect) {
// The Emoji implementations gives slightly different output.
diffLen := len(result) - len(currIn.expect)
diffLen = int(math.Abs(float64(diffLen)))
if diffLen > 30 {
b.Fatalf("[%d] emoji std, got \n%q but expected \n%q", j, result, currIn.expect)
}
}