func ParseGrowth()

in tester/growth.go [125:157]


func ParseGrowth(value string) (Growth, error) {
	switch {
	case strings.HasPrefix(value, LinearGrowthPrefix):
		inc, err := strconv.Atoi(strings.TrimPrefix(value, LinearGrowthPrefix))
		if err != nil {
			//nolint:wrapcheck
			return nil, err
		}

		return &LinearGrowth{Increase: inc}, nil

	case strings.HasPrefix(value, PercentageGrowthPrefix):
		inc, err := strconv.ParseFloat(strings.TrimPrefix(value, PercentageGrowthPrefix), 64)
		if err != nil {
			//nolint:wrapcheck
			return nil, err
		}

		return &PercentageGrowth{Increase: inc}, nil

	case strings.HasPrefix(value, ExponentialGrowthPrefix):
		prec, err := strconv.Atoi(strings.TrimPrefix(value, ExponentialGrowthPrefix))
		if err != nil {
			//nolint:wrapcheck
			return nil, err
		}

		return &ExponentialGrowth{Precision: prec}, nil

	default:
		return nil, ErrInvalidGrowth
	}
}