MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / BenchmarkJSONStringUtils

Function BenchmarkJSONStringUtils

base/util_test.go:72–94  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

70}
71
72func BenchmarkJSONStringUtils(b *testing.B) {
73 tests := []struct {
74 input string
75 output string
76 }{
77 {`test`, `"test"`},
78 {`"test"`, `"\"test\""`},
79 {"\x00", `"\u0000"`},
80 }
81
82 for _, test := range tests {
83 b.Run("ConvertToJSONString "+test.input, func(b *testing.B) {
84 for i := 0; i < b.N; i++ {
85 _ = ConvertToJSONString(test.input)
86 }
87 })
88 b.Run("ConvertJSONString "+test.input, func(b *testing.B) {
89 for i := 0; i < b.N; i++ {
90 _ = ConvertJSONString(test.output)
91 }
92 })
93 }
94}
95
96func TestConvertBackQuotedStrings(t *testing.T) {
97 tests := []struct {

Callers

nothing calls this directly

Calls 3

ConvertToJSONStringFunction · 0.85
ConvertJSONStringFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected