Skip to content

Commit

Permalink
numbers: use value instead of n in labeling (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
shoenig authored Jan 1, 2023
1 parent 7199261 commit 6219c20
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions internal/assertions/assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,58 +418,58 @@ OUTER:
return
}

func Positive[N interfaces.Number](n N) (s string) {
if !(n > 0) {
func Positive[N interfaces.Number](value N) (s string) {
if !(value > 0) {
s = "expected positive value\n"
s += fmt.Sprintf("↪ n: %v\n", n)
s += fmt.Sprintf("↪ value: %v\n", value)
}
return
}

func NonPositive[N interfaces.Number](n N) (s string) {
if !(n <= 0) {
func NonPositive[N interfaces.Number](value N) (s string) {
if !(value <= 0) {
s = "expected non-positive value\n"
s += fmt.Sprintf("↪ n: %v\n", n)
s += fmt.Sprintf("↪ value: %v\n", value)
}
return
}

func Negative[N interfaces.Number](n N) (s string) {
if n > 0 {
func Negative[N interfaces.Number](value N) (s string) {
if value > 0 {
s = "expected negative value\n"
s += fmt.Sprintf("↪ n: %v\n", n)
s += fmt.Sprintf("↪ value: %v\n", value)
}
return
}

func NonNegative[N interfaces.Number](n N) (s string) {
if !(n >= 0) {
func NonNegative[N interfaces.Number](value N) (s string) {
if !(value >= 0) {
s = "expected non-negative value\n"
s += fmt.Sprintf("↪ n: %v\n", n)
s += fmt.Sprintf("↪ value: %v\n", value)
}
return
}

func Zero[N interfaces.Number](n N) (s string) {
if n != 0 {
func Zero[N interfaces.Number](value N) (s string) {
if value != 0 {
s = "expected value of 0\n"
s += fmt.Sprintf("↪ n: %v\n", n)
s += fmt.Sprintf("↪ value: %v\n", value)
}
return
}

func NonZero[N interfaces.Number](n N) (s string) {
if n == 0 {
func NonZero[N interfaces.Number](value N) (s string) {
if value == 0 {
s = "expected non-zero value\n"
s += fmt.Sprintf("↪ n: %v\n", n)
s += fmt.Sprintf("↪ value: %v\n", value)
}
return
}

func One[N interfaces.Number](n N) (s string) {
if n != 1 {
func One[N interfaces.Number](value N) (s string) {
if value != 1 {
s = "expected value of 1\n"
s += fmt.Sprintf("↪ n: %v\n", n)
s += fmt.Sprintf("↪ value: %v\n", value)
}
return
}
Expand Down

0 comments on commit 6219c20

Please sign in to comment.