diff --git a/strings_test.go b/strings_test.go index a30bbff..5b0fece 100644 --- a/strings_test.go +++ b/strings_test.go @@ -27,15 +27,15 @@ func Benchmark_ToUpper(b *testing.B) { }) b.Run("IfToUpper-Upper", func(b *testing.B) { for n := 0; n < b.N; n++ { - res = IfToUpper(upperStr) + res = IfToUpper("/REPOS/GOFIBER/FIBER/ISSUES/187643/COMMENTS") } - require.Equal(b, upperStr, res) + AssertEqual(b, "/REPOS/GOFIBER/FIBER/ISSUES/187643/COMMENTS", res) }) b.Run("IfToUpper-Mixed", func(b *testing.B) { for n := 0; n < b.N; n++ { - res = IfToUpper(largeStr) + res = IfToUpper(path) } - require.Equal(b, upperStr, res) + AssertEqual(b, "/REPOS/GOFIBER/FIBER/ISSUES/187643/COMMENTS", res) }) b.Run("default", func(b *testing.B) { for n := 0; n < b.N; n++ { @@ -70,15 +70,15 @@ func Benchmark_ToLower(b *testing.B) { }) b.Run("IfToLower-Lower", func(b *testing.B) { for n := 0; n < b.N; n++ { - res = IfToLower(lowerStr) + res = IfToLower("/repos/gofiber/fiber/issues/187643/comments") } - require.Equal(b, lowerStr, res) + AssertEqual(b, "/repos/gofiber/fiber/issues/187643/comments", res) }) b.Run("IfToLower-Mixed", func(b *testing.B) { for n := 0; n < b.N; n++ { - res = IfToLower(largeStr) + res = IfToLower(path) } - require.Equal(b, lowerStr, res) + AssertEqual(b, "/repos/gofiber/fiber/issues/187643/comments", res) }) b.Run("default", func(b *testing.B) { for n := 0; n < b.N; n++ { @@ -174,17 +174,17 @@ func Benchmark_Trim(b *testing.B) { func Test_IfToUpper(t *testing.T) { t.Parallel() - require.Equal(t, "MYNAMEISPARAM", IfToUpper("MYNAMEISPARAM")) // already uppercase - require.Equal(t, "MYNAMEISPARAM", IfToUpper("mynameisparam")) // lowercase to uppercase - require.Equal(t, "MYNAMEISPARAM", IfToUpper("MyNameIsParam")) // mixed case + AssertEqual(t, "MYNAMEISPARAM", IfToUpper("MYNAMEISPARAM")) // already uppercase + AssertEqual(t, "MYNAMEISPARAM", IfToUpper("mynameisparam")) // lowercase to uppercase + AssertEqual(t, "MYNAMEISPARAM", IfToUpper("MyNameIsParam")) // mixed case } func Test_IfToLower(t *testing.T) { t.Parallel() - require.Equal(t, "mynameisparam", IfToLower("mynameisparam")) // already lowercase - require.Equal(t, "mynameisparam", IfToLower("myNameIsParam")) // mixed case - require.Equal(t, "https://gofiber.io", IfToLower("https://gofiber.io")) // Origin Header Type URL - require.Equal(t, "mynameisparam", IfToLower("MYNAMEISPARAM")) // uppercase to lowercase + AssertEqual(t, "mynameisparam", IfToLower("mynameisparam")) // already lowercase + AssertEqual(t, "mynameisparam", IfToLower("myNameIsParam")) // mixed case + AssertEqual(t, "https://gofiber.io", IfToLower("https://gofiber.io")) // Origin Header Type URL + AssertEqual(t, "mynameisparam", IfToLower("MYNAMEISPARAM")) // uppercase to lowercase } // Benchmark_IfToLower_HeadersOrigin benchmarks the IfToLower function with an origin header type URL. @@ -195,18 +195,18 @@ func Benchmark_IfToToLower_HeadersOrigin(b *testing.B) { for n := 0; n < b.N; n++ { res = ToLower("https://gofiber.io") } - require.Equal(b, "https://gofiber.io", res) + AssertEqual(b, "https://gofiber.io", res) }) b.Run("IfToLower-Lower", func(b *testing.B) { for n := 0; n < b.N; n++ { res = IfToLower("https://gofiber.io") } - require.Equal(b, "https://gofiber.io", res) + AssertEqual(b, "https://gofiber.io", res) }) b.Run("default", func(b *testing.B) { for n := 0; n < b.N; n++ { res = strings.ToLower("https://gofiber.io") } - require.Equal(b, "https://gofiber.io", res) + AssertEqual(b, "https://gofiber.io", res) }) }