Skip to content

Commit

Permalink
test: improve encoding benchmarks condition (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
abemedia authored May 14, 2023
1 parent 72e5d7d commit f4e1ba9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/test/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net/http"
"os"
"reflect"
"strconv"
"strings"
"testing"

Expand Down Expand Up @@ -99,7 +100,7 @@ func BenchmarkEncoding[T any](b *testing.B, opt EncodingOptions[T]) {
}

func BenchmarkDecode[T any](b *testing.B, opt EncodingOptions[T]) {
if os.Getenv("BENCHMARK_ENCODING") == "" {
if ok, _ := strconv.ParseBool(os.Getenv("BENCHMARK_ENCODING")); !ok {
b.SkipNow()
}

Expand All @@ -119,7 +120,7 @@ func BenchmarkDecode[T any](b *testing.B, opt EncodingOptions[T]) {
}

func BenchmarkEncode[T any](b *testing.B, opt EncodingOptions[T]) {
if os.Getenv("BENCHMARK_ENCODING") == "" {
if ok, _ := strconv.ParseBool(os.Getenv("BENCHMARK_ENCODING")); !ok {
b.SkipNow()
}

Expand Down

0 comments on commit f4e1ba9

Please sign in to comment.