- Sort Score
- Result 10 results
- Languages All
Results 1 - 2 of 2 for getIntOrPercentValueSafely (0.33 sec)
-
staging/src/k8s.io/apimachinery/pkg/util/intstr/intstr.go
func GetScaledValueFromIntOrPercent(intOrPercent *IntOrString, total int, roundUp bool) (int, error) { if intOrPercent == nil { return 0, errors.New("nil value for IntOrString") } value, isPercent, err := getIntOrPercentValueSafely(intOrPercent) if err != nil { return 0, fmt.Errorf("invalid value for IntOrString: %v", err) } if isPercent { if roundUp { value = int(math.Ceil(float64(value) * (float64(total)) / 100))
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Wed May 29 21:48:09 UTC 2024 - 7.8K bytes - Viewed (0) -
staging/src/k8s.io/apimachinery/pkg/util/intstr/intstr_test.go
}, { input: FromString("40%%"), expectErr: true, expectPerc: false, }, } for _, test := range tests { t.Run("", func(t *testing.T) { value, isPercent, err := getIntOrPercentValueSafely(&test.input) if test.expectVal != value { t.Fatalf("expected value does not match, expected: %d, got: %d", test.expectVal, value) } if test.expectPerc != isPercent {
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Wed May 29 21:48:09 UTC 2024 - 14.3K bytes - Viewed (0)