Skip to content

Commit

Permalink
Remove unused function (#2535)
Browse files Browse the repository at this point in the history
  • Loading branch information
kislaykishore authored Oct 1, 2024
1 parent 814ede2 commit 327d72e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 33 deletions.
11 changes: 0 additions & 11 deletions cfg/config_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ package cfg
import (
"fmt"
"runtime"
"strconv"
"strings"
"time"
)

Expand Down Expand Up @@ -52,12 +50,3 @@ func ListCacheTTLSecsToDuration(secs int64) time.Duration {

return time.Duration(secs * int64(time.Second))
}

func IsNegativeNumber(str string) bool {
str = strings.TrimSpace(str)
num, err := strconv.ParseFloat(str, 64)
if err != nil {
return false // Conversion failed; not a valid number
}
return num < 0
}
22 changes: 0 additions & 22 deletions cfg/config_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,28 +159,6 @@ func Test_ListCacheTtlSecsToDuration_InvalidCall(t *testing.T) {
ListCacheTTLSecsToDuration(-3)
}

func TestIsNegativeNumber(t *testing.T) {
testCases := []struct {
name string
input string
expected bool
}{
{"negative_integer", "-123", true},
{"positive_integer", "456", false},
{"negative_float", "-3.14", true},
{"zero", "0", false},
{"string", "abc", false},
{"invalid", "-12.34invalid", false},
{"negative_with_spaces", " -5 ", true}, // Test with leading/trailing spaces
}

for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
assert.Equal(t, tc.expected, IsNegativeNumber(tc.input))
})
}
}

func TestIsTracingEnabled(t *testing.T) {
t.Parallel()
var testCases = []struct {
Expand Down

0 comments on commit 327d72e

Please sign in to comment.