From 473abe095932975448ab4148bab15be06f9ce358 Mon Sep 17 00:00:00 2001 From: ccoVeille <3875889+ccoVeille@users.noreply.github.com> Date: Thu, 20 Jun 2024 18:26:03 +0200 Subject: [PATCH] negative-positive: support typed 0 (#126) * negative-positive: support typed 0 Fixes #94 * negative-positive: support signed zeros only * negative-positive: refactor debug tests * negative-positive: support typed 0 Fixes #94 * negative-positive: support signed zeros only * negative-positive: refactor debug tests * negative-positive: support Positive for uints --------- Co-authored-by: Anton Telyshev --- CONTRIBUTING.md | 8 +- README.md | 2 + Taskfile.yml | 6 + .../negative_positive_test.go | 1051 +++++++++++++++-- .../negative_positive_test.go.golden | 1003 ++++++++++++++-- .../negative_positive_replacements_test.go | 52 +- internal/checkers/helpers_basic_type.go | 86 +- internal/checkers/negative_postive.go | 44 +- internal/testgen/gen_negative_positive.go | 390 +++--- 9 files changed, 2244 insertions(+), 398 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ae5a9570..2c6dbbaa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,7 +30,7 @@ type TimeCompare struct{} // NewTimeCompare constructs TimeCompare checker. func NewTimeCompare() TimeCompare { return TimeCompare{} } -func (TimeCompare) Name() string { return "TimeCompare" } +func (TimeCompare) Name() string { return "time-compare" } ``` The above code is enough to satisfy the `checkers.Checker` interface. @@ -121,6 +121,12 @@ Install... Fix linter issues and broken tests (probably related to the checkers registry). +To run checker default tests you can use `task test:checker -- {checker-name}`, e.g. + +```bash +$ task test:checker -- time-compare +``` + ### 10) Update `README.md`, commit the changes and submit a pull request 🔥 Describe a new checker in [checkers section](./README.md#checkers). diff --git a/README.md b/README.md index a52c64b6..03305915 100644 --- a/README.md +++ b/README.md @@ -589,6 +589,8 @@ assert.Positive(t, a) **Enabled by default**: true
**Reason**: More appropriate `testify` API with clearer failure message. +Typed zeros (like `int8(0)`, ..., `uint64(0)`) are also supported. + --- ### nil-compare diff --git a/Taskfile.yml b/Taskfile.yml index f58cf839..ea4f9b08 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -46,6 +46,12 @@ tasks: - echo "Test..." - go test ./... + # task test:checker -- negative-positive + test:checker: + deps: [ test:gen ] + cmds: + - go test -count 1 -run TestTestifyLint_CheckersDefault/{{.CLI_ARGS}} ./analyzer + test:coverage: env: GOEXPERIMENT: nocoverageredesign # https://github.com/golang/go/issues/65653#issuecomment-1955872134 diff --git a/analyzer/testdata/src/checkers-default/negative-positive/negative_positive_test.go b/analyzer/testdata/src/checkers-default/negative-positive/negative_positive_test.go index 0081eceb..66f7c37b 100644 --- a/analyzer/testdata/src/checkers-default/negative-positive/negative_positive_test.go +++ b/analyzer/testdata/src/checkers-default/negative-positive/negative_positive_test.go @@ -13,30 +13,210 @@ func TestNegativePositiveChecker(t *testing.T) { // Invalid. { - assert.Less(t, a, 0) // want "negative-positive: use assert\\.Negative" - assert.Lessf(t, a, 0, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" - assert.Greater(t, 0, a) // want "negative-positive: use assert\\.Negative" - assert.Greaterf(t, 0, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" - assert.True(t, a < 0) // want "negative-positive: use assert\\.Negative" - assert.Truef(t, a < 0, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" - assert.True(t, 0 > a) // want "negative-positive: use assert\\.Negative" - assert.Truef(t, 0 > a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" - assert.False(t, a >= 0) // want "negative-positive: use assert\\.Negative" - assert.Falsef(t, a >= 0, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" - assert.False(t, 0 <= a) // want "negative-positive: use assert\\.Negative" - assert.Falsef(t, 0 <= a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" - assert.Greater(t, a, 0) // want "negative-positive: use assert\\.Positive" - assert.Greaterf(t, a, 0, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" - assert.Less(t, 0, a) // want "negative-positive: use assert\\.Positive" - assert.Lessf(t, 0, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" - assert.True(t, a > 0) // want "negative-positive: use assert\\.Positive" - assert.Truef(t, a > 0, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" - assert.True(t, 0 < a) // want "negative-positive: use assert\\.Positive" - assert.Truef(t, 0 < a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" - assert.False(t, a <= 0) // want "negative-positive: use assert\\.Positive" - assert.Falsef(t, a <= 0, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" - assert.False(t, 0 >= a) // want "negative-positive: use assert\\.Positive" - assert.Falsef(t, 0 >= a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Less(t, a, 0) // want "negative-positive: use assert\\.Negative" + assert.Lessf(t, a, 0, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Greater(t, 0, a) // want "negative-positive: use assert\\.Negative" + assert.Greaterf(t, 0, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.True(t, a < 0) // want "negative-positive: use assert\\.Negative" + assert.Truef(t, a < 0, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.True(t, 0 > a) // want "negative-positive: use assert\\.Negative" + assert.Truef(t, 0 > a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.False(t, a >= 0) // want "negative-positive: use assert\\.Negative" + assert.Falsef(t, a >= 0, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.False(t, 0 <= a) // want "negative-positive: use assert\\.Negative" + assert.Falsef(t, 0 <= a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Less(t, a, int(0)) // want "negative-positive: use assert\\.Negative" + assert.Lessf(t, a, int(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Greater(t, int(0), a) // want "negative-positive: use assert\\.Negative" + assert.Greaterf(t, int(0), a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.True(t, int(a) < int(0)) // want "negative-positive: use assert\\.Negative" + assert.Truef(t, int(a) < int(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.True(t, int(0) > int(a)) // want "negative-positive: use assert\\.Negative" + assert.Truef(t, int(0) > int(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.False(t, int(a) >= int(0)) // want "negative-positive: use assert\\.Negative" + assert.Falsef(t, int(a) >= int(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.False(t, int(0) <= int(a)) // want "negative-positive: use assert\\.Negative" + assert.Falsef(t, int(0) <= int(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Less(t, a, int8(0)) // want "negative-positive: use assert\\.Negative" + assert.Lessf(t, a, int8(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Greater(t, int8(0), a) // want "negative-positive: use assert\\.Negative" + assert.Greaterf(t, int8(0), a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.True(t, int8(a) < int8(0)) // want "negative-positive: use assert\\.Negative" + assert.Truef(t, int8(a) < int8(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.True(t, int8(0) > int8(a)) // want "negative-positive: use assert\\.Negative" + assert.Truef(t, int8(0) > int8(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.False(t, int8(a) >= int8(0)) // want "negative-positive: use assert\\.Negative" + assert.Falsef(t, int8(a) >= int8(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.False(t, int8(0) <= int8(a)) // want "negative-positive: use assert\\.Negative" + assert.Falsef(t, int8(0) <= int8(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Less(t, a, int16(0)) // want "negative-positive: use assert\\.Negative" + assert.Lessf(t, a, int16(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Greater(t, int16(0), a) // want "negative-positive: use assert\\.Negative" + assert.Greaterf(t, int16(0), a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.True(t, int16(a) < int16(0)) // want "negative-positive: use assert\\.Negative" + assert.Truef(t, int16(a) < int16(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.True(t, int16(0) > int16(a)) // want "negative-positive: use assert\\.Negative" + assert.Truef(t, int16(0) > int16(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.False(t, int16(a) >= int16(0)) // want "negative-positive: use assert\\.Negative" + assert.Falsef(t, int16(a) >= int16(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.False(t, int16(0) <= int16(a)) // want "negative-positive: use assert\\.Negative" + assert.Falsef(t, int16(0) <= int16(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Less(t, a, int32(0)) // want "negative-positive: use assert\\.Negative" + assert.Lessf(t, a, int32(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Greater(t, int32(0), a) // want "negative-positive: use assert\\.Negative" + assert.Greaterf(t, int32(0), a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.True(t, int32(a) < int32(0)) // want "negative-positive: use assert\\.Negative" + assert.Truef(t, int32(a) < int32(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.True(t, int32(0) > int32(a)) // want "negative-positive: use assert\\.Negative" + assert.Truef(t, int32(0) > int32(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.False(t, int32(a) >= int32(0)) // want "negative-positive: use assert\\.Negative" + assert.Falsef(t, int32(a) >= int32(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.False(t, int32(0) <= int32(a)) // want "negative-positive: use assert\\.Negative" + assert.Falsef(t, int32(0) <= int32(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Less(t, a, int64(0)) // want "negative-positive: use assert\\.Negative" + assert.Lessf(t, a, int64(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Greater(t, int64(0), a) // want "negative-positive: use assert\\.Negative" + assert.Greaterf(t, int64(0), a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.True(t, int64(a) < int64(0)) // want "negative-positive: use assert\\.Negative" + assert.Truef(t, int64(a) < int64(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.True(t, int64(0) > int64(a)) // want "negative-positive: use assert\\.Negative" + assert.Truef(t, int64(0) > int64(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.False(t, int64(a) >= int64(0)) // want "negative-positive: use assert\\.Negative" + assert.Falsef(t, int64(a) >= int64(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.False(t, int64(0) <= int64(a)) // want "negative-positive: use assert\\.Negative" + assert.Falsef(t, int64(0) <= int64(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Greater(t, a, 0) // want "negative-positive: use assert\\.Positive" + assert.Greaterf(t, a, 0, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Less(t, 0, a) // want "negative-positive: use assert\\.Positive" + assert.Lessf(t, 0, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, a > 0) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, a > 0, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, 0 < a) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, 0 < a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, a <= 0) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, a <= 0, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, 0 >= a) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, 0 >= a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Greater(t, a, int(0)) // want "negative-positive: use assert\\.Positive" + assert.Greaterf(t, a, int(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Less(t, int(0), a) // want "negative-positive: use assert\\.Positive" + assert.Lessf(t, int(0), a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, int(a) > int(0)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, int(a) > int(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, int(0) < int(a)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, int(0) < int(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, int(a) <= int(0)) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, int(a) <= int(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, int(0) >= int(a)) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, int(0) >= int(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Greater(t, a, int8(0)) // want "negative-positive: use assert\\.Positive" + assert.Greaterf(t, a, int8(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Less(t, int8(0), a) // want "negative-positive: use assert\\.Positive" + assert.Lessf(t, int8(0), a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, int8(a) > int8(0)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, int8(a) > int8(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, int8(0) < int8(a)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, int8(0) < int8(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, int8(a) <= int8(0)) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, int8(a) <= int8(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, int8(0) >= int8(a)) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, int8(0) >= int8(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Greater(t, a, int16(0)) // want "negative-positive: use assert\\.Positive" + assert.Greaterf(t, a, int16(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Less(t, int16(0), a) // want "negative-positive: use assert\\.Positive" + assert.Lessf(t, int16(0), a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, int16(a) > int16(0)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, int16(a) > int16(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, int16(0) < int16(a)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, int16(0) < int16(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, int16(a) <= int16(0)) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, int16(a) <= int16(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, int16(0) >= int16(a)) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, int16(0) >= int16(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Greater(t, a, int32(0)) // want "negative-positive: use assert\\.Positive" + assert.Greaterf(t, a, int32(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Less(t, int32(0), a) // want "negative-positive: use assert\\.Positive" + assert.Lessf(t, int32(0), a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, int32(a) > int32(0)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, int32(a) > int32(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, int32(0) < int32(a)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, int32(0) < int32(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, int32(a) <= int32(0)) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, int32(a) <= int32(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, int32(0) >= int32(a)) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, int32(0) >= int32(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Greater(t, a, int64(0)) // want "negative-positive: use assert\\.Positive" + assert.Greaterf(t, a, int64(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Less(t, int64(0), a) // want "negative-positive: use assert\\.Positive" + assert.Lessf(t, int64(0), a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, int64(a) > int64(0)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, int64(a) > int64(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, int64(0) < int64(a)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, int64(0) < int64(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, int64(a) <= int64(0)) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, int64(a) <= int64(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, int64(0) >= int64(a)) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, int64(0) >= int64(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Greater(t, a, uint(0)) // want "negative-positive: use assert\\.Positive" + assert.Greaterf(t, a, uint(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Less(t, uint(0), a) // want "negative-positive: use assert\\.Positive" + assert.Lessf(t, uint(0), a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, uint(a) > uint(0)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, uint(a) > uint(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, uint(0) < uint(a)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, uint(0) < uint(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, uint(a) <= uint(0)) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, uint(a) <= uint(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, uint(0) >= uint(a)) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, uint(0) >= uint(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Greater(t, a, uint8(0)) // want "negative-positive: use assert\\.Positive" + assert.Greaterf(t, a, uint8(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Less(t, uint8(0), a) // want "negative-positive: use assert\\.Positive" + assert.Lessf(t, uint8(0), a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, uint8(a) > uint8(0)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, uint8(a) > uint8(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, uint8(0) < uint8(a)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, uint8(0) < uint8(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, uint8(a) <= uint8(0)) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, uint8(a) <= uint8(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, uint8(0) >= uint8(a)) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, uint8(0) >= uint8(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Greater(t, a, uint16(0)) // want "negative-positive: use assert\\.Positive" + assert.Greaterf(t, a, uint16(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Less(t, uint16(0), a) // want "negative-positive: use assert\\.Positive" + assert.Lessf(t, uint16(0), a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, uint16(a) > uint16(0)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, uint16(a) > uint16(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, uint16(0) < uint16(a)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, uint16(0) < uint16(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, uint16(a) <= uint16(0)) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, uint16(a) <= uint16(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, uint16(0) >= uint16(a)) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, uint16(0) >= uint16(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Greater(t, a, uint32(0)) // want "negative-positive: use assert\\.Positive" + assert.Greaterf(t, a, uint32(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Less(t, uint32(0), a) // want "negative-positive: use assert\\.Positive" + assert.Lessf(t, uint32(0), a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, uint32(a) > uint32(0)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, uint32(a) > uint32(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, uint32(0) < uint32(a)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, uint32(0) < uint32(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, uint32(a) <= uint32(0)) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, uint32(a) <= uint32(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, uint32(0) >= uint32(a)) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, uint32(0) >= uint32(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Greater(t, a, uint64(0)) // want "negative-positive: use assert\\.Positive" + assert.Greaterf(t, a, uint64(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Less(t, uint64(0), a) // want "negative-positive: use assert\\.Positive" + assert.Lessf(t, uint64(0), a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, uint64(a) > uint64(0)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, uint64(a) > uint64(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, uint64(0) < uint64(a)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, uint64(0) < uint64(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, uint64(a) <= uint64(0)) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, uint64(a) <= uint64(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.False(t, uint64(0) >= uint64(a)) // want "negative-positive: use assert\\.Positive" + assert.Falsef(t, uint64(0) >= uint64(a), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" } // Valid. @@ -61,6 +241,50 @@ func TestNegativePositiveChecker(t *testing.T) { assert.Equalf(t, 1, a, "msg with args %d %s", 42, "42") assert.Equal(t, a, 1) assert.Equalf(t, a, 1, "msg with args %d %s", 42, "42") + assert.Equal(t, int(0), int(a)) + assert.Equalf(t, int(0), int(a), "msg with args %d %s", 42, "42") + assert.Equal(t, int(a), int(0)) + assert.Equalf(t, int(a), int(0), "msg with args %d %s", 42, "42") + assert.Equal(t, int8(0), int8(a)) + assert.Equalf(t, int8(0), int8(a), "msg with args %d %s", 42, "42") + assert.Equal(t, int8(a), int8(0)) + assert.Equalf(t, int8(a), int8(0), "msg with args %d %s", 42, "42") + assert.Equal(t, int16(0), int16(a)) + assert.Equalf(t, int16(0), int16(a), "msg with args %d %s", 42, "42") + assert.Equal(t, int16(a), int16(0)) + assert.Equalf(t, int16(a), int16(0), "msg with args %d %s", 42, "42") + assert.Equal(t, int32(0), int32(a)) + assert.Equalf(t, int32(0), int32(a), "msg with args %d %s", 42, "42") + assert.Equal(t, int32(a), int32(0)) + assert.Equalf(t, int32(a), int32(0), "msg with args %d %s", 42, "42") + assert.Equal(t, int64(0), int64(a)) + assert.Equalf(t, int64(0), int64(a), "msg with args %d %s", 42, "42") + assert.Equal(t, int64(a), int64(0)) + assert.Equalf(t, int64(a), int64(0), "msg with args %d %s", 42, "42") + assert.Equal(t, uint(0), uint(a)) + assert.Equalf(t, uint(0), uint(a), "msg with args %d %s", 42, "42") + assert.Equal(t, uint(a), uint(0)) + assert.Equalf(t, uint(a), uint(0), "msg with args %d %s", 42, "42") + assert.Equal(t, uint8(0), uint8(a)) + assert.Equalf(t, uint8(0), uint8(a), "msg with args %d %s", 42, "42") + assert.Equal(t, uint8(a), uint8(0)) + assert.Equalf(t, uint8(a), uint8(0), "msg with args %d %s", 42, "42") + assert.Equal(t, uint16(0), uint16(a)) + assert.Equalf(t, uint16(0), uint16(a), "msg with args %d %s", 42, "42") + assert.Equal(t, uint16(a), uint16(0)) + assert.Equalf(t, uint16(a), uint16(0), "msg with args %d %s", 42, "42") + assert.Equal(t, uint32(0), uint32(a)) + assert.Equalf(t, uint32(0), uint32(a), "msg with args %d %s", 42, "42") + assert.Equal(t, uint32(a), uint32(0)) + assert.Equalf(t, uint32(a), uint32(0), "msg with args %d %s", 42, "42") + assert.Equal(t, uint64(0), uint64(a)) + assert.Equalf(t, uint64(0), uint64(a), "msg with args %d %s", 42, "42") + assert.Equal(t, uint64(a), uint64(0)) + assert.Equalf(t, uint64(a), uint64(0), "msg with args %d %s", 42, "42") + assert.Equal(t, CustomInt16(0), CustomInt16(a)) + assert.Equalf(t, CustomInt16(0), CustomInt16(a), "msg with args %d %s", 42, "42") + assert.Equal(t, CustomInt16(a), CustomInt16(0)) + assert.Equalf(t, CustomInt16(a), CustomInt16(0), "msg with args %d %s", 42, "42") assert.NotEqual(t, -1, a) assert.NotEqualf(t, -1, a, "msg with args %d %s", 42, "42") assert.NotEqual(t, a, -1) @@ -73,14 +297,50 @@ func TestNegativePositiveChecker(t *testing.T) { assert.NotEqualf(t, 1, a, "msg with args %d %s", 42, "42") assert.NotEqual(t, a, 1) assert.NotEqualf(t, a, 1, "msg with args %d %s", 42, "42") - assert.Greater(t, -1, a) - assert.Greaterf(t, -1, a, "msg with args %d %s", 42, "42") - assert.Greater(t, a, -1) - assert.Greaterf(t, a, -1, "msg with args %d %s", 42, "42") - assert.Greater(t, a, 1) - assert.Greaterf(t, a, 1, "msg with args %d %s", 42, "42") - assert.Greater(t, 1, a) - assert.Greaterf(t, 1, a, "msg with args %d %s", 42, "42") + assert.NotEqual(t, int(0), int(a)) + assert.NotEqualf(t, int(0), int(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, int(a), int(0)) + assert.NotEqualf(t, int(a), int(0), "msg with args %d %s", 42, "42") + assert.NotEqual(t, int8(0), int8(a)) + assert.NotEqualf(t, int8(0), int8(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, int8(a), int8(0)) + assert.NotEqualf(t, int8(a), int8(0), "msg with args %d %s", 42, "42") + assert.NotEqual(t, int16(0), int16(a)) + assert.NotEqualf(t, int16(0), int16(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, int16(a), int16(0)) + assert.NotEqualf(t, int16(a), int16(0), "msg with args %d %s", 42, "42") + assert.NotEqual(t, int32(0), int32(a)) + assert.NotEqualf(t, int32(0), int32(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, int32(a), int32(0)) + assert.NotEqualf(t, int32(a), int32(0), "msg with args %d %s", 42, "42") + assert.NotEqual(t, int64(0), int64(a)) + assert.NotEqualf(t, int64(0), int64(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, int64(a), int64(0)) + assert.NotEqualf(t, int64(a), int64(0), "msg with args %d %s", 42, "42") + assert.NotEqual(t, uint(0), uint(a)) + assert.NotEqualf(t, uint(0), uint(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, uint(a), uint(0)) + assert.NotEqualf(t, uint(a), uint(0), "msg with args %d %s", 42, "42") + assert.NotEqual(t, uint8(0), uint8(a)) + assert.NotEqualf(t, uint8(0), uint8(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, uint8(a), uint8(0)) + assert.NotEqualf(t, uint8(a), uint8(0), "msg with args %d %s", 42, "42") + assert.NotEqual(t, uint16(0), uint16(a)) + assert.NotEqualf(t, uint16(0), uint16(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, uint16(a), uint16(0)) + assert.NotEqualf(t, uint16(a), uint16(0), "msg with args %d %s", 42, "42") + assert.NotEqual(t, uint32(0), uint32(a)) + assert.NotEqualf(t, uint32(0), uint32(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, uint32(a), uint32(0)) + assert.NotEqualf(t, uint32(a), uint32(0), "msg with args %d %s", 42, "42") + assert.NotEqual(t, uint64(0), uint64(a)) + assert.NotEqualf(t, uint64(0), uint64(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, uint64(a), uint64(0)) + assert.NotEqualf(t, uint64(a), uint64(0), "msg with args %d %s", 42, "42") + assert.NotEqual(t, CustomInt16(0), CustomInt16(a)) + assert.NotEqualf(t, CustomInt16(0), CustomInt16(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, CustomInt16(a), CustomInt16(0)) + assert.NotEqualf(t, CustomInt16(a), CustomInt16(0), "msg with args %d %s", 42, "42") assert.GreaterOrEqual(t, -1, a) assert.GreaterOrEqualf(t, -1, a, "msg with args %d %s", 42, "42") assert.GreaterOrEqual(t, a, -1) @@ -93,14 +353,50 @@ func TestNegativePositiveChecker(t *testing.T) { assert.GreaterOrEqualf(t, 1, a, "msg with args %d %s", 42, "42") assert.GreaterOrEqual(t, a, 1) assert.GreaterOrEqualf(t, a, 1, "msg with args %d %s", 42, "42") - assert.Less(t, -1, a) - assert.Lessf(t, -1, a, "msg with args %d %s", 42, "42") - assert.Less(t, a, -1) - assert.Lessf(t, a, -1, "msg with args %d %s", 42, "42") - assert.Less(t, 1, a) - assert.Lessf(t, 1, a, "msg with args %d %s", 42, "42") - assert.Less(t, a, 1) - assert.Lessf(t, a, 1, "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, int(0), int(a)) + assert.GreaterOrEqualf(t, int(0), int(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, int(a), int(0)) + assert.GreaterOrEqualf(t, int(a), int(0), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, int8(0), int8(a)) + assert.GreaterOrEqualf(t, int8(0), int8(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, int8(a), int8(0)) + assert.GreaterOrEqualf(t, int8(a), int8(0), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, int16(0), int16(a)) + assert.GreaterOrEqualf(t, int16(0), int16(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, int16(a), int16(0)) + assert.GreaterOrEqualf(t, int16(a), int16(0), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, int32(0), int32(a)) + assert.GreaterOrEqualf(t, int32(0), int32(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, int32(a), int32(0)) + assert.GreaterOrEqualf(t, int32(a), int32(0), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, int64(0), int64(a)) + assert.GreaterOrEqualf(t, int64(0), int64(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, int64(a), int64(0)) + assert.GreaterOrEqualf(t, int64(a), int64(0), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, uint(0), uint(a)) + assert.GreaterOrEqualf(t, uint(0), uint(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, uint(a), uint(0)) + assert.GreaterOrEqualf(t, uint(a), uint(0), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, uint8(0), uint8(a)) + assert.GreaterOrEqualf(t, uint8(0), uint8(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, uint8(a), uint8(0)) + assert.GreaterOrEqualf(t, uint8(a), uint8(0), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, uint16(0), uint16(a)) + assert.GreaterOrEqualf(t, uint16(0), uint16(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, uint16(a), uint16(0)) + assert.GreaterOrEqualf(t, uint16(a), uint16(0), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, uint32(0), uint32(a)) + assert.GreaterOrEqualf(t, uint32(0), uint32(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, uint32(a), uint32(0)) + assert.GreaterOrEqualf(t, uint32(a), uint32(0), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, uint64(0), uint64(a)) + assert.GreaterOrEqualf(t, uint64(0), uint64(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, uint64(a), uint64(0)) + assert.GreaterOrEqualf(t, uint64(a), uint64(0), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, CustomInt16(0), CustomInt16(a)) + assert.GreaterOrEqualf(t, CustomInt16(0), CustomInt16(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, CustomInt16(a), CustomInt16(0)) + assert.GreaterOrEqualf(t, CustomInt16(a), CustomInt16(0), "msg with args %d %s", 42, "42") assert.LessOrEqual(t, -1, a) assert.LessOrEqualf(t, -1, a, "msg with args %d %s", 42, "42") assert.LessOrEqual(t, a, -1) @@ -113,134 +409,626 @@ func TestNegativePositiveChecker(t *testing.T) { assert.LessOrEqualf(t, 1, a, "msg with args %d %s", 42, "42") assert.LessOrEqual(t, a, 1) assert.LessOrEqualf(t, a, 1, "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, int(0), int(a)) + assert.LessOrEqualf(t, int(0), int(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, int(a), int(0)) + assert.LessOrEqualf(t, int(a), int(0), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, int8(0), int8(a)) + assert.LessOrEqualf(t, int8(0), int8(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, int8(a), int8(0)) + assert.LessOrEqualf(t, int8(a), int8(0), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, int16(0), int16(a)) + assert.LessOrEqualf(t, int16(0), int16(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, int16(a), int16(0)) + assert.LessOrEqualf(t, int16(a), int16(0), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, int32(0), int32(a)) + assert.LessOrEqualf(t, int32(0), int32(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, int32(a), int32(0)) + assert.LessOrEqualf(t, int32(a), int32(0), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, int64(0), int64(a)) + assert.LessOrEqualf(t, int64(0), int64(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, int64(a), int64(0)) + assert.LessOrEqualf(t, int64(a), int64(0), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, uint(0), uint(a)) + assert.LessOrEqualf(t, uint(0), uint(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, uint(a), uint(0)) + assert.LessOrEqualf(t, uint(a), uint(0), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, uint8(0), uint8(a)) + assert.LessOrEqualf(t, uint8(0), uint8(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, uint8(a), uint8(0)) + assert.LessOrEqualf(t, uint8(a), uint8(0), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, uint16(0), uint16(a)) + assert.LessOrEqualf(t, uint16(0), uint16(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, uint16(a), uint16(0)) + assert.LessOrEqualf(t, uint16(a), uint16(0), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, uint32(0), uint32(a)) + assert.LessOrEqualf(t, uint32(0), uint32(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, uint32(a), uint32(0)) + assert.LessOrEqualf(t, uint32(a), uint32(0), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, uint64(0), uint64(a)) + assert.LessOrEqualf(t, uint64(0), uint64(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, uint64(a), uint64(0)) + assert.LessOrEqualf(t, uint64(a), uint64(0), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, CustomInt16(0), CustomInt16(a)) + assert.LessOrEqualf(t, CustomInt16(0), CustomInt16(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, CustomInt16(a), CustomInt16(0)) + assert.LessOrEqualf(t, CustomInt16(a), CustomInt16(0), "msg with args %d %s", 42, "42") + assert.Greater(t, -1, a) + assert.Greaterf(t, -1, a, "msg with args %d %s", 42, "42") + assert.Greater(t, a, -1) + assert.Greaterf(t, a, -1, "msg with args %d %s", 42, "42") + assert.Greater(t, CustomInt16(0), a) + assert.Greaterf(t, CustomInt16(0), a, "msg with args %d %s", 42, "42") + assert.Greater(t, a, CustomInt16(0)) + assert.Greaterf(t, a, CustomInt16(0), "msg with args %d %s", 42, "42") + assert.Greater(t, 1, a) + assert.Greaterf(t, 1, a, "msg with args %d %s", 42, "42") + assert.Greater(t, a, 1) + assert.Greaterf(t, a, 1, "msg with args %d %s", 42, "42") + assert.Less(t, -1, a) + assert.Lessf(t, -1, a, "msg with args %d %s", 42, "42") + assert.Less(t, a, -1) + assert.Lessf(t, a, -1, "msg with args %d %s", 42, "42") + assert.Less(t, CustomInt16(0), a) + assert.Lessf(t, CustomInt16(0), a, "msg with args %d %s", 42, "42") + assert.Less(t, a, CustomInt16(0)) + assert.Lessf(t, a, CustomInt16(0), "msg with args %d %s", 42, "42") + assert.Less(t, 1, a) + assert.Lessf(t, 1, a, "msg with args %d %s", 42, "42") + assert.Less(t, a, 1) + assert.Lessf(t, a, 1, "msg with args %d %s", 42, "42") assert.True(t, a > -1) assert.Truef(t, a > -1, "msg with args %d %s", 42, "42") - assert.True(t, a < -1) - assert.Truef(t, a < -1, "msg with args %d %s", 42, "42") - assert.True(t, a >= -1) - assert.Truef(t, a >= -1, "msg with args %d %s", 42, "42") - assert.True(t, a <= -1) - assert.Truef(t, a <= -1, "msg with args %d %s", 42, "42") - assert.True(t, a == -1) - assert.Truef(t, a == -1, "msg with args %d %s", 42, "42") - assert.True(t, a != -1) - assert.Truef(t, a != -1, "msg with args %d %s", 42, "42") assert.True(t, -1 > a) assert.Truef(t, -1 > a, "msg with args %d %s", 42, "42") + assert.True(t, a < -1) + assert.Truef(t, a < -1, "msg with args %d %s", 42, "42") assert.True(t, -1 < a) assert.Truef(t, -1 < a, "msg with args %d %s", 42, "42") + assert.True(t, a >= -1) + assert.Truef(t, a >= -1, "msg with args %d %s", 42, "42") assert.True(t, -1 >= a) assert.Truef(t, -1 >= a, "msg with args %d %s", 42, "42") + assert.True(t, a <= -1) + assert.Truef(t, a <= -1, "msg with args %d %s", 42, "42") assert.True(t, -1 <= a) assert.Truef(t, -1 <= a, "msg with args %d %s", 42, "42") + assert.True(t, a == -1) + assert.Truef(t, a == -1, "msg with args %d %s", 42, "42") assert.True(t, -1 == a) assert.Truef(t, -1 == a, "msg with args %d %s", 42, "42") + assert.True(t, a != -1) + assert.Truef(t, a != -1, "msg with args %d %s", 42, "42") assert.True(t, -1 != a) assert.Truef(t, -1 != a, "msg with args %d %s", 42, "42") - assert.True(t, a >= 0) - assert.Truef(t, a >= 0, "msg with args %d %s", 42, "42") - assert.True(t, a <= 0) - assert.Truef(t, a <= 0, "msg with args %d %s", 42, "42") - assert.True(t, a == 0) - assert.Truef(t, a == 0, "msg with args %d %s", 42, "42") - assert.True(t, a != 0) - assert.Truef(t, a != 0, "msg with args %d %s", 42, "42") - assert.True(t, 0 >= a) - assert.Truef(t, 0 >= a, "msg with args %d %s", 42, "42") - assert.True(t, 0 <= a) - assert.Truef(t, 0 <= a, "msg with args %d %s", 42, "42") - assert.True(t, 0 == a) - assert.Truef(t, 0 == a, "msg with args %d %s", 42, "42") - assert.True(t, 0 != a) - assert.Truef(t, 0 != a, "msg with args %d %s", 42, "42") assert.True(t, a > 1) assert.Truef(t, a > 1, "msg with args %d %s", 42, "42") - assert.True(t, a < 1) - assert.Truef(t, a < 1, "msg with args %d %s", 42, "42") - assert.True(t, a >= 1) - assert.Truef(t, a >= 1, "msg with args %d %s", 42, "42") - assert.True(t, a <= 1) - assert.Truef(t, a <= 1, "msg with args %d %s", 42, "42") - assert.True(t, a == 1) - assert.Truef(t, a == 1, "msg with args %d %s", 42, "42") - assert.True(t, a != 1) - assert.Truef(t, a != 1, "msg with args %d %s", 42, "42") assert.True(t, 1 > a) assert.Truef(t, 1 > a, "msg with args %d %s", 42, "42") + assert.True(t, a < 1) + assert.Truef(t, a < 1, "msg with args %d %s", 42, "42") assert.True(t, 1 < a) assert.Truef(t, 1 < a, "msg with args %d %s", 42, "42") + assert.True(t, a >= 1) + assert.Truef(t, a >= 1, "msg with args %d %s", 42, "42") assert.True(t, 1 >= a) assert.Truef(t, 1 >= a, "msg with args %d %s", 42, "42") + assert.True(t, a <= 1) + assert.Truef(t, a <= 1, "msg with args %d %s", 42, "42") assert.True(t, 1 <= a) assert.Truef(t, 1 <= a, "msg with args %d %s", 42, "42") + assert.True(t, a == 1) + assert.Truef(t, a == 1, "msg with args %d %s", 42, "42") assert.True(t, 1 == a) assert.Truef(t, 1 == a, "msg with args %d %s", 42, "42") + assert.True(t, a != 1) + assert.Truef(t, a != 1, "msg with args %d %s", 42, "42") assert.True(t, 1 != a) assert.Truef(t, 1 != a, "msg with args %d %s", 42, "42") assert.False(t, a > -1) assert.Falsef(t, a > -1, "msg with args %d %s", 42, "42") - assert.False(t, a < -1) - assert.Falsef(t, a < -1, "msg with args %d %s", 42, "42") - assert.False(t, a >= -1) - assert.Falsef(t, a >= -1, "msg with args %d %s", 42, "42") - assert.False(t, a <= -1) - assert.Falsef(t, a <= -1, "msg with args %d %s", 42, "42") - assert.False(t, a == -1) - assert.Falsef(t, a == -1, "msg with args %d %s", 42, "42") - assert.False(t, a != -1) - assert.Falsef(t, a != -1, "msg with args %d %s", 42, "42") assert.False(t, -1 > a) assert.Falsef(t, -1 > a, "msg with args %d %s", 42, "42") + assert.False(t, a < -1) + assert.Falsef(t, a < -1, "msg with args %d %s", 42, "42") assert.False(t, -1 < a) assert.Falsef(t, -1 < a, "msg with args %d %s", 42, "42") + assert.False(t, a >= -1) + assert.Falsef(t, a >= -1, "msg with args %d %s", 42, "42") assert.False(t, -1 >= a) assert.Falsef(t, -1 >= a, "msg with args %d %s", 42, "42") + assert.False(t, a <= -1) + assert.Falsef(t, a <= -1, "msg with args %d %s", 42, "42") assert.False(t, -1 <= a) assert.Falsef(t, -1 <= a, "msg with args %d %s", 42, "42") + assert.False(t, a == -1) + assert.Falsef(t, a == -1, "msg with args %d %s", 42, "42") assert.False(t, -1 == a) assert.Falsef(t, -1 == a, "msg with args %d %s", 42, "42") + assert.False(t, a != -1) + assert.Falsef(t, a != -1, "msg with args %d %s", 42, "42") assert.False(t, -1 != a) assert.Falsef(t, -1 != a, "msg with args %d %s", 42, "42") - assert.False(t, a > 0) - assert.Falsef(t, a > 0, "msg with args %d %s", 42, "42") - assert.False(t, a < 0) - assert.Falsef(t, a < 0, "msg with args %d %s", 42, "42") - assert.False(t, a == 0) - assert.Falsef(t, a == 0, "msg with args %d %s", 42, "42") - assert.False(t, a != 0) - assert.Falsef(t, a != 0, "msg with args %d %s", 42, "42") - assert.False(t, 0 > a) - assert.Falsef(t, 0 > a, "msg with args %d %s", 42, "42") - assert.False(t, 0 < a) - assert.Falsef(t, 0 < a, "msg with args %d %s", 42, "42") - assert.False(t, 0 == a) - assert.Falsef(t, 0 == a, "msg with args %d %s", 42, "42") - assert.False(t, 0 != a) - assert.Falsef(t, 0 != a, "msg with args %d %s", 42, "42") assert.False(t, a > 1) assert.Falsef(t, a > 1, "msg with args %d %s", 42, "42") - assert.False(t, a < 1) - assert.Falsef(t, a < 1, "msg with args %d %s", 42, "42") - assert.False(t, a >= 1) - assert.Falsef(t, a >= 1, "msg with args %d %s", 42, "42") - assert.False(t, a <= 1) - assert.Falsef(t, a <= 1, "msg with args %d %s", 42, "42") - assert.False(t, a == 1) - assert.Falsef(t, a == 1, "msg with args %d %s", 42, "42") - assert.False(t, a != 1) - assert.Falsef(t, a != 1, "msg with args %d %s", 42, "42") assert.False(t, 1 > a) assert.Falsef(t, 1 > a, "msg with args %d %s", 42, "42") + assert.False(t, a < 1) + assert.Falsef(t, a < 1, "msg with args %d %s", 42, "42") assert.False(t, 1 < a) assert.Falsef(t, 1 < a, "msg with args %d %s", 42, "42") + assert.False(t, a >= 1) + assert.Falsef(t, a >= 1, "msg with args %d %s", 42, "42") assert.False(t, 1 >= a) assert.Falsef(t, 1 >= a, "msg with args %d %s", 42, "42") + assert.False(t, a <= 1) + assert.Falsef(t, a <= 1, "msg with args %d %s", 42, "42") assert.False(t, 1 <= a) assert.Falsef(t, 1 <= a, "msg with args %d %s", 42, "42") + assert.False(t, a == 1) + assert.Falsef(t, a == 1, "msg with args %d %s", 42, "42") assert.False(t, 1 == a) assert.Falsef(t, 1 == a, "msg with args %d %s", 42, "42") + assert.False(t, a != 1) + assert.Falsef(t, a != 1, "msg with args %d %s", 42, "42") assert.False(t, 1 != a) assert.Falsef(t, 1 != a, "msg with args %d %s", 42, "42") + assert.True(t, a >= 0) + assert.Truef(t, a >= 0, "msg with args %d %s", 42, "42") + assert.True(t, 0 >= a) + assert.Truef(t, 0 >= a, "msg with args %d %s", 42, "42") + assert.True(t, a <= 0) + assert.Truef(t, a <= 0, "msg with args %d %s", 42, "42") + assert.True(t, 0 <= a) + assert.Truef(t, 0 <= a, "msg with args %d %s", 42, "42") + assert.True(t, a == 0) + assert.Truef(t, a == 0, "msg with args %d %s", 42, "42") + assert.True(t, 0 == a) + assert.Truef(t, 0 == a, "msg with args %d %s", 42, "42") + assert.True(t, a != 0) + assert.Truef(t, a != 0, "msg with args %d %s", 42, "42") + assert.True(t, 0 != a) + assert.Truef(t, 0 != a, "msg with args %d %s", 42, "42") + assert.True(t, int(a) >= int(0)) + assert.Truef(t, int(a) >= int(0), "msg with args %d %s", 42, "42") + assert.True(t, int(0) >= int(a)) + assert.Truef(t, int(0) >= int(a), "msg with args %d %s", 42, "42") + assert.True(t, int(a) <= int(0)) + assert.Truef(t, int(a) <= int(0), "msg with args %d %s", 42, "42") + assert.True(t, int(0) <= int(a)) + assert.Truef(t, int(0) <= int(a), "msg with args %d %s", 42, "42") + assert.True(t, int(a) == int(0)) + assert.Truef(t, int(a) == int(0), "msg with args %d %s", 42, "42") + assert.True(t, int(0) == int(a)) + assert.Truef(t, int(0) == int(a), "msg with args %d %s", 42, "42") + assert.True(t, int(a) != int(0)) + assert.Truef(t, int(a) != int(0), "msg with args %d %s", 42, "42") + assert.True(t, int(0) != int(a)) + assert.Truef(t, int(0) != int(a), "msg with args %d %s", 42, "42") + assert.True(t, int8(a) >= int8(0)) + assert.Truef(t, int8(a) >= int8(0), "msg with args %d %s", 42, "42") + assert.True(t, int8(0) >= int8(a)) + assert.Truef(t, int8(0) >= int8(a), "msg with args %d %s", 42, "42") + assert.True(t, int8(a) <= int8(0)) + assert.Truef(t, int8(a) <= int8(0), "msg with args %d %s", 42, "42") + assert.True(t, int8(0) <= int8(a)) + assert.Truef(t, int8(0) <= int8(a), "msg with args %d %s", 42, "42") + assert.True(t, int8(a) == int8(0)) + assert.Truef(t, int8(a) == int8(0), "msg with args %d %s", 42, "42") + assert.True(t, int8(0) == int8(a)) + assert.Truef(t, int8(0) == int8(a), "msg with args %d %s", 42, "42") + assert.True(t, int8(a) != int8(0)) + assert.Truef(t, int8(a) != int8(0), "msg with args %d %s", 42, "42") + assert.True(t, int8(0) != int8(a)) + assert.Truef(t, int8(0) != int8(a), "msg with args %d %s", 42, "42") + assert.True(t, int16(a) >= int16(0)) + assert.Truef(t, int16(a) >= int16(0), "msg with args %d %s", 42, "42") + assert.True(t, int16(0) >= int16(a)) + assert.Truef(t, int16(0) >= int16(a), "msg with args %d %s", 42, "42") + assert.True(t, int16(a) <= int16(0)) + assert.Truef(t, int16(a) <= int16(0), "msg with args %d %s", 42, "42") + assert.True(t, int16(0) <= int16(a)) + assert.Truef(t, int16(0) <= int16(a), "msg with args %d %s", 42, "42") + assert.True(t, int16(a) == int16(0)) + assert.Truef(t, int16(a) == int16(0), "msg with args %d %s", 42, "42") + assert.True(t, int16(0) == int16(a)) + assert.Truef(t, int16(0) == int16(a), "msg with args %d %s", 42, "42") + assert.True(t, int16(a) != int16(0)) + assert.Truef(t, int16(a) != int16(0), "msg with args %d %s", 42, "42") + assert.True(t, int16(0) != int16(a)) + assert.Truef(t, int16(0) != int16(a), "msg with args %d %s", 42, "42") + assert.True(t, int32(a) >= int32(0)) + assert.Truef(t, int32(a) >= int32(0), "msg with args %d %s", 42, "42") + assert.True(t, int32(0) >= int32(a)) + assert.Truef(t, int32(0) >= int32(a), "msg with args %d %s", 42, "42") + assert.True(t, int32(a) <= int32(0)) + assert.Truef(t, int32(a) <= int32(0), "msg with args %d %s", 42, "42") + assert.True(t, int32(0) <= int32(a)) + assert.Truef(t, int32(0) <= int32(a), "msg with args %d %s", 42, "42") + assert.True(t, int32(a) == int32(0)) + assert.Truef(t, int32(a) == int32(0), "msg with args %d %s", 42, "42") + assert.True(t, int32(0) == int32(a)) + assert.Truef(t, int32(0) == int32(a), "msg with args %d %s", 42, "42") + assert.True(t, int32(a) != int32(0)) + assert.Truef(t, int32(a) != int32(0), "msg with args %d %s", 42, "42") + assert.True(t, int32(0) != int32(a)) + assert.Truef(t, int32(0) != int32(a), "msg with args %d %s", 42, "42") + assert.True(t, int64(a) >= int64(0)) + assert.Truef(t, int64(a) >= int64(0), "msg with args %d %s", 42, "42") + assert.True(t, int64(0) >= int64(a)) + assert.Truef(t, int64(0) >= int64(a), "msg with args %d %s", 42, "42") + assert.True(t, int64(a) <= int64(0)) + assert.Truef(t, int64(a) <= int64(0), "msg with args %d %s", 42, "42") + assert.True(t, int64(0) <= int64(a)) + assert.Truef(t, int64(0) <= int64(a), "msg with args %d %s", 42, "42") + assert.True(t, int64(a) == int64(0)) + assert.Truef(t, int64(a) == int64(0), "msg with args %d %s", 42, "42") + assert.True(t, int64(0) == int64(a)) + assert.Truef(t, int64(0) == int64(a), "msg with args %d %s", 42, "42") + assert.True(t, int64(a) != int64(0)) + assert.Truef(t, int64(a) != int64(0), "msg with args %d %s", 42, "42") + assert.True(t, int64(0) != int64(a)) + assert.Truef(t, int64(0) != int64(a), "msg with args %d %s", 42, "42") + assert.True(t, uint(a) >= uint(0)) + assert.Truef(t, uint(a) >= uint(0), "msg with args %d %s", 42, "42") + assert.True(t, uint(0) >= uint(a)) + assert.Truef(t, uint(0) >= uint(a), "msg with args %d %s", 42, "42") + assert.True(t, uint(a) <= uint(0)) + assert.Truef(t, uint(a) <= uint(0), "msg with args %d %s", 42, "42") + assert.True(t, uint(0) <= uint(a)) + assert.Truef(t, uint(0) <= uint(a), "msg with args %d %s", 42, "42") + assert.True(t, uint(a) == uint(0)) + assert.Truef(t, uint(a) == uint(0), "msg with args %d %s", 42, "42") + assert.True(t, uint(0) == uint(a)) + assert.Truef(t, uint(0) == uint(a), "msg with args %d %s", 42, "42") + assert.True(t, uint(a) != uint(0)) + assert.Truef(t, uint(a) != uint(0), "msg with args %d %s", 42, "42") + assert.True(t, uint(0) != uint(a)) + assert.Truef(t, uint(0) != uint(a), "msg with args %d %s", 42, "42") + assert.True(t, uint8(a) >= uint8(0)) + assert.Truef(t, uint8(a) >= uint8(0), "msg with args %d %s", 42, "42") + assert.True(t, uint8(0) >= uint8(a)) + assert.Truef(t, uint8(0) >= uint8(a), "msg with args %d %s", 42, "42") + assert.True(t, uint8(a) <= uint8(0)) + assert.Truef(t, uint8(a) <= uint8(0), "msg with args %d %s", 42, "42") + assert.True(t, uint8(0) <= uint8(a)) + assert.Truef(t, uint8(0) <= uint8(a), "msg with args %d %s", 42, "42") + assert.True(t, uint8(a) == uint8(0)) + assert.Truef(t, uint8(a) == uint8(0), "msg with args %d %s", 42, "42") + assert.True(t, uint8(0) == uint8(a)) + assert.Truef(t, uint8(0) == uint8(a), "msg with args %d %s", 42, "42") + assert.True(t, uint8(a) != uint8(0)) + assert.Truef(t, uint8(a) != uint8(0), "msg with args %d %s", 42, "42") + assert.True(t, uint8(0) != uint8(a)) + assert.Truef(t, uint8(0) != uint8(a), "msg with args %d %s", 42, "42") + assert.True(t, uint16(a) >= uint16(0)) + assert.Truef(t, uint16(a) >= uint16(0), "msg with args %d %s", 42, "42") + assert.True(t, uint16(0) >= uint16(a)) + assert.Truef(t, uint16(0) >= uint16(a), "msg with args %d %s", 42, "42") + assert.True(t, uint16(a) <= uint16(0)) + assert.Truef(t, uint16(a) <= uint16(0), "msg with args %d %s", 42, "42") + assert.True(t, uint16(0) <= uint16(a)) + assert.Truef(t, uint16(0) <= uint16(a), "msg with args %d %s", 42, "42") + assert.True(t, uint16(a) == uint16(0)) + assert.Truef(t, uint16(a) == uint16(0), "msg with args %d %s", 42, "42") + assert.True(t, uint16(0) == uint16(a)) + assert.Truef(t, uint16(0) == uint16(a), "msg with args %d %s", 42, "42") + assert.True(t, uint16(a) != uint16(0)) + assert.Truef(t, uint16(a) != uint16(0), "msg with args %d %s", 42, "42") + assert.True(t, uint16(0) != uint16(a)) + assert.Truef(t, uint16(0) != uint16(a), "msg with args %d %s", 42, "42") + assert.True(t, uint32(a) >= uint32(0)) + assert.Truef(t, uint32(a) >= uint32(0), "msg with args %d %s", 42, "42") + assert.True(t, uint32(0) >= uint32(a)) + assert.Truef(t, uint32(0) >= uint32(a), "msg with args %d %s", 42, "42") + assert.True(t, uint32(a) <= uint32(0)) + assert.Truef(t, uint32(a) <= uint32(0), "msg with args %d %s", 42, "42") + assert.True(t, uint32(0) <= uint32(a)) + assert.Truef(t, uint32(0) <= uint32(a), "msg with args %d %s", 42, "42") + assert.True(t, uint32(a) == uint32(0)) + assert.Truef(t, uint32(a) == uint32(0), "msg with args %d %s", 42, "42") + assert.True(t, uint32(0) == uint32(a)) + assert.Truef(t, uint32(0) == uint32(a), "msg with args %d %s", 42, "42") + assert.True(t, uint32(a) != uint32(0)) + assert.Truef(t, uint32(a) != uint32(0), "msg with args %d %s", 42, "42") + assert.True(t, uint32(0) != uint32(a)) + assert.Truef(t, uint32(0) != uint32(a), "msg with args %d %s", 42, "42") + assert.True(t, uint64(a) >= uint64(0)) + assert.Truef(t, uint64(a) >= uint64(0), "msg with args %d %s", 42, "42") + assert.True(t, uint64(0) >= uint64(a)) + assert.Truef(t, uint64(0) >= uint64(a), "msg with args %d %s", 42, "42") + assert.True(t, uint64(a) <= uint64(0)) + assert.Truef(t, uint64(a) <= uint64(0), "msg with args %d %s", 42, "42") + assert.True(t, uint64(0) <= uint64(a)) + assert.Truef(t, uint64(0) <= uint64(a), "msg with args %d %s", 42, "42") + assert.True(t, uint64(a) == uint64(0)) + assert.Truef(t, uint64(a) == uint64(0), "msg with args %d %s", 42, "42") + assert.True(t, uint64(0) == uint64(a)) + assert.Truef(t, uint64(0) == uint64(a), "msg with args %d %s", 42, "42") + assert.True(t, uint64(a) != uint64(0)) + assert.Truef(t, uint64(a) != uint64(0), "msg with args %d %s", 42, "42") + assert.True(t, uint64(0) != uint64(a)) + assert.Truef(t, uint64(0) != uint64(a), "msg with args %d %s", 42, "42") + assert.True(t, CustomInt16(a) >= CustomInt16(0)) + assert.Truef(t, CustomInt16(a) >= CustomInt16(0), "msg with args %d %s", 42, "42") + assert.True(t, CustomInt16(0) >= CustomInt16(a)) + assert.Truef(t, CustomInt16(0) >= CustomInt16(a), "msg with args %d %s", 42, "42") + assert.True(t, CustomInt16(a) <= CustomInt16(0)) + assert.Truef(t, CustomInt16(a) <= CustomInt16(0), "msg with args %d %s", 42, "42") + assert.True(t, CustomInt16(0) <= CustomInt16(a)) + assert.Truef(t, CustomInt16(0) <= CustomInt16(a), "msg with args %d %s", 42, "42") + assert.True(t, CustomInt16(a) == CustomInt16(0)) + assert.Truef(t, CustomInt16(a) == CustomInt16(0), "msg with args %d %s", 42, "42") + assert.True(t, CustomInt16(0) == CustomInt16(a)) + assert.Truef(t, CustomInt16(0) == CustomInt16(a), "msg with args %d %s", 42, "42") + assert.True(t, CustomInt16(a) != CustomInt16(0)) + assert.Truef(t, CustomInt16(a) != CustomInt16(0), "msg with args %d %s", 42, "42") + assert.True(t, CustomInt16(0) != CustomInt16(a)) + assert.Truef(t, CustomInt16(0) != CustomInt16(a), "msg with args %d %s", 42, "42") + assert.False(t, a > 0) + assert.Falsef(t, a > 0, "msg with args %d %s", 42, "42") + assert.False(t, 0 > a) + assert.Falsef(t, 0 > a, "msg with args %d %s", 42, "42") + assert.False(t, a < 0) + assert.Falsef(t, a < 0, "msg with args %d %s", 42, "42") + assert.False(t, 0 < a) + assert.Falsef(t, 0 < a, "msg with args %d %s", 42, "42") + assert.False(t, a == 0) + assert.Falsef(t, a == 0, "msg with args %d %s", 42, "42") + assert.False(t, 0 == a) + assert.Falsef(t, 0 == a, "msg with args %d %s", 42, "42") + assert.False(t, a != 0) + assert.Falsef(t, a != 0, "msg with args %d %s", 42, "42") + assert.False(t, 0 != a) + assert.Falsef(t, 0 != a, "msg with args %d %s", 42, "42") + assert.False(t, int(a) > int(0)) + assert.Falsef(t, int(a) > int(0), "msg with args %d %s", 42, "42") + assert.False(t, int(0) > int(a)) + assert.Falsef(t, int(0) > int(a), "msg with args %d %s", 42, "42") + assert.False(t, int(a) < int(0)) + assert.Falsef(t, int(a) < int(0), "msg with args %d %s", 42, "42") + assert.False(t, int(0) < int(a)) + assert.Falsef(t, int(0) < int(a), "msg with args %d %s", 42, "42") + assert.False(t, int(a) == int(0)) + assert.Falsef(t, int(a) == int(0), "msg with args %d %s", 42, "42") + assert.False(t, int(0) == int(a)) + assert.Falsef(t, int(0) == int(a), "msg with args %d %s", 42, "42") + assert.False(t, int(a) != int(0)) + assert.Falsef(t, int(a) != int(0), "msg with args %d %s", 42, "42") + assert.False(t, int(0) != int(a)) + assert.Falsef(t, int(0) != int(a), "msg with args %d %s", 42, "42") + assert.False(t, int8(a) > int8(0)) + assert.Falsef(t, int8(a) > int8(0), "msg with args %d %s", 42, "42") + assert.False(t, int8(0) > int8(a)) + assert.Falsef(t, int8(0) > int8(a), "msg with args %d %s", 42, "42") + assert.False(t, int8(a) < int8(0)) + assert.Falsef(t, int8(a) < int8(0), "msg with args %d %s", 42, "42") + assert.False(t, int8(0) < int8(a)) + assert.Falsef(t, int8(0) < int8(a), "msg with args %d %s", 42, "42") + assert.False(t, int8(a) == int8(0)) + assert.Falsef(t, int8(a) == int8(0), "msg with args %d %s", 42, "42") + assert.False(t, int8(0) == int8(a)) + assert.Falsef(t, int8(0) == int8(a), "msg with args %d %s", 42, "42") + assert.False(t, int8(a) != int8(0)) + assert.Falsef(t, int8(a) != int8(0), "msg with args %d %s", 42, "42") + assert.False(t, int8(0) != int8(a)) + assert.Falsef(t, int8(0) != int8(a), "msg with args %d %s", 42, "42") + assert.False(t, int16(a) > int16(0)) + assert.Falsef(t, int16(a) > int16(0), "msg with args %d %s", 42, "42") + assert.False(t, int16(0) > int16(a)) + assert.Falsef(t, int16(0) > int16(a), "msg with args %d %s", 42, "42") + assert.False(t, int16(a) < int16(0)) + assert.Falsef(t, int16(a) < int16(0), "msg with args %d %s", 42, "42") + assert.False(t, int16(0) < int16(a)) + assert.Falsef(t, int16(0) < int16(a), "msg with args %d %s", 42, "42") + assert.False(t, int16(a) == int16(0)) + assert.Falsef(t, int16(a) == int16(0), "msg with args %d %s", 42, "42") + assert.False(t, int16(0) == int16(a)) + assert.Falsef(t, int16(0) == int16(a), "msg with args %d %s", 42, "42") + assert.False(t, int16(a) != int16(0)) + assert.Falsef(t, int16(a) != int16(0), "msg with args %d %s", 42, "42") + assert.False(t, int16(0) != int16(a)) + assert.Falsef(t, int16(0) != int16(a), "msg with args %d %s", 42, "42") + assert.False(t, int32(a) > int32(0)) + assert.Falsef(t, int32(a) > int32(0), "msg with args %d %s", 42, "42") + assert.False(t, int32(0) > int32(a)) + assert.Falsef(t, int32(0) > int32(a), "msg with args %d %s", 42, "42") + assert.False(t, int32(a) < int32(0)) + assert.Falsef(t, int32(a) < int32(0), "msg with args %d %s", 42, "42") + assert.False(t, int32(0) < int32(a)) + assert.Falsef(t, int32(0) < int32(a), "msg with args %d %s", 42, "42") + assert.False(t, int32(a) == int32(0)) + assert.Falsef(t, int32(a) == int32(0), "msg with args %d %s", 42, "42") + assert.False(t, int32(0) == int32(a)) + assert.Falsef(t, int32(0) == int32(a), "msg with args %d %s", 42, "42") + assert.False(t, int32(a) != int32(0)) + assert.Falsef(t, int32(a) != int32(0), "msg with args %d %s", 42, "42") + assert.False(t, int32(0) != int32(a)) + assert.Falsef(t, int32(0) != int32(a), "msg with args %d %s", 42, "42") + assert.False(t, int64(a) > int64(0)) + assert.Falsef(t, int64(a) > int64(0), "msg with args %d %s", 42, "42") + assert.False(t, int64(0) > int64(a)) + assert.Falsef(t, int64(0) > int64(a), "msg with args %d %s", 42, "42") + assert.False(t, int64(a) < int64(0)) + assert.Falsef(t, int64(a) < int64(0), "msg with args %d %s", 42, "42") + assert.False(t, int64(0) < int64(a)) + assert.Falsef(t, int64(0) < int64(a), "msg with args %d %s", 42, "42") + assert.False(t, int64(a) == int64(0)) + assert.Falsef(t, int64(a) == int64(0), "msg with args %d %s", 42, "42") + assert.False(t, int64(0) == int64(a)) + assert.Falsef(t, int64(0) == int64(a), "msg with args %d %s", 42, "42") + assert.False(t, int64(a) != int64(0)) + assert.Falsef(t, int64(a) != int64(0), "msg with args %d %s", 42, "42") + assert.False(t, int64(0) != int64(a)) + assert.Falsef(t, int64(0) != int64(a), "msg with args %d %s", 42, "42") + assert.False(t, uint(a) > uint(0)) + assert.Falsef(t, uint(a) > uint(0), "msg with args %d %s", 42, "42") + assert.False(t, uint(0) > uint(a)) + assert.Falsef(t, uint(0) > uint(a), "msg with args %d %s", 42, "42") + assert.False(t, uint(a) < uint(0)) + assert.Falsef(t, uint(a) < uint(0), "msg with args %d %s", 42, "42") + assert.False(t, uint(0) < uint(a)) + assert.Falsef(t, uint(0) < uint(a), "msg with args %d %s", 42, "42") + assert.False(t, uint(a) == uint(0)) + assert.Falsef(t, uint(a) == uint(0), "msg with args %d %s", 42, "42") + assert.False(t, uint(0) == uint(a)) + assert.Falsef(t, uint(0) == uint(a), "msg with args %d %s", 42, "42") + assert.False(t, uint(a) != uint(0)) + assert.Falsef(t, uint(a) != uint(0), "msg with args %d %s", 42, "42") + assert.False(t, uint(0) != uint(a)) + assert.Falsef(t, uint(0) != uint(a), "msg with args %d %s", 42, "42") + assert.False(t, uint8(a) > uint8(0)) + assert.Falsef(t, uint8(a) > uint8(0), "msg with args %d %s", 42, "42") + assert.False(t, uint8(0) > uint8(a)) + assert.Falsef(t, uint8(0) > uint8(a), "msg with args %d %s", 42, "42") + assert.False(t, uint8(a) < uint8(0)) + assert.Falsef(t, uint8(a) < uint8(0), "msg with args %d %s", 42, "42") + assert.False(t, uint8(0) < uint8(a)) + assert.Falsef(t, uint8(0) < uint8(a), "msg with args %d %s", 42, "42") + assert.False(t, uint8(a) == uint8(0)) + assert.Falsef(t, uint8(a) == uint8(0), "msg with args %d %s", 42, "42") + assert.False(t, uint8(0) == uint8(a)) + assert.Falsef(t, uint8(0) == uint8(a), "msg with args %d %s", 42, "42") + assert.False(t, uint8(a) != uint8(0)) + assert.Falsef(t, uint8(a) != uint8(0), "msg with args %d %s", 42, "42") + assert.False(t, uint8(0) != uint8(a)) + assert.Falsef(t, uint8(0) != uint8(a), "msg with args %d %s", 42, "42") + assert.False(t, uint16(a) > uint16(0)) + assert.Falsef(t, uint16(a) > uint16(0), "msg with args %d %s", 42, "42") + assert.False(t, uint16(0) > uint16(a)) + assert.Falsef(t, uint16(0) > uint16(a), "msg with args %d %s", 42, "42") + assert.False(t, uint16(a) < uint16(0)) + assert.Falsef(t, uint16(a) < uint16(0), "msg with args %d %s", 42, "42") + assert.False(t, uint16(0) < uint16(a)) + assert.Falsef(t, uint16(0) < uint16(a), "msg with args %d %s", 42, "42") + assert.False(t, uint16(a) == uint16(0)) + assert.Falsef(t, uint16(a) == uint16(0), "msg with args %d %s", 42, "42") + assert.False(t, uint16(0) == uint16(a)) + assert.Falsef(t, uint16(0) == uint16(a), "msg with args %d %s", 42, "42") + assert.False(t, uint16(a) != uint16(0)) + assert.Falsef(t, uint16(a) != uint16(0), "msg with args %d %s", 42, "42") + assert.False(t, uint16(0) != uint16(a)) + assert.Falsef(t, uint16(0) != uint16(a), "msg with args %d %s", 42, "42") + assert.False(t, uint32(a) > uint32(0)) + assert.Falsef(t, uint32(a) > uint32(0), "msg with args %d %s", 42, "42") + assert.False(t, uint32(0) > uint32(a)) + assert.Falsef(t, uint32(0) > uint32(a), "msg with args %d %s", 42, "42") + assert.False(t, uint32(a) < uint32(0)) + assert.Falsef(t, uint32(a) < uint32(0), "msg with args %d %s", 42, "42") + assert.False(t, uint32(0) < uint32(a)) + assert.Falsef(t, uint32(0) < uint32(a), "msg with args %d %s", 42, "42") + assert.False(t, uint32(a) == uint32(0)) + assert.Falsef(t, uint32(a) == uint32(0), "msg with args %d %s", 42, "42") + assert.False(t, uint32(0) == uint32(a)) + assert.Falsef(t, uint32(0) == uint32(a), "msg with args %d %s", 42, "42") + assert.False(t, uint32(a) != uint32(0)) + assert.Falsef(t, uint32(a) != uint32(0), "msg with args %d %s", 42, "42") + assert.False(t, uint32(0) != uint32(a)) + assert.Falsef(t, uint32(0) != uint32(a), "msg with args %d %s", 42, "42") + assert.False(t, uint64(a) > uint64(0)) + assert.Falsef(t, uint64(a) > uint64(0), "msg with args %d %s", 42, "42") + assert.False(t, uint64(0) > uint64(a)) + assert.Falsef(t, uint64(0) > uint64(a), "msg with args %d %s", 42, "42") + assert.False(t, uint64(a) < uint64(0)) + assert.Falsef(t, uint64(a) < uint64(0), "msg with args %d %s", 42, "42") + assert.False(t, uint64(0) < uint64(a)) + assert.Falsef(t, uint64(0) < uint64(a), "msg with args %d %s", 42, "42") + assert.False(t, uint64(a) == uint64(0)) + assert.Falsef(t, uint64(a) == uint64(0), "msg with args %d %s", 42, "42") + assert.False(t, uint64(0) == uint64(a)) + assert.Falsef(t, uint64(0) == uint64(a), "msg with args %d %s", 42, "42") + assert.False(t, uint64(a) != uint64(0)) + assert.Falsef(t, uint64(a) != uint64(0), "msg with args %d %s", 42, "42") + assert.False(t, uint64(0) != uint64(a)) + assert.Falsef(t, uint64(0) != uint64(a), "msg with args %d %s", 42, "42") + assert.False(t, CustomInt16(a) > CustomInt16(0)) + assert.Falsef(t, CustomInt16(a) > CustomInt16(0), "msg with args %d %s", 42, "42") + assert.False(t, CustomInt16(0) > CustomInt16(a)) + assert.Falsef(t, CustomInt16(0) > CustomInt16(a), "msg with args %d %s", 42, "42") + assert.False(t, CustomInt16(a) < CustomInt16(0)) + assert.Falsef(t, CustomInt16(a) < CustomInt16(0), "msg with args %d %s", 42, "42") + assert.False(t, CustomInt16(0) < CustomInt16(a)) + assert.Falsef(t, CustomInt16(0) < CustomInt16(a), "msg with args %d %s", 42, "42") + assert.False(t, CustomInt16(a) == CustomInt16(0)) + assert.Falsef(t, CustomInt16(a) == CustomInt16(0), "msg with args %d %s", 42, "42") + assert.False(t, CustomInt16(0) == CustomInt16(a)) + assert.Falsef(t, CustomInt16(0) == CustomInt16(a), "msg with args %d %s", 42, "42") + assert.False(t, CustomInt16(a) != CustomInt16(0)) + assert.Falsef(t, CustomInt16(a) != CustomInt16(0), "msg with args %d %s", 42, "42") + assert.False(t, CustomInt16(0) != CustomInt16(a)) + assert.Falsef(t, CustomInt16(0) != CustomInt16(a), "msg with args %d %s", 42, "42") + assert.Less(t, uint(a), uint(0)) + assert.Lessf(t, uint(a), uint(0), "msg with args %d %s", 42, "42") + assert.Greater(t, uint(0), uint(a)) + assert.Greaterf(t, uint(0), uint(a), "msg with args %d %s", 42, "42") + assert.True(t, uint(a) < uint(0)) + assert.Truef(t, uint(a) < uint(0), "msg with args %d %s", 42, "42") + assert.True(t, uint(0) > uint(a)) + assert.Truef(t, uint(0) > uint(a), "msg with args %d %s", 42, "42") + assert.False(t, uint(a) >= uint(0)) + assert.Falsef(t, uint(a) >= uint(0), "msg with args %d %s", 42, "42") + assert.False(t, uint(0) <= uint(a)) + assert.Falsef(t, uint(0) <= uint(a), "msg with args %d %s", 42, "42") + assert.Less(t, uint8(a), uint8(0)) + assert.Lessf(t, uint8(a), uint8(0), "msg with args %d %s", 42, "42") + assert.Greater(t, uint8(0), uint8(a)) + assert.Greaterf(t, uint8(0), uint8(a), "msg with args %d %s", 42, "42") + assert.True(t, uint8(a) < uint8(0)) + assert.Truef(t, uint8(a) < uint8(0), "msg with args %d %s", 42, "42") + assert.True(t, uint8(0) > uint8(a)) + assert.Truef(t, uint8(0) > uint8(a), "msg with args %d %s", 42, "42") + assert.False(t, uint8(a) >= uint8(0)) + assert.Falsef(t, uint8(a) >= uint8(0), "msg with args %d %s", 42, "42") + assert.False(t, uint8(0) <= uint8(a)) + assert.Falsef(t, uint8(0) <= uint8(a), "msg with args %d %s", 42, "42") + assert.Less(t, uint16(a), uint16(0)) + assert.Lessf(t, uint16(a), uint16(0), "msg with args %d %s", 42, "42") + assert.Greater(t, uint16(0), uint16(a)) + assert.Greaterf(t, uint16(0), uint16(a), "msg with args %d %s", 42, "42") + assert.True(t, uint16(a) < uint16(0)) + assert.Truef(t, uint16(a) < uint16(0), "msg with args %d %s", 42, "42") + assert.True(t, uint16(0) > uint16(a)) + assert.Truef(t, uint16(0) > uint16(a), "msg with args %d %s", 42, "42") + assert.False(t, uint16(a) >= uint16(0)) + assert.Falsef(t, uint16(a) >= uint16(0), "msg with args %d %s", 42, "42") + assert.False(t, uint16(0) <= uint16(a)) + assert.Falsef(t, uint16(0) <= uint16(a), "msg with args %d %s", 42, "42") + assert.Less(t, uint32(a), uint32(0)) + assert.Lessf(t, uint32(a), uint32(0), "msg with args %d %s", 42, "42") + assert.Greater(t, uint32(0), uint32(a)) + assert.Greaterf(t, uint32(0), uint32(a), "msg with args %d %s", 42, "42") + assert.True(t, uint32(a) < uint32(0)) + assert.Truef(t, uint32(a) < uint32(0), "msg with args %d %s", 42, "42") + assert.True(t, uint32(0) > uint32(a)) + assert.Truef(t, uint32(0) > uint32(a), "msg with args %d %s", 42, "42") + assert.False(t, uint32(a) >= uint32(0)) + assert.Falsef(t, uint32(a) >= uint32(0), "msg with args %d %s", 42, "42") + assert.False(t, uint32(0) <= uint32(a)) + assert.Falsef(t, uint32(0) <= uint32(a), "msg with args %d %s", 42, "42") + assert.Less(t, uint64(a), uint64(0)) + assert.Lessf(t, uint64(a), uint64(0), "msg with args %d %s", 42, "42") + assert.Greater(t, uint64(0), uint64(a)) + assert.Greaterf(t, uint64(0), uint64(a), "msg with args %d %s", 42, "42") + assert.True(t, uint64(a) < uint64(0)) + assert.Truef(t, uint64(a) < uint64(0), "msg with args %d %s", 42, "42") + assert.True(t, uint64(0) > uint64(a)) + assert.Truef(t, uint64(0) > uint64(a), "msg with args %d %s", 42, "42") + assert.False(t, uint64(a) >= uint64(0)) + assert.Falsef(t, uint64(a) >= uint64(0), "msg with args %d %s", 42, "42") + assert.False(t, uint64(0) <= uint64(a)) + assert.Falsef(t, uint64(0) <= uint64(a), "msg with args %d %s", 42, "42") + assert.Less(t, CustomInt16(a), CustomInt16(0)) + assert.Lessf(t, CustomInt16(a), CustomInt16(0), "msg with args %d %s", 42, "42") + assert.Greater(t, CustomInt16(0), CustomInt16(a)) + assert.Greaterf(t, CustomInt16(0), CustomInt16(a), "msg with args %d %s", 42, "42") + assert.True(t, CustomInt16(a) < CustomInt16(0)) + assert.Truef(t, CustomInt16(a) < CustomInt16(0), "msg with args %d %s", 42, "42") + assert.True(t, CustomInt16(0) > CustomInt16(a)) + assert.Truef(t, CustomInt16(0) > CustomInt16(a), "msg with args %d %s", 42, "42") + assert.False(t, CustomInt16(a) >= CustomInt16(0)) + assert.Falsef(t, CustomInt16(a) >= CustomInt16(0), "msg with args %d %s", 42, "42") + assert.False(t, CustomInt16(0) <= CustomInt16(a)) + assert.Falsef(t, CustomInt16(0) <= CustomInt16(a), "msg with args %d %s", 42, "42") assert.Equal(t, 0, 0) assert.Equalf(t, 0, 0, "msg with args %d %s", 42, "42") assert.Equal(t, a, a) @@ -289,5 +1077,44 @@ func TestNegativePositiveChecker(t *testing.T) { assert.Falsef(t, -1 == -1, "msg with args %d %s", 42, "42") assert.False(t, -1 != -1) assert.Falsef(t, -1 != -1, "msg with args %d %s", 42, "42") + assert.Negative(t, uint(a)) + assert.Negativef(t, uint(a), "msg with args %d %s", 42, "42") + assert.Less(t, uint(a), 0) + assert.Lessf(t, uint(a), 0, "msg with args %d %s", 42, "42") + assert.True(t, uint(a) < 0) + assert.Truef(t, uint(a) < 0, "msg with args %d %s", 42, "42") + assert.True(t, 0 > uint(a)) + assert.Truef(t, 0 > uint(a), "msg with args %d %s", 42, "42") + assert.False(t, uint(a) >= 0) + assert.Falsef(t, uint(a) >= 0, "msg with args %d %s", 42, "42") + assert.False(t, 0 <= uint(a)) + assert.Falsef(t, 0 <= uint(a), "msg with args %d %s", 42, "42") } } + +func TestNegativePositiveChecker_RealLifeUintExamples(t *testing.T) { + var e struct{ VideoMinutes uint64 } + var c struct{ stats struct{ Rto, Ato uint64 } } + var baseLineHeap, minGasExpected uint64 + var result struct{ GasUsed int } + var state struct{ LastUpdatedEpoch ChainEpoch } + var prod map[string]any + + assert.Less(t, uint64(0), e.VideoMinutes) // want "negative-positive: use assert\\.Positive" + assert.Lessf(t, uint64(0), e.VideoMinutes, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Less(t, uint32(0), c.stats.Rto) // want "negative-positive: use assert\\.Positive" + assert.Lessf(t, uint32(0), c.stats.Rto, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Less(t, uint32(0), c.stats.Ato) // want "negative-positive: use assert\\.Positive" + assert.Lessf(t, uint32(0), c.stats.Ato, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Less(t, uint64(0), baseLineHeap) // want "negative-positive: use assert\\.Positive" + assert.Lessf(t, uint64(0), baseLineHeap, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Greater(t, uint64(state.LastUpdatedEpoch), uint64(0)) // want "negative-positive: use assert\\.Positive" + assert.Greaterf(t, uint64(state.LastUpdatedEpoch), uint64(0), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.True(t, uint64(0) < prod["last_claim_time"].(uint64)) // want "negative-positive: use assert\\.Positive" + assert.Truef(t, uint64(0) < prod["last_claim_time"].(uint64), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Greater(t, uint64(result.GasUsed), minGasExpected) + assert.Greaterf(t, uint64(result.GasUsed), minGasExpected, "msg with args %d %s", 42, "42") +} + +type CustomInt16 int16 +type ChainEpoch int64 diff --git a/analyzer/testdata/src/checkers-default/negative-positive/negative_positive_test.go.golden b/analyzer/testdata/src/checkers-default/negative-positive/negative_positive_test.go.golden index a6856c53..626314ad 100644 --- a/analyzer/testdata/src/checkers-default/negative-positive/negative_positive_test.go.golden +++ b/analyzer/testdata/src/checkers-default/negative-positive/negative_positive_test.go.golden @@ -25,6 +25,186 @@ func TestNegativePositiveChecker(t *testing.T) { assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Negative(t, a) // want "negative-positive: use assert\\.Negative" + assert.Negativef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Negativef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" assert.Positivef(t, a, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" assert.Positive(t, a) // want "negative-positive: use assert\\.Positive" @@ -61,6 +241,50 @@ func TestNegativePositiveChecker(t *testing.T) { assert.Equalf(t, 1, a, "msg with args %d %s", 42, "42") assert.Equal(t, a, 1) assert.Equalf(t, a, 1, "msg with args %d %s", 42, "42") + assert.Equal(t, int(0), int(a)) + assert.Equalf(t, int(0), int(a), "msg with args %d %s", 42, "42") + assert.Equal(t, int(a), int(0)) + assert.Equalf(t, int(a), int(0), "msg with args %d %s", 42, "42") + assert.Equal(t, int8(0), int8(a)) + assert.Equalf(t, int8(0), int8(a), "msg with args %d %s", 42, "42") + assert.Equal(t, int8(a), int8(0)) + assert.Equalf(t, int8(a), int8(0), "msg with args %d %s", 42, "42") + assert.Equal(t, int16(0), int16(a)) + assert.Equalf(t, int16(0), int16(a), "msg with args %d %s", 42, "42") + assert.Equal(t, int16(a), int16(0)) + assert.Equalf(t, int16(a), int16(0), "msg with args %d %s", 42, "42") + assert.Equal(t, int32(0), int32(a)) + assert.Equalf(t, int32(0), int32(a), "msg with args %d %s", 42, "42") + assert.Equal(t, int32(a), int32(0)) + assert.Equalf(t, int32(a), int32(0), "msg with args %d %s", 42, "42") + assert.Equal(t, int64(0), int64(a)) + assert.Equalf(t, int64(0), int64(a), "msg with args %d %s", 42, "42") + assert.Equal(t, int64(a), int64(0)) + assert.Equalf(t, int64(a), int64(0), "msg with args %d %s", 42, "42") + assert.Equal(t, uint(0), uint(a)) + assert.Equalf(t, uint(0), uint(a), "msg with args %d %s", 42, "42") + assert.Equal(t, uint(a), uint(0)) + assert.Equalf(t, uint(a), uint(0), "msg with args %d %s", 42, "42") + assert.Equal(t, uint8(0), uint8(a)) + assert.Equalf(t, uint8(0), uint8(a), "msg with args %d %s", 42, "42") + assert.Equal(t, uint8(a), uint8(0)) + assert.Equalf(t, uint8(a), uint8(0), "msg with args %d %s", 42, "42") + assert.Equal(t, uint16(0), uint16(a)) + assert.Equalf(t, uint16(0), uint16(a), "msg with args %d %s", 42, "42") + assert.Equal(t, uint16(a), uint16(0)) + assert.Equalf(t, uint16(a), uint16(0), "msg with args %d %s", 42, "42") + assert.Equal(t, uint32(0), uint32(a)) + assert.Equalf(t, uint32(0), uint32(a), "msg with args %d %s", 42, "42") + assert.Equal(t, uint32(a), uint32(0)) + assert.Equalf(t, uint32(a), uint32(0), "msg with args %d %s", 42, "42") + assert.Equal(t, uint64(0), uint64(a)) + assert.Equalf(t, uint64(0), uint64(a), "msg with args %d %s", 42, "42") + assert.Equal(t, uint64(a), uint64(0)) + assert.Equalf(t, uint64(a), uint64(0), "msg with args %d %s", 42, "42") + assert.Equal(t, CustomInt16(0), CustomInt16(a)) + assert.Equalf(t, CustomInt16(0), CustomInt16(a), "msg with args %d %s", 42, "42") + assert.Equal(t, CustomInt16(a), CustomInt16(0)) + assert.Equalf(t, CustomInt16(a), CustomInt16(0), "msg with args %d %s", 42, "42") assert.NotEqual(t, -1, a) assert.NotEqualf(t, -1, a, "msg with args %d %s", 42, "42") assert.NotEqual(t, a, -1) @@ -73,14 +297,50 @@ func TestNegativePositiveChecker(t *testing.T) { assert.NotEqualf(t, 1, a, "msg with args %d %s", 42, "42") assert.NotEqual(t, a, 1) assert.NotEqualf(t, a, 1, "msg with args %d %s", 42, "42") - assert.Greater(t, -1, a) - assert.Greaterf(t, -1, a, "msg with args %d %s", 42, "42") - assert.Greater(t, a, -1) - assert.Greaterf(t, a, -1, "msg with args %d %s", 42, "42") - assert.Greater(t, a, 1) - assert.Greaterf(t, a, 1, "msg with args %d %s", 42, "42") - assert.Greater(t, 1, a) - assert.Greaterf(t, 1, a, "msg with args %d %s", 42, "42") + assert.NotEqual(t, int(0), int(a)) + assert.NotEqualf(t, int(0), int(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, int(a), int(0)) + assert.NotEqualf(t, int(a), int(0), "msg with args %d %s", 42, "42") + assert.NotEqual(t, int8(0), int8(a)) + assert.NotEqualf(t, int8(0), int8(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, int8(a), int8(0)) + assert.NotEqualf(t, int8(a), int8(0), "msg with args %d %s", 42, "42") + assert.NotEqual(t, int16(0), int16(a)) + assert.NotEqualf(t, int16(0), int16(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, int16(a), int16(0)) + assert.NotEqualf(t, int16(a), int16(0), "msg with args %d %s", 42, "42") + assert.NotEqual(t, int32(0), int32(a)) + assert.NotEqualf(t, int32(0), int32(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, int32(a), int32(0)) + assert.NotEqualf(t, int32(a), int32(0), "msg with args %d %s", 42, "42") + assert.NotEqual(t, int64(0), int64(a)) + assert.NotEqualf(t, int64(0), int64(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, int64(a), int64(0)) + assert.NotEqualf(t, int64(a), int64(0), "msg with args %d %s", 42, "42") + assert.NotEqual(t, uint(0), uint(a)) + assert.NotEqualf(t, uint(0), uint(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, uint(a), uint(0)) + assert.NotEqualf(t, uint(a), uint(0), "msg with args %d %s", 42, "42") + assert.NotEqual(t, uint8(0), uint8(a)) + assert.NotEqualf(t, uint8(0), uint8(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, uint8(a), uint8(0)) + assert.NotEqualf(t, uint8(a), uint8(0), "msg with args %d %s", 42, "42") + assert.NotEqual(t, uint16(0), uint16(a)) + assert.NotEqualf(t, uint16(0), uint16(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, uint16(a), uint16(0)) + assert.NotEqualf(t, uint16(a), uint16(0), "msg with args %d %s", 42, "42") + assert.NotEqual(t, uint32(0), uint32(a)) + assert.NotEqualf(t, uint32(0), uint32(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, uint32(a), uint32(0)) + assert.NotEqualf(t, uint32(a), uint32(0), "msg with args %d %s", 42, "42") + assert.NotEqual(t, uint64(0), uint64(a)) + assert.NotEqualf(t, uint64(0), uint64(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, uint64(a), uint64(0)) + assert.NotEqualf(t, uint64(a), uint64(0), "msg with args %d %s", 42, "42") + assert.NotEqual(t, CustomInt16(0), CustomInt16(a)) + assert.NotEqualf(t, CustomInt16(0), CustomInt16(a), "msg with args %d %s", 42, "42") + assert.NotEqual(t, CustomInt16(a), CustomInt16(0)) + assert.NotEqualf(t, CustomInt16(a), CustomInt16(0), "msg with args %d %s", 42, "42") assert.GreaterOrEqual(t, -1, a) assert.GreaterOrEqualf(t, -1, a, "msg with args %d %s", 42, "42") assert.GreaterOrEqual(t, a, -1) @@ -93,14 +353,50 @@ func TestNegativePositiveChecker(t *testing.T) { assert.GreaterOrEqualf(t, 1, a, "msg with args %d %s", 42, "42") assert.GreaterOrEqual(t, a, 1) assert.GreaterOrEqualf(t, a, 1, "msg with args %d %s", 42, "42") - assert.Less(t, -1, a) - assert.Lessf(t, -1, a, "msg with args %d %s", 42, "42") - assert.Less(t, a, -1) - assert.Lessf(t, a, -1, "msg with args %d %s", 42, "42") - assert.Less(t, 1, a) - assert.Lessf(t, 1, a, "msg with args %d %s", 42, "42") - assert.Less(t, a, 1) - assert.Lessf(t, a, 1, "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, int(0), int(a)) + assert.GreaterOrEqualf(t, int(0), int(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, int(a), int(0)) + assert.GreaterOrEqualf(t, int(a), int(0), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, int8(0), int8(a)) + assert.GreaterOrEqualf(t, int8(0), int8(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, int8(a), int8(0)) + assert.GreaterOrEqualf(t, int8(a), int8(0), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, int16(0), int16(a)) + assert.GreaterOrEqualf(t, int16(0), int16(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, int16(a), int16(0)) + assert.GreaterOrEqualf(t, int16(a), int16(0), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, int32(0), int32(a)) + assert.GreaterOrEqualf(t, int32(0), int32(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, int32(a), int32(0)) + assert.GreaterOrEqualf(t, int32(a), int32(0), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, int64(0), int64(a)) + assert.GreaterOrEqualf(t, int64(0), int64(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, int64(a), int64(0)) + assert.GreaterOrEqualf(t, int64(a), int64(0), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, uint(0), uint(a)) + assert.GreaterOrEqualf(t, uint(0), uint(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, uint(a), uint(0)) + assert.GreaterOrEqualf(t, uint(a), uint(0), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, uint8(0), uint8(a)) + assert.GreaterOrEqualf(t, uint8(0), uint8(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, uint8(a), uint8(0)) + assert.GreaterOrEqualf(t, uint8(a), uint8(0), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, uint16(0), uint16(a)) + assert.GreaterOrEqualf(t, uint16(0), uint16(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, uint16(a), uint16(0)) + assert.GreaterOrEqualf(t, uint16(a), uint16(0), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, uint32(0), uint32(a)) + assert.GreaterOrEqualf(t, uint32(0), uint32(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, uint32(a), uint32(0)) + assert.GreaterOrEqualf(t, uint32(a), uint32(0), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, uint64(0), uint64(a)) + assert.GreaterOrEqualf(t, uint64(0), uint64(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, uint64(a), uint64(0)) + assert.GreaterOrEqualf(t, uint64(a), uint64(0), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, CustomInt16(0), CustomInt16(a)) + assert.GreaterOrEqualf(t, CustomInt16(0), CustomInt16(a), "msg with args %d %s", 42, "42") + assert.GreaterOrEqual(t, CustomInt16(a), CustomInt16(0)) + assert.GreaterOrEqualf(t, CustomInt16(a), CustomInt16(0), "msg with args %d %s", 42, "42") assert.LessOrEqual(t, -1, a) assert.LessOrEqualf(t, -1, a, "msg with args %d %s", 42, "42") assert.LessOrEqual(t, a, -1) @@ -113,134 +409,626 @@ func TestNegativePositiveChecker(t *testing.T) { assert.LessOrEqualf(t, 1, a, "msg with args %d %s", 42, "42") assert.LessOrEqual(t, a, 1) assert.LessOrEqualf(t, a, 1, "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, int(0), int(a)) + assert.LessOrEqualf(t, int(0), int(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, int(a), int(0)) + assert.LessOrEqualf(t, int(a), int(0), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, int8(0), int8(a)) + assert.LessOrEqualf(t, int8(0), int8(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, int8(a), int8(0)) + assert.LessOrEqualf(t, int8(a), int8(0), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, int16(0), int16(a)) + assert.LessOrEqualf(t, int16(0), int16(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, int16(a), int16(0)) + assert.LessOrEqualf(t, int16(a), int16(0), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, int32(0), int32(a)) + assert.LessOrEqualf(t, int32(0), int32(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, int32(a), int32(0)) + assert.LessOrEqualf(t, int32(a), int32(0), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, int64(0), int64(a)) + assert.LessOrEqualf(t, int64(0), int64(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, int64(a), int64(0)) + assert.LessOrEqualf(t, int64(a), int64(0), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, uint(0), uint(a)) + assert.LessOrEqualf(t, uint(0), uint(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, uint(a), uint(0)) + assert.LessOrEqualf(t, uint(a), uint(0), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, uint8(0), uint8(a)) + assert.LessOrEqualf(t, uint8(0), uint8(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, uint8(a), uint8(0)) + assert.LessOrEqualf(t, uint8(a), uint8(0), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, uint16(0), uint16(a)) + assert.LessOrEqualf(t, uint16(0), uint16(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, uint16(a), uint16(0)) + assert.LessOrEqualf(t, uint16(a), uint16(0), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, uint32(0), uint32(a)) + assert.LessOrEqualf(t, uint32(0), uint32(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, uint32(a), uint32(0)) + assert.LessOrEqualf(t, uint32(a), uint32(0), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, uint64(0), uint64(a)) + assert.LessOrEqualf(t, uint64(0), uint64(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, uint64(a), uint64(0)) + assert.LessOrEqualf(t, uint64(a), uint64(0), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, CustomInt16(0), CustomInt16(a)) + assert.LessOrEqualf(t, CustomInt16(0), CustomInt16(a), "msg with args %d %s", 42, "42") + assert.LessOrEqual(t, CustomInt16(a), CustomInt16(0)) + assert.LessOrEqualf(t, CustomInt16(a), CustomInt16(0), "msg with args %d %s", 42, "42") + assert.Greater(t, -1, a) + assert.Greaterf(t, -1, a, "msg with args %d %s", 42, "42") + assert.Greater(t, a, -1) + assert.Greaterf(t, a, -1, "msg with args %d %s", 42, "42") + assert.Greater(t, CustomInt16(0), a) + assert.Greaterf(t, CustomInt16(0), a, "msg with args %d %s", 42, "42") + assert.Greater(t, a, CustomInt16(0)) + assert.Greaterf(t, a, CustomInt16(0), "msg with args %d %s", 42, "42") + assert.Greater(t, 1, a) + assert.Greaterf(t, 1, a, "msg with args %d %s", 42, "42") + assert.Greater(t, a, 1) + assert.Greaterf(t, a, 1, "msg with args %d %s", 42, "42") + assert.Less(t, -1, a) + assert.Lessf(t, -1, a, "msg with args %d %s", 42, "42") + assert.Less(t, a, -1) + assert.Lessf(t, a, -1, "msg with args %d %s", 42, "42") + assert.Less(t, CustomInt16(0), a) + assert.Lessf(t, CustomInt16(0), a, "msg with args %d %s", 42, "42") + assert.Less(t, a, CustomInt16(0)) + assert.Lessf(t, a, CustomInt16(0), "msg with args %d %s", 42, "42") + assert.Less(t, 1, a) + assert.Lessf(t, 1, a, "msg with args %d %s", 42, "42") + assert.Less(t, a, 1) + assert.Lessf(t, a, 1, "msg with args %d %s", 42, "42") assert.True(t, a > -1) assert.Truef(t, a > -1, "msg with args %d %s", 42, "42") - assert.True(t, a < -1) - assert.Truef(t, a < -1, "msg with args %d %s", 42, "42") - assert.True(t, a >= -1) - assert.Truef(t, a >= -1, "msg with args %d %s", 42, "42") - assert.True(t, a <= -1) - assert.Truef(t, a <= -1, "msg with args %d %s", 42, "42") - assert.True(t, a == -1) - assert.Truef(t, a == -1, "msg with args %d %s", 42, "42") - assert.True(t, a != -1) - assert.Truef(t, a != -1, "msg with args %d %s", 42, "42") assert.True(t, -1 > a) assert.Truef(t, -1 > a, "msg with args %d %s", 42, "42") + assert.True(t, a < -1) + assert.Truef(t, a < -1, "msg with args %d %s", 42, "42") assert.True(t, -1 < a) assert.Truef(t, -1 < a, "msg with args %d %s", 42, "42") + assert.True(t, a >= -1) + assert.Truef(t, a >= -1, "msg with args %d %s", 42, "42") assert.True(t, -1 >= a) assert.Truef(t, -1 >= a, "msg with args %d %s", 42, "42") + assert.True(t, a <= -1) + assert.Truef(t, a <= -1, "msg with args %d %s", 42, "42") assert.True(t, -1 <= a) assert.Truef(t, -1 <= a, "msg with args %d %s", 42, "42") + assert.True(t, a == -1) + assert.Truef(t, a == -1, "msg with args %d %s", 42, "42") assert.True(t, -1 == a) assert.Truef(t, -1 == a, "msg with args %d %s", 42, "42") + assert.True(t, a != -1) + assert.Truef(t, a != -1, "msg with args %d %s", 42, "42") assert.True(t, -1 != a) assert.Truef(t, -1 != a, "msg with args %d %s", 42, "42") - assert.True(t, a >= 0) - assert.Truef(t, a >= 0, "msg with args %d %s", 42, "42") - assert.True(t, a <= 0) - assert.Truef(t, a <= 0, "msg with args %d %s", 42, "42") - assert.True(t, a == 0) - assert.Truef(t, a == 0, "msg with args %d %s", 42, "42") - assert.True(t, a != 0) - assert.Truef(t, a != 0, "msg with args %d %s", 42, "42") - assert.True(t, 0 >= a) - assert.Truef(t, 0 >= a, "msg with args %d %s", 42, "42") - assert.True(t, 0 <= a) - assert.Truef(t, 0 <= a, "msg with args %d %s", 42, "42") - assert.True(t, 0 == a) - assert.Truef(t, 0 == a, "msg with args %d %s", 42, "42") - assert.True(t, 0 != a) - assert.Truef(t, 0 != a, "msg with args %d %s", 42, "42") assert.True(t, a > 1) assert.Truef(t, a > 1, "msg with args %d %s", 42, "42") - assert.True(t, a < 1) - assert.Truef(t, a < 1, "msg with args %d %s", 42, "42") - assert.True(t, a >= 1) - assert.Truef(t, a >= 1, "msg with args %d %s", 42, "42") - assert.True(t, a <= 1) - assert.Truef(t, a <= 1, "msg with args %d %s", 42, "42") - assert.True(t, a == 1) - assert.Truef(t, a == 1, "msg with args %d %s", 42, "42") - assert.True(t, a != 1) - assert.Truef(t, a != 1, "msg with args %d %s", 42, "42") assert.True(t, 1 > a) assert.Truef(t, 1 > a, "msg with args %d %s", 42, "42") + assert.True(t, a < 1) + assert.Truef(t, a < 1, "msg with args %d %s", 42, "42") assert.True(t, 1 < a) assert.Truef(t, 1 < a, "msg with args %d %s", 42, "42") + assert.True(t, a >= 1) + assert.Truef(t, a >= 1, "msg with args %d %s", 42, "42") assert.True(t, 1 >= a) assert.Truef(t, 1 >= a, "msg with args %d %s", 42, "42") + assert.True(t, a <= 1) + assert.Truef(t, a <= 1, "msg with args %d %s", 42, "42") assert.True(t, 1 <= a) assert.Truef(t, 1 <= a, "msg with args %d %s", 42, "42") + assert.True(t, a == 1) + assert.Truef(t, a == 1, "msg with args %d %s", 42, "42") assert.True(t, 1 == a) assert.Truef(t, 1 == a, "msg with args %d %s", 42, "42") + assert.True(t, a != 1) + assert.Truef(t, a != 1, "msg with args %d %s", 42, "42") assert.True(t, 1 != a) assert.Truef(t, 1 != a, "msg with args %d %s", 42, "42") assert.False(t, a > -1) assert.Falsef(t, a > -1, "msg with args %d %s", 42, "42") - assert.False(t, a < -1) - assert.Falsef(t, a < -1, "msg with args %d %s", 42, "42") - assert.False(t, a >= -1) - assert.Falsef(t, a >= -1, "msg with args %d %s", 42, "42") - assert.False(t, a <= -1) - assert.Falsef(t, a <= -1, "msg with args %d %s", 42, "42") - assert.False(t, a == -1) - assert.Falsef(t, a == -1, "msg with args %d %s", 42, "42") - assert.False(t, a != -1) - assert.Falsef(t, a != -1, "msg with args %d %s", 42, "42") assert.False(t, -1 > a) assert.Falsef(t, -1 > a, "msg with args %d %s", 42, "42") + assert.False(t, a < -1) + assert.Falsef(t, a < -1, "msg with args %d %s", 42, "42") assert.False(t, -1 < a) assert.Falsef(t, -1 < a, "msg with args %d %s", 42, "42") + assert.False(t, a >= -1) + assert.Falsef(t, a >= -1, "msg with args %d %s", 42, "42") assert.False(t, -1 >= a) assert.Falsef(t, -1 >= a, "msg with args %d %s", 42, "42") + assert.False(t, a <= -1) + assert.Falsef(t, a <= -1, "msg with args %d %s", 42, "42") assert.False(t, -1 <= a) assert.Falsef(t, -1 <= a, "msg with args %d %s", 42, "42") + assert.False(t, a == -1) + assert.Falsef(t, a == -1, "msg with args %d %s", 42, "42") assert.False(t, -1 == a) assert.Falsef(t, -1 == a, "msg with args %d %s", 42, "42") + assert.False(t, a != -1) + assert.Falsef(t, a != -1, "msg with args %d %s", 42, "42") assert.False(t, -1 != a) assert.Falsef(t, -1 != a, "msg with args %d %s", 42, "42") - assert.False(t, a > 0) - assert.Falsef(t, a > 0, "msg with args %d %s", 42, "42") - assert.False(t, a < 0) - assert.Falsef(t, a < 0, "msg with args %d %s", 42, "42") - assert.False(t, a == 0) - assert.Falsef(t, a == 0, "msg with args %d %s", 42, "42") - assert.False(t, a != 0) - assert.Falsef(t, a != 0, "msg with args %d %s", 42, "42") - assert.False(t, 0 > a) - assert.Falsef(t, 0 > a, "msg with args %d %s", 42, "42") - assert.False(t, 0 < a) - assert.Falsef(t, 0 < a, "msg with args %d %s", 42, "42") - assert.False(t, 0 == a) - assert.Falsef(t, 0 == a, "msg with args %d %s", 42, "42") - assert.False(t, 0 != a) - assert.Falsef(t, 0 != a, "msg with args %d %s", 42, "42") assert.False(t, a > 1) assert.Falsef(t, a > 1, "msg with args %d %s", 42, "42") - assert.False(t, a < 1) - assert.Falsef(t, a < 1, "msg with args %d %s", 42, "42") - assert.False(t, a >= 1) - assert.Falsef(t, a >= 1, "msg with args %d %s", 42, "42") - assert.False(t, a <= 1) - assert.Falsef(t, a <= 1, "msg with args %d %s", 42, "42") - assert.False(t, a == 1) - assert.Falsef(t, a == 1, "msg with args %d %s", 42, "42") - assert.False(t, a != 1) - assert.Falsef(t, a != 1, "msg with args %d %s", 42, "42") assert.False(t, 1 > a) assert.Falsef(t, 1 > a, "msg with args %d %s", 42, "42") + assert.False(t, a < 1) + assert.Falsef(t, a < 1, "msg with args %d %s", 42, "42") assert.False(t, 1 < a) assert.Falsef(t, 1 < a, "msg with args %d %s", 42, "42") + assert.False(t, a >= 1) + assert.Falsef(t, a >= 1, "msg with args %d %s", 42, "42") assert.False(t, 1 >= a) assert.Falsef(t, 1 >= a, "msg with args %d %s", 42, "42") + assert.False(t, a <= 1) + assert.Falsef(t, a <= 1, "msg with args %d %s", 42, "42") assert.False(t, 1 <= a) assert.Falsef(t, 1 <= a, "msg with args %d %s", 42, "42") + assert.False(t, a == 1) + assert.Falsef(t, a == 1, "msg with args %d %s", 42, "42") assert.False(t, 1 == a) assert.Falsef(t, 1 == a, "msg with args %d %s", 42, "42") + assert.False(t, a != 1) + assert.Falsef(t, a != 1, "msg with args %d %s", 42, "42") assert.False(t, 1 != a) assert.Falsef(t, 1 != a, "msg with args %d %s", 42, "42") + assert.True(t, a >= 0) + assert.Truef(t, a >= 0, "msg with args %d %s", 42, "42") + assert.True(t, 0 >= a) + assert.Truef(t, 0 >= a, "msg with args %d %s", 42, "42") + assert.True(t, a <= 0) + assert.Truef(t, a <= 0, "msg with args %d %s", 42, "42") + assert.True(t, 0 <= a) + assert.Truef(t, 0 <= a, "msg with args %d %s", 42, "42") + assert.True(t, a == 0) + assert.Truef(t, a == 0, "msg with args %d %s", 42, "42") + assert.True(t, 0 == a) + assert.Truef(t, 0 == a, "msg with args %d %s", 42, "42") + assert.True(t, a != 0) + assert.Truef(t, a != 0, "msg with args %d %s", 42, "42") + assert.True(t, 0 != a) + assert.Truef(t, 0 != a, "msg with args %d %s", 42, "42") + assert.True(t, int(a) >= int(0)) + assert.Truef(t, int(a) >= int(0), "msg with args %d %s", 42, "42") + assert.True(t, int(0) >= int(a)) + assert.Truef(t, int(0) >= int(a), "msg with args %d %s", 42, "42") + assert.True(t, int(a) <= int(0)) + assert.Truef(t, int(a) <= int(0), "msg with args %d %s", 42, "42") + assert.True(t, int(0) <= int(a)) + assert.Truef(t, int(0) <= int(a), "msg with args %d %s", 42, "42") + assert.True(t, int(a) == int(0)) + assert.Truef(t, int(a) == int(0), "msg with args %d %s", 42, "42") + assert.True(t, int(0) == int(a)) + assert.Truef(t, int(0) == int(a), "msg with args %d %s", 42, "42") + assert.True(t, int(a) != int(0)) + assert.Truef(t, int(a) != int(0), "msg with args %d %s", 42, "42") + assert.True(t, int(0) != int(a)) + assert.Truef(t, int(0) != int(a), "msg with args %d %s", 42, "42") + assert.True(t, int8(a) >= int8(0)) + assert.Truef(t, int8(a) >= int8(0), "msg with args %d %s", 42, "42") + assert.True(t, int8(0) >= int8(a)) + assert.Truef(t, int8(0) >= int8(a), "msg with args %d %s", 42, "42") + assert.True(t, int8(a) <= int8(0)) + assert.Truef(t, int8(a) <= int8(0), "msg with args %d %s", 42, "42") + assert.True(t, int8(0) <= int8(a)) + assert.Truef(t, int8(0) <= int8(a), "msg with args %d %s", 42, "42") + assert.True(t, int8(a) == int8(0)) + assert.Truef(t, int8(a) == int8(0), "msg with args %d %s", 42, "42") + assert.True(t, int8(0) == int8(a)) + assert.Truef(t, int8(0) == int8(a), "msg with args %d %s", 42, "42") + assert.True(t, int8(a) != int8(0)) + assert.Truef(t, int8(a) != int8(0), "msg with args %d %s", 42, "42") + assert.True(t, int8(0) != int8(a)) + assert.Truef(t, int8(0) != int8(a), "msg with args %d %s", 42, "42") + assert.True(t, int16(a) >= int16(0)) + assert.Truef(t, int16(a) >= int16(0), "msg with args %d %s", 42, "42") + assert.True(t, int16(0) >= int16(a)) + assert.Truef(t, int16(0) >= int16(a), "msg with args %d %s", 42, "42") + assert.True(t, int16(a) <= int16(0)) + assert.Truef(t, int16(a) <= int16(0), "msg with args %d %s", 42, "42") + assert.True(t, int16(0) <= int16(a)) + assert.Truef(t, int16(0) <= int16(a), "msg with args %d %s", 42, "42") + assert.True(t, int16(a) == int16(0)) + assert.Truef(t, int16(a) == int16(0), "msg with args %d %s", 42, "42") + assert.True(t, int16(0) == int16(a)) + assert.Truef(t, int16(0) == int16(a), "msg with args %d %s", 42, "42") + assert.True(t, int16(a) != int16(0)) + assert.Truef(t, int16(a) != int16(0), "msg with args %d %s", 42, "42") + assert.True(t, int16(0) != int16(a)) + assert.Truef(t, int16(0) != int16(a), "msg with args %d %s", 42, "42") + assert.True(t, int32(a) >= int32(0)) + assert.Truef(t, int32(a) >= int32(0), "msg with args %d %s", 42, "42") + assert.True(t, int32(0) >= int32(a)) + assert.Truef(t, int32(0) >= int32(a), "msg with args %d %s", 42, "42") + assert.True(t, int32(a) <= int32(0)) + assert.Truef(t, int32(a) <= int32(0), "msg with args %d %s", 42, "42") + assert.True(t, int32(0) <= int32(a)) + assert.Truef(t, int32(0) <= int32(a), "msg with args %d %s", 42, "42") + assert.True(t, int32(a) == int32(0)) + assert.Truef(t, int32(a) == int32(0), "msg with args %d %s", 42, "42") + assert.True(t, int32(0) == int32(a)) + assert.Truef(t, int32(0) == int32(a), "msg with args %d %s", 42, "42") + assert.True(t, int32(a) != int32(0)) + assert.Truef(t, int32(a) != int32(0), "msg with args %d %s", 42, "42") + assert.True(t, int32(0) != int32(a)) + assert.Truef(t, int32(0) != int32(a), "msg with args %d %s", 42, "42") + assert.True(t, int64(a) >= int64(0)) + assert.Truef(t, int64(a) >= int64(0), "msg with args %d %s", 42, "42") + assert.True(t, int64(0) >= int64(a)) + assert.Truef(t, int64(0) >= int64(a), "msg with args %d %s", 42, "42") + assert.True(t, int64(a) <= int64(0)) + assert.Truef(t, int64(a) <= int64(0), "msg with args %d %s", 42, "42") + assert.True(t, int64(0) <= int64(a)) + assert.Truef(t, int64(0) <= int64(a), "msg with args %d %s", 42, "42") + assert.True(t, int64(a) == int64(0)) + assert.Truef(t, int64(a) == int64(0), "msg with args %d %s", 42, "42") + assert.True(t, int64(0) == int64(a)) + assert.Truef(t, int64(0) == int64(a), "msg with args %d %s", 42, "42") + assert.True(t, int64(a) != int64(0)) + assert.Truef(t, int64(a) != int64(0), "msg with args %d %s", 42, "42") + assert.True(t, int64(0) != int64(a)) + assert.Truef(t, int64(0) != int64(a), "msg with args %d %s", 42, "42") + assert.True(t, uint(a) >= uint(0)) + assert.Truef(t, uint(a) >= uint(0), "msg with args %d %s", 42, "42") + assert.True(t, uint(0) >= uint(a)) + assert.Truef(t, uint(0) >= uint(a), "msg with args %d %s", 42, "42") + assert.True(t, uint(a) <= uint(0)) + assert.Truef(t, uint(a) <= uint(0), "msg with args %d %s", 42, "42") + assert.True(t, uint(0) <= uint(a)) + assert.Truef(t, uint(0) <= uint(a), "msg with args %d %s", 42, "42") + assert.True(t, uint(a) == uint(0)) + assert.Truef(t, uint(a) == uint(0), "msg with args %d %s", 42, "42") + assert.True(t, uint(0) == uint(a)) + assert.Truef(t, uint(0) == uint(a), "msg with args %d %s", 42, "42") + assert.True(t, uint(a) != uint(0)) + assert.Truef(t, uint(a) != uint(0), "msg with args %d %s", 42, "42") + assert.True(t, uint(0) != uint(a)) + assert.Truef(t, uint(0) != uint(a), "msg with args %d %s", 42, "42") + assert.True(t, uint8(a) >= uint8(0)) + assert.Truef(t, uint8(a) >= uint8(0), "msg with args %d %s", 42, "42") + assert.True(t, uint8(0) >= uint8(a)) + assert.Truef(t, uint8(0) >= uint8(a), "msg with args %d %s", 42, "42") + assert.True(t, uint8(a) <= uint8(0)) + assert.Truef(t, uint8(a) <= uint8(0), "msg with args %d %s", 42, "42") + assert.True(t, uint8(0) <= uint8(a)) + assert.Truef(t, uint8(0) <= uint8(a), "msg with args %d %s", 42, "42") + assert.True(t, uint8(a) == uint8(0)) + assert.Truef(t, uint8(a) == uint8(0), "msg with args %d %s", 42, "42") + assert.True(t, uint8(0) == uint8(a)) + assert.Truef(t, uint8(0) == uint8(a), "msg with args %d %s", 42, "42") + assert.True(t, uint8(a) != uint8(0)) + assert.Truef(t, uint8(a) != uint8(0), "msg with args %d %s", 42, "42") + assert.True(t, uint8(0) != uint8(a)) + assert.Truef(t, uint8(0) != uint8(a), "msg with args %d %s", 42, "42") + assert.True(t, uint16(a) >= uint16(0)) + assert.Truef(t, uint16(a) >= uint16(0), "msg with args %d %s", 42, "42") + assert.True(t, uint16(0) >= uint16(a)) + assert.Truef(t, uint16(0) >= uint16(a), "msg with args %d %s", 42, "42") + assert.True(t, uint16(a) <= uint16(0)) + assert.Truef(t, uint16(a) <= uint16(0), "msg with args %d %s", 42, "42") + assert.True(t, uint16(0) <= uint16(a)) + assert.Truef(t, uint16(0) <= uint16(a), "msg with args %d %s", 42, "42") + assert.True(t, uint16(a) == uint16(0)) + assert.Truef(t, uint16(a) == uint16(0), "msg with args %d %s", 42, "42") + assert.True(t, uint16(0) == uint16(a)) + assert.Truef(t, uint16(0) == uint16(a), "msg with args %d %s", 42, "42") + assert.True(t, uint16(a) != uint16(0)) + assert.Truef(t, uint16(a) != uint16(0), "msg with args %d %s", 42, "42") + assert.True(t, uint16(0) != uint16(a)) + assert.Truef(t, uint16(0) != uint16(a), "msg with args %d %s", 42, "42") + assert.True(t, uint32(a) >= uint32(0)) + assert.Truef(t, uint32(a) >= uint32(0), "msg with args %d %s", 42, "42") + assert.True(t, uint32(0) >= uint32(a)) + assert.Truef(t, uint32(0) >= uint32(a), "msg with args %d %s", 42, "42") + assert.True(t, uint32(a) <= uint32(0)) + assert.Truef(t, uint32(a) <= uint32(0), "msg with args %d %s", 42, "42") + assert.True(t, uint32(0) <= uint32(a)) + assert.Truef(t, uint32(0) <= uint32(a), "msg with args %d %s", 42, "42") + assert.True(t, uint32(a) == uint32(0)) + assert.Truef(t, uint32(a) == uint32(0), "msg with args %d %s", 42, "42") + assert.True(t, uint32(0) == uint32(a)) + assert.Truef(t, uint32(0) == uint32(a), "msg with args %d %s", 42, "42") + assert.True(t, uint32(a) != uint32(0)) + assert.Truef(t, uint32(a) != uint32(0), "msg with args %d %s", 42, "42") + assert.True(t, uint32(0) != uint32(a)) + assert.Truef(t, uint32(0) != uint32(a), "msg with args %d %s", 42, "42") + assert.True(t, uint64(a) >= uint64(0)) + assert.Truef(t, uint64(a) >= uint64(0), "msg with args %d %s", 42, "42") + assert.True(t, uint64(0) >= uint64(a)) + assert.Truef(t, uint64(0) >= uint64(a), "msg with args %d %s", 42, "42") + assert.True(t, uint64(a) <= uint64(0)) + assert.Truef(t, uint64(a) <= uint64(0), "msg with args %d %s", 42, "42") + assert.True(t, uint64(0) <= uint64(a)) + assert.Truef(t, uint64(0) <= uint64(a), "msg with args %d %s", 42, "42") + assert.True(t, uint64(a) == uint64(0)) + assert.Truef(t, uint64(a) == uint64(0), "msg with args %d %s", 42, "42") + assert.True(t, uint64(0) == uint64(a)) + assert.Truef(t, uint64(0) == uint64(a), "msg with args %d %s", 42, "42") + assert.True(t, uint64(a) != uint64(0)) + assert.Truef(t, uint64(a) != uint64(0), "msg with args %d %s", 42, "42") + assert.True(t, uint64(0) != uint64(a)) + assert.Truef(t, uint64(0) != uint64(a), "msg with args %d %s", 42, "42") + assert.True(t, CustomInt16(a) >= CustomInt16(0)) + assert.Truef(t, CustomInt16(a) >= CustomInt16(0), "msg with args %d %s", 42, "42") + assert.True(t, CustomInt16(0) >= CustomInt16(a)) + assert.Truef(t, CustomInt16(0) >= CustomInt16(a), "msg with args %d %s", 42, "42") + assert.True(t, CustomInt16(a) <= CustomInt16(0)) + assert.Truef(t, CustomInt16(a) <= CustomInt16(0), "msg with args %d %s", 42, "42") + assert.True(t, CustomInt16(0) <= CustomInt16(a)) + assert.Truef(t, CustomInt16(0) <= CustomInt16(a), "msg with args %d %s", 42, "42") + assert.True(t, CustomInt16(a) == CustomInt16(0)) + assert.Truef(t, CustomInt16(a) == CustomInt16(0), "msg with args %d %s", 42, "42") + assert.True(t, CustomInt16(0) == CustomInt16(a)) + assert.Truef(t, CustomInt16(0) == CustomInt16(a), "msg with args %d %s", 42, "42") + assert.True(t, CustomInt16(a) != CustomInt16(0)) + assert.Truef(t, CustomInt16(a) != CustomInt16(0), "msg with args %d %s", 42, "42") + assert.True(t, CustomInt16(0) != CustomInt16(a)) + assert.Truef(t, CustomInt16(0) != CustomInt16(a), "msg with args %d %s", 42, "42") + assert.False(t, a > 0) + assert.Falsef(t, a > 0, "msg with args %d %s", 42, "42") + assert.False(t, 0 > a) + assert.Falsef(t, 0 > a, "msg with args %d %s", 42, "42") + assert.False(t, a < 0) + assert.Falsef(t, a < 0, "msg with args %d %s", 42, "42") + assert.False(t, 0 < a) + assert.Falsef(t, 0 < a, "msg with args %d %s", 42, "42") + assert.False(t, a == 0) + assert.Falsef(t, a == 0, "msg with args %d %s", 42, "42") + assert.False(t, 0 == a) + assert.Falsef(t, 0 == a, "msg with args %d %s", 42, "42") + assert.False(t, a != 0) + assert.Falsef(t, a != 0, "msg with args %d %s", 42, "42") + assert.False(t, 0 != a) + assert.Falsef(t, 0 != a, "msg with args %d %s", 42, "42") + assert.False(t, int(a) > int(0)) + assert.Falsef(t, int(a) > int(0), "msg with args %d %s", 42, "42") + assert.False(t, int(0) > int(a)) + assert.Falsef(t, int(0) > int(a), "msg with args %d %s", 42, "42") + assert.False(t, int(a) < int(0)) + assert.Falsef(t, int(a) < int(0), "msg with args %d %s", 42, "42") + assert.False(t, int(0) < int(a)) + assert.Falsef(t, int(0) < int(a), "msg with args %d %s", 42, "42") + assert.False(t, int(a) == int(0)) + assert.Falsef(t, int(a) == int(0), "msg with args %d %s", 42, "42") + assert.False(t, int(0) == int(a)) + assert.Falsef(t, int(0) == int(a), "msg with args %d %s", 42, "42") + assert.False(t, int(a) != int(0)) + assert.Falsef(t, int(a) != int(0), "msg with args %d %s", 42, "42") + assert.False(t, int(0) != int(a)) + assert.Falsef(t, int(0) != int(a), "msg with args %d %s", 42, "42") + assert.False(t, int8(a) > int8(0)) + assert.Falsef(t, int8(a) > int8(0), "msg with args %d %s", 42, "42") + assert.False(t, int8(0) > int8(a)) + assert.Falsef(t, int8(0) > int8(a), "msg with args %d %s", 42, "42") + assert.False(t, int8(a) < int8(0)) + assert.Falsef(t, int8(a) < int8(0), "msg with args %d %s", 42, "42") + assert.False(t, int8(0) < int8(a)) + assert.Falsef(t, int8(0) < int8(a), "msg with args %d %s", 42, "42") + assert.False(t, int8(a) == int8(0)) + assert.Falsef(t, int8(a) == int8(0), "msg with args %d %s", 42, "42") + assert.False(t, int8(0) == int8(a)) + assert.Falsef(t, int8(0) == int8(a), "msg with args %d %s", 42, "42") + assert.False(t, int8(a) != int8(0)) + assert.Falsef(t, int8(a) != int8(0), "msg with args %d %s", 42, "42") + assert.False(t, int8(0) != int8(a)) + assert.Falsef(t, int8(0) != int8(a), "msg with args %d %s", 42, "42") + assert.False(t, int16(a) > int16(0)) + assert.Falsef(t, int16(a) > int16(0), "msg with args %d %s", 42, "42") + assert.False(t, int16(0) > int16(a)) + assert.Falsef(t, int16(0) > int16(a), "msg with args %d %s", 42, "42") + assert.False(t, int16(a) < int16(0)) + assert.Falsef(t, int16(a) < int16(0), "msg with args %d %s", 42, "42") + assert.False(t, int16(0) < int16(a)) + assert.Falsef(t, int16(0) < int16(a), "msg with args %d %s", 42, "42") + assert.False(t, int16(a) == int16(0)) + assert.Falsef(t, int16(a) == int16(0), "msg with args %d %s", 42, "42") + assert.False(t, int16(0) == int16(a)) + assert.Falsef(t, int16(0) == int16(a), "msg with args %d %s", 42, "42") + assert.False(t, int16(a) != int16(0)) + assert.Falsef(t, int16(a) != int16(0), "msg with args %d %s", 42, "42") + assert.False(t, int16(0) != int16(a)) + assert.Falsef(t, int16(0) != int16(a), "msg with args %d %s", 42, "42") + assert.False(t, int32(a) > int32(0)) + assert.Falsef(t, int32(a) > int32(0), "msg with args %d %s", 42, "42") + assert.False(t, int32(0) > int32(a)) + assert.Falsef(t, int32(0) > int32(a), "msg with args %d %s", 42, "42") + assert.False(t, int32(a) < int32(0)) + assert.Falsef(t, int32(a) < int32(0), "msg with args %d %s", 42, "42") + assert.False(t, int32(0) < int32(a)) + assert.Falsef(t, int32(0) < int32(a), "msg with args %d %s", 42, "42") + assert.False(t, int32(a) == int32(0)) + assert.Falsef(t, int32(a) == int32(0), "msg with args %d %s", 42, "42") + assert.False(t, int32(0) == int32(a)) + assert.Falsef(t, int32(0) == int32(a), "msg with args %d %s", 42, "42") + assert.False(t, int32(a) != int32(0)) + assert.Falsef(t, int32(a) != int32(0), "msg with args %d %s", 42, "42") + assert.False(t, int32(0) != int32(a)) + assert.Falsef(t, int32(0) != int32(a), "msg with args %d %s", 42, "42") + assert.False(t, int64(a) > int64(0)) + assert.Falsef(t, int64(a) > int64(0), "msg with args %d %s", 42, "42") + assert.False(t, int64(0) > int64(a)) + assert.Falsef(t, int64(0) > int64(a), "msg with args %d %s", 42, "42") + assert.False(t, int64(a) < int64(0)) + assert.Falsef(t, int64(a) < int64(0), "msg with args %d %s", 42, "42") + assert.False(t, int64(0) < int64(a)) + assert.Falsef(t, int64(0) < int64(a), "msg with args %d %s", 42, "42") + assert.False(t, int64(a) == int64(0)) + assert.Falsef(t, int64(a) == int64(0), "msg with args %d %s", 42, "42") + assert.False(t, int64(0) == int64(a)) + assert.Falsef(t, int64(0) == int64(a), "msg with args %d %s", 42, "42") + assert.False(t, int64(a) != int64(0)) + assert.Falsef(t, int64(a) != int64(0), "msg with args %d %s", 42, "42") + assert.False(t, int64(0) != int64(a)) + assert.Falsef(t, int64(0) != int64(a), "msg with args %d %s", 42, "42") + assert.False(t, uint(a) > uint(0)) + assert.Falsef(t, uint(a) > uint(0), "msg with args %d %s", 42, "42") + assert.False(t, uint(0) > uint(a)) + assert.Falsef(t, uint(0) > uint(a), "msg with args %d %s", 42, "42") + assert.False(t, uint(a) < uint(0)) + assert.Falsef(t, uint(a) < uint(0), "msg with args %d %s", 42, "42") + assert.False(t, uint(0) < uint(a)) + assert.Falsef(t, uint(0) < uint(a), "msg with args %d %s", 42, "42") + assert.False(t, uint(a) == uint(0)) + assert.Falsef(t, uint(a) == uint(0), "msg with args %d %s", 42, "42") + assert.False(t, uint(0) == uint(a)) + assert.Falsef(t, uint(0) == uint(a), "msg with args %d %s", 42, "42") + assert.False(t, uint(a) != uint(0)) + assert.Falsef(t, uint(a) != uint(0), "msg with args %d %s", 42, "42") + assert.False(t, uint(0) != uint(a)) + assert.Falsef(t, uint(0) != uint(a), "msg with args %d %s", 42, "42") + assert.False(t, uint8(a) > uint8(0)) + assert.Falsef(t, uint8(a) > uint8(0), "msg with args %d %s", 42, "42") + assert.False(t, uint8(0) > uint8(a)) + assert.Falsef(t, uint8(0) > uint8(a), "msg with args %d %s", 42, "42") + assert.False(t, uint8(a) < uint8(0)) + assert.Falsef(t, uint8(a) < uint8(0), "msg with args %d %s", 42, "42") + assert.False(t, uint8(0) < uint8(a)) + assert.Falsef(t, uint8(0) < uint8(a), "msg with args %d %s", 42, "42") + assert.False(t, uint8(a) == uint8(0)) + assert.Falsef(t, uint8(a) == uint8(0), "msg with args %d %s", 42, "42") + assert.False(t, uint8(0) == uint8(a)) + assert.Falsef(t, uint8(0) == uint8(a), "msg with args %d %s", 42, "42") + assert.False(t, uint8(a) != uint8(0)) + assert.Falsef(t, uint8(a) != uint8(0), "msg with args %d %s", 42, "42") + assert.False(t, uint8(0) != uint8(a)) + assert.Falsef(t, uint8(0) != uint8(a), "msg with args %d %s", 42, "42") + assert.False(t, uint16(a) > uint16(0)) + assert.Falsef(t, uint16(a) > uint16(0), "msg with args %d %s", 42, "42") + assert.False(t, uint16(0) > uint16(a)) + assert.Falsef(t, uint16(0) > uint16(a), "msg with args %d %s", 42, "42") + assert.False(t, uint16(a) < uint16(0)) + assert.Falsef(t, uint16(a) < uint16(0), "msg with args %d %s", 42, "42") + assert.False(t, uint16(0) < uint16(a)) + assert.Falsef(t, uint16(0) < uint16(a), "msg with args %d %s", 42, "42") + assert.False(t, uint16(a) == uint16(0)) + assert.Falsef(t, uint16(a) == uint16(0), "msg with args %d %s", 42, "42") + assert.False(t, uint16(0) == uint16(a)) + assert.Falsef(t, uint16(0) == uint16(a), "msg with args %d %s", 42, "42") + assert.False(t, uint16(a) != uint16(0)) + assert.Falsef(t, uint16(a) != uint16(0), "msg with args %d %s", 42, "42") + assert.False(t, uint16(0) != uint16(a)) + assert.Falsef(t, uint16(0) != uint16(a), "msg with args %d %s", 42, "42") + assert.False(t, uint32(a) > uint32(0)) + assert.Falsef(t, uint32(a) > uint32(0), "msg with args %d %s", 42, "42") + assert.False(t, uint32(0) > uint32(a)) + assert.Falsef(t, uint32(0) > uint32(a), "msg with args %d %s", 42, "42") + assert.False(t, uint32(a) < uint32(0)) + assert.Falsef(t, uint32(a) < uint32(0), "msg with args %d %s", 42, "42") + assert.False(t, uint32(0) < uint32(a)) + assert.Falsef(t, uint32(0) < uint32(a), "msg with args %d %s", 42, "42") + assert.False(t, uint32(a) == uint32(0)) + assert.Falsef(t, uint32(a) == uint32(0), "msg with args %d %s", 42, "42") + assert.False(t, uint32(0) == uint32(a)) + assert.Falsef(t, uint32(0) == uint32(a), "msg with args %d %s", 42, "42") + assert.False(t, uint32(a) != uint32(0)) + assert.Falsef(t, uint32(a) != uint32(0), "msg with args %d %s", 42, "42") + assert.False(t, uint32(0) != uint32(a)) + assert.Falsef(t, uint32(0) != uint32(a), "msg with args %d %s", 42, "42") + assert.False(t, uint64(a) > uint64(0)) + assert.Falsef(t, uint64(a) > uint64(0), "msg with args %d %s", 42, "42") + assert.False(t, uint64(0) > uint64(a)) + assert.Falsef(t, uint64(0) > uint64(a), "msg with args %d %s", 42, "42") + assert.False(t, uint64(a) < uint64(0)) + assert.Falsef(t, uint64(a) < uint64(0), "msg with args %d %s", 42, "42") + assert.False(t, uint64(0) < uint64(a)) + assert.Falsef(t, uint64(0) < uint64(a), "msg with args %d %s", 42, "42") + assert.False(t, uint64(a) == uint64(0)) + assert.Falsef(t, uint64(a) == uint64(0), "msg with args %d %s", 42, "42") + assert.False(t, uint64(0) == uint64(a)) + assert.Falsef(t, uint64(0) == uint64(a), "msg with args %d %s", 42, "42") + assert.False(t, uint64(a) != uint64(0)) + assert.Falsef(t, uint64(a) != uint64(0), "msg with args %d %s", 42, "42") + assert.False(t, uint64(0) != uint64(a)) + assert.Falsef(t, uint64(0) != uint64(a), "msg with args %d %s", 42, "42") + assert.False(t, CustomInt16(a) > CustomInt16(0)) + assert.Falsef(t, CustomInt16(a) > CustomInt16(0), "msg with args %d %s", 42, "42") + assert.False(t, CustomInt16(0) > CustomInt16(a)) + assert.Falsef(t, CustomInt16(0) > CustomInt16(a), "msg with args %d %s", 42, "42") + assert.False(t, CustomInt16(a) < CustomInt16(0)) + assert.Falsef(t, CustomInt16(a) < CustomInt16(0), "msg with args %d %s", 42, "42") + assert.False(t, CustomInt16(0) < CustomInt16(a)) + assert.Falsef(t, CustomInt16(0) < CustomInt16(a), "msg with args %d %s", 42, "42") + assert.False(t, CustomInt16(a) == CustomInt16(0)) + assert.Falsef(t, CustomInt16(a) == CustomInt16(0), "msg with args %d %s", 42, "42") + assert.False(t, CustomInt16(0) == CustomInt16(a)) + assert.Falsef(t, CustomInt16(0) == CustomInt16(a), "msg with args %d %s", 42, "42") + assert.False(t, CustomInt16(a) != CustomInt16(0)) + assert.Falsef(t, CustomInt16(a) != CustomInt16(0), "msg with args %d %s", 42, "42") + assert.False(t, CustomInt16(0) != CustomInt16(a)) + assert.Falsef(t, CustomInt16(0) != CustomInt16(a), "msg with args %d %s", 42, "42") + assert.Less(t, uint(a), uint(0)) + assert.Lessf(t, uint(a), uint(0), "msg with args %d %s", 42, "42") + assert.Greater(t, uint(0), uint(a)) + assert.Greaterf(t, uint(0), uint(a), "msg with args %d %s", 42, "42") + assert.True(t, uint(a) < uint(0)) + assert.Truef(t, uint(a) < uint(0), "msg with args %d %s", 42, "42") + assert.True(t, uint(0) > uint(a)) + assert.Truef(t, uint(0) > uint(a), "msg with args %d %s", 42, "42") + assert.False(t, uint(a) >= uint(0)) + assert.Falsef(t, uint(a) >= uint(0), "msg with args %d %s", 42, "42") + assert.False(t, uint(0) <= uint(a)) + assert.Falsef(t, uint(0) <= uint(a), "msg with args %d %s", 42, "42") + assert.Less(t, uint8(a), uint8(0)) + assert.Lessf(t, uint8(a), uint8(0), "msg with args %d %s", 42, "42") + assert.Greater(t, uint8(0), uint8(a)) + assert.Greaterf(t, uint8(0), uint8(a), "msg with args %d %s", 42, "42") + assert.True(t, uint8(a) < uint8(0)) + assert.Truef(t, uint8(a) < uint8(0), "msg with args %d %s", 42, "42") + assert.True(t, uint8(0) > uint8(a)) + assert.Truef(t, uint8(0) > uint8(a), "msg with args %d %s", 42, "42") + assert.False(t, uint8(a) >= uint8(0)) + assert.Falsef(t, uint8(a) >= uint8(0), "msg with args %d %s", 42, "42") + assert.False(t, uint8(0) <= uint8(a)) + assert.Falsef(t, uint8(0) <= uint8(a), "msg with args %d %s", 42, "42") + assert.Less(t, uint16(a), uint16(0)) + assert.Lessf(t, uint16(a), uint16(0), "msg with args %d %s", 42, "42") + assert.Greater(t, uint16(0), uint16(a)) + assert.Greaterf(t, uint16(0), uint16(a), "msg with args %d %s", 42, "42") + assert.True(t, uint16(a) < uint16(0)) + assert.Truef(t, uint16(a) < uint16(0), "msg with args %d %s", 42, "42") + assert.True(t, uint16(0) > uint16(a)) + assert.Truef(t, uint16(0) > uint16(a), "msg with args %d %s", 42, "42") + assert.False(t, uint16(a) >= uint16(0)) + assert.Falsef(t, uint16(a) >= uint16(0), "msg with args %d %s", 42, "42") + assert.False(t, uint16(0) <= uint16(a)) + assert.Falsef(t, uint16(0) <= uint16(a), "msg with args %d %s", 42, "42") + assert.Less(t, uint32(a), uint32(0)) + assert.Lessf(t, uint32(a), uint32(0), "msg with args %d %s", 42, "42") + assert.Greater(t, uint32(0), uint32(a)) + assert.Greaterf(t, uint32(0), uint32(a), "msg with args %d %s", 42, "42") + assert.True(t, uint32(a) < uint32(0)) + assert.Truef(t, uint32(a) < uint32(0), "msg with args %d %s", 42, "42") + assert.True(t, uint32(0) > uint32(a)) + assert.Truef(t, uint32(0) > uint32(a), "msg with args %d %s", 42, "42") + assert.False(t, uint32(a) >= uint32(0)) + assert.Falsef(t, uint32(a) >= uint32(0), "msg with args %d %s", 42, "42") + assert.False(t, uint32(0) <= uint32(a)) + assert.Falsef(t, uint32(0) <= uint32(a), "msg with args %d %s", 42, "42") + assert.Less(t, uint64(a), uint64(0)) + assert.Lessf(t, uint64(a), uint64(0), "msg with args %d %s", 42, "42") + assert.Greater(t, uint64(0), uint64(a)) + assert.Greaterf(t, uint64(0), uint64(a), "msg with args %d %s", 42, "42") + assert.True(t, uint64(a) < uint64(0)) + assert.Truef(t, uint64(a) < uint64(0), "msg with args %d %s", 42, "42") + assert.True(t, uint64(0) > uint64(a)) + assert.Truef(t, uint64(0) > uint64(a), "msg with args %d %s", 42, "42") + assert.False(t, uint64(a) >= uint64(0)) + assert.Falsef(t, uint64(a) >= uint64(0), "msg with args %d %s", 42, "42") + assert.False(t, uint64(0) <= uint64(a)) + assert.Falsef(t, uint64(0) <= uint64(a), "msg with args %d %s", 42, "42") + assert.Less(t, CustomInt16(a), CustomInt16(0)) + assert.Lessf(t, CustomInt16(a), CustomInt16(0), "msg with args %d %s", 42, "42") + assert.Greater(t, CustomInt16(0), CustomInt16(a)) + assert.Greaterf(t, CustomInt16(0), CustomInt16(a), "msg with args %d %s", 42, "42") + assert.True(t, CustomInt16(a) < CustomInt16(0)) + assert.Truef(t, CustomInt16(a) < CustomInt16(0), "msg with args %d %s", 42, "42") + assert.True(t, CustomInt16(0) > CustomInt16(a)) + assert.Truef(t, CustomInt16(0) > CustomInt16(a), "msg with args %d %s", 42, "42") + assert.False(t, CustomInt16(a) >= CustomInt16(0)) + assert.Falsef(t, CustomInt16(a) >= CustomInt16(0), "msg with args %d %s", 42, "42") + assert.False(t, CustomInt16(0) <= CustomInt16(a)) + assert.Falsef(t, CustomInt16(0) <= CustomInt16(a), "msg with args %d %s", 42, "42") assert.Equal(t, 0, 0) assert.Equalf(t, 0, 0, "msg with args %d %s", 42, "42") assert.Equal(t, a, a) @@ -289,5 +1077,44 @@ func TestNegativePositiveChecker(t *testing.T) { assert.Falsef(t, -1 == -1, "msg with args %d %s", 42, "42") assert.False(t, -1 != -1) assert.Falsef(t, -1 != -1, "msg with args %d %s", 42, "42") + assert.Negative(t, uint(a)) + assert.Negativef(t, uint(a), "msg with args %d %s", 42, "42") + assert.Less(t, uint(a), 0) + assert.Lessf(t, uint(a), 0, "msg with args %d %s", 42, "42") + assert.True(t, uint(a) < 0) + assert.Truef(t, uint(a) < 0, "msg with args %d %s", 42, "42") + assert.True(t, 0 > uint(a)) + assert.Truef(t, 0 > uint(a), "msg with args %d %s", 42, "42") + assert.False(t, uint(a) >= 0) + assert.Falsef(t, uint(a) >= 0, "msg with args %d %s", 42, "42") + assert.False(t, 0 <= uint(a)) + assert.Falsef(t, 0 <= uint(a), "msg with args %d %s", 42, "42") } } + +func TestNegativePositiveChecker_RealLifeUintExamples(t *testing.T) { + var e struct{ VideoMinutes uint64 } + var c struct{ stats struct{ Rto, Ato uint64 } } + var baseLineHeap, minGasExpected uint64 + var result struct{ GasUsed int } + var state struct{ LastUpdatedEpoch ChainEpoch } + var prod map[string]any + + assert.Positive(t, e.VideoMinutes) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, e.VideoMinutes, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, c.stats.Rto) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, c.stats.Rto, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, c.stats.Ato) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, c.stats.Ato, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, baseLineHeap) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, baseLineHeap, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, state.LastUpdatedEpoch) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, state.LastUpdatedEpoch, "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Positive(t, prod["last_claim_time"].(uint64)) // want "negative-positive: use assert\\.Positive" + assert.Positivef(t, prod["last_claim_time"].(uint64), "msg with args %d %s", 42, "42") // want "negative-positive: use assert\\.Positivef" + assert.Greater(t, uint64(result.GasUsed), minGasExpected) + assert.Greaterf(t, uint64(result.GasUsed), minGasExpected, "msg with args %d %s", 42, "42") +} + +type CustomInt16 int16 +type ChainEpoch int64 diff --git a/analyzer/testdata/src/debug/negative_positive_replacements_test.go b/analyzer/testdata/src/debug/negative_positive_replacements_test.go index 5fb8102c..cd9a48e3 100644 --- a/analyzer/testdata/src/debug/negative_positive_replacements_test.go +++ b/analyzer/testdata/src/debug/negative_positive_replacements_test.go @@ -10,7 +10,7 @@ import ( func TestNegativeReplacements(t *testing.T) { var tm tMock - negativeAssertions := []func(v int) bool{ + negativeAssertionsInt := []func(v int) bool{ func(v int) bool { return assert.Less(tm, v, 0) }, func(v int) bool { return assert.Greater(tm, 0, v) }, func(v int) bool { return assert.True(tm, v < 0) }, @@ -19,8 +19,8 @@ func TestNegativeReplacements(t *testing.T) { func(v int) bool { return assert.False(tm, 0 <= v) }, } - t.Run("assert.Negative", func(t *testing.T) { - for i, original := range negativeAssertions { + t.Run("int", func(t *testing.T) { + for i, original := range negativeAssertionsInt { for _, v := range []int{-1, 0, 1} { t.Run(fmt.Sprintf("%d_%d", i, v), func(t *testing.T) { replacement := assert.Negative(tm, v) @@ -29,12 +29,32 @@ func TestNegativeReplacements(t *testing.T) { } } }) + + negativeAssertionsUint := []func(v uint8) bool{ + func(v uint8) bool { return assert.Less(tm, v, uint8(0)) }, + func(v uint8) bool { return assert.Greater(tm, uint8(0), v) }, + func(v uint8) bool { return assert.True(tm, v < uint8(0)) }, + func(v uint8) bool { return assert.True(tm, uint8(0) > v) }, + func(v uint8) bool { return assert.False(tm, v >= uint8(0)) }, + func(v uint8) bool { return assert.False(tm, uint8(0) <= v) }, + } + + t.Run("uint", func(t *testing.T) { + for i, original := range negativeAssertionsUint { + for _, v := range []uint8{ /* -1, */ 0, 1} { // constant -1 overflows uint8 + t.Run(fmt.Sprintf("%d_%d", i, v), func(t *testing.T) { + replacement := assert.Negative(tm, v) + assert.Equal(t, original(v), replacement, "not an equivalent replacement") + }) + } + } + }) } func TestPositiveReplacements(t *testing.T) { var tm tMock - positiveAssertions := []func(v int) bool{ + positiveAssertionsInt := []func(v int) bool{ func(v int) bool { return assert.Greater(tm, v, 0) }, func(v int) bool { return assert.Less(tm, 0, v) }, func(v int) bool { return assert.True(tm, v > 0) }, @@ -43,8 +63,8 @@ func TestPositiveReplacements(t *testing.T) { func(v int) bool { return assert.False(tm, 0 >= v) }, } - t.Run("assert.Positive", func(t *testing.T) { - for i, original := range positiveAssertions { + t.Run("int", func(t *testing.T) { + for i, original := range positiveAssertionsInt { for _, v := range []int{-1, 0, 1} { t.Run(fmt.Sprintf("%d_%d", i, v), func(t *testing.T) { replacement := assert.Positive(tm, v) @@ -53,4 +73,24 @@ func TestPositiveReplacements(t *testing.T) { } } }) + + positiveAssertionsUint := []func(v uint8) bool{ + func(v uint8) bool { return assert.Greater(tm, v, uint8(0)) }, + func(v uint8) bool { return assert.Less(tm, uint8(0), v) }, + func(v uint8) bool { return assert.True(tm, v > uint8(0)) }, + func(v uint8) bool { return assert.True(tm, uint8(0) < v) }, + func(v uint8) bool { return assert.False(tm, v <= uint8(0)) }, + func(v uint8) bool { return assert.False(tm, uint8(0) >= v) }, + } + + t.Run("uint", func(t *testing.T) { + for i, original := range positiveAssertionsUint { + for _, v := range []uint8{ /* -1, */ 0, 1} { // constant -1 overflows uint8 + t.Run(fmt.Sprintf("%d_%d", i, v), func(t *testing.T) { + replacement := assert.Positive(tm, v) + assert.Equal(t, original(v), replacement, "not an equivalent replacement") + }) + } + } + }) } diff --git a/internal/checkers/helpers_basic_type.go b/internal/checkers/helpers_basic_type.go index 34dcb475..432a3032 100644 --- a/internal/checkers/helpers_basic_type.go +++ b/internal/checkers/helpers_basic_type.go @@ -11,10 +11,51 @@ import ( func isZero(e ast.Expr) bool { return isIntNumber(e, 0) } -func isNotZero(e ast.Expr) bool { return !isZero(e) } - func isOne(e ast.Expr) bool { return isIntNumber(e, 1) } +func isAnyZero(e ast.Expr) bool { + return isIntNumber(e, 0) || isTypedSignedIntNumber(e, 0) || isTypedUnsignedIntNumber(e, 0) +} + +func isNotAnyZero(e ast.Expr) bool { + return !isAnyZero(e) +} + +func isZeroOrSignedZero(e ast.Expr) bool { + return isIntNumber(e, 0) || isTypedSignedIntNumber(e, 0) +} + +func isSignedNotZero(pass *analysis.Pass, e ast.Expr) bool { + return !isUnsigned(pass, e) && !isZeroOrSignedZero(e) +} + +func isTypedSignedIntNumber(e ast.Expr, v int) bool { + return isTypedIntNumber(e, v, "int", "int8", "int16", "int32", "int64") +} + +func isTypedUnsignedIntNumber(e ast.Expr, v int) bool { + return isTypedIntNumber(e, v, "uint", "uint8", "uint16", "uint32", "uint64") +} + +func isTypedIntNumber(e ast.Expr, v int, types ...string) bool { + ce, ok := e.(*ast.CallExpr) + if !ok || len(ce.Args) != 1 { + return false + } + + fn, ok := ce.Fun.(*ast.Ident) + if !ok { + return false + } + + for _, t := range types { + if fn.Name == t { + return isIntNumber(ce.Args[0], v) + } + } + return false +} + func isIntNumber(e ast.Expr, v int) bool { bl, ok := e.(*ast.BasicLit) return ok && bl.Kind == token.INT && bl.Value == fmt.Sprintf("%d", v) @@ -30,32 +71,43 @@ func isIntBasicLit(e ast.Expr) bool { return ok && bl.Kind == token.INT } -func isUntypedConst(p *analysis.Pass, e ast.Expr) bool { - t := p.TypesInfo.TypeOf(e) - if t == nil { - return false - } - - b, ok := t.(*types.Basic) - return ok && b.Info()&types.IsUntyped > 0 +func isUntypedConst(pass *analysis.Pass, e ast.Expr) bool { + return isUnderlying(pass, e, types.IsUntyped) } -func isTypedConst(p *analysis.Pass, e ast.Expr) bool { - tt, ok := p.TypesInfo.Types[e] +func isTypedConst(pass *analysis.Pass, e ast.Expr) bool { + tt, ok := pass.TypesInfo.Types[e] return ok && tt.IsValue() && tt.Value != nil } -func isFloat(pass *analysis.Pass, expr ast.Expr) bool { - t := pass.TypesInfo.TypeOf(expr) +func isFloat(pass *analysis.Pass, e ast.Expr) bool { + return isUnderlying(pass, e, types.IsFloat) +} + +func isUnsigned(pass *analysis.Pass, e ast.Expr) bool { + return isUnderlying(pass, e, types.IsUnsigned) +} + +func isUnderlying(pass *analysis.Pass, e ast.Expr, flag types.BasicInfo) bool { + t := pass.TypesInfo.TypeOf(e) if t == nil { return false } bt, ok := t.Underlying().(*types.Basic) - return ok && (bt.Info()&types.IsFloat > 0) + return ok && (bt.Info()&flag > 0) } -func isPointer(pass *analysis.Pass, expr ast.Expr) bool { - _, ok := pass.TypesInfo.TypeOf(expr).(*types.Pointer) +func isPointer(pass *analysis.Pass, e ast.Expr) bool { + _, ok := pass.TypesInfo.TypeOf(e).(*types.Pointer) return ok } + +// untype returns v from type(v) expression or v itself if there is no type cast. +func untype(e ast.Expr) ast.Expr { + ce, ok := e.(*ast.CallExpr) + if !ok || len(ce.Args) != 1 { + return e + } + return ce.Args[0] +} diff --git a/internal/checkers/negative_postive.go b/internal/checkers/negative_postive.go index c3f7175c..274021f6 100644 --- a/internal/checkers/negative_postive.go +++ b/internal/checkers/negative_postive.go @@ -29,6 +29,8 @@ import ( // // assert.Negative(t, value) // assert.Positive(t, value) +// +// Typed zeros (like `int8(0)`, ..., `uint64(0)`) are also supported. type NegativePositive struct{} // NewNegativePositive constructs NegativePositive checker. @@ -54,6 +56,8 @@ func (checker NegativePositive) checkNegative(pass *analysis.Pass, call *CallMet ) } + // NOTE(a.telyshev): We ignore uint-asserts as being no sense for assert.Negative. + switch call.Fn.NameFTrimmed { case "Less": if len(call.Args) < 2 { @@ -61,8 +65,8 @@ func (checker NegativePositive) checkNegative(pass *analysis.Pass, call *CallMet } a, b := call.Args[0], call.Args[1] - if isNotZero(a) && isZero(b) { - return newUseNegativeDiagnostic(a.Pos(), b.End(), a) + if isSignedNotZero(pass, a) && isZeroOrSignedZero(b) { + return newUseNegativeDiagnostic(a.Pos(), b.End(), untype(a)) } case "Greater": @@ -71,8 +75,8 @@ func (checker NegativePositive) checkNegative(pass *analysis.Pass, call *CallMet } a, b := call.Args[0], call.Args[1] - if isZero(a) && isNotZero(b) { - return newUseNegativeDiagnostic(a.Pos(), b.End(), b) + if isZeroOrSignedZero(a) && isSignedNotZero(pass, b) { + return newUseNegativeDiagnostic(a.Pos(), b.End(), untype(b)) } case "True": @@ -81,12 +85,12 @@ func (checker NegativePositive) checkNegative(pass *analysis.Pass, call *CallMet } expr := call.Args[0] - a, _, ok1 := isStrictComparisonWith(pass, expr, p(isNotZero), token.LSS, p(isZero)) // a < 0 - _, b, ok2 := isStrictComparisonWith(pass, expr, p(isZero), token.GTR, p(isNotZero)) // 0 > a + a, _, ok1 := isStrictComparisonWith(pass, expr, isSignedNotZero, token.LSS, p(isZeroOrSignedZero)) // a < 0 + _, b, ok2 := isStrictComparisonWith(pass, expr, p(isZeroOrSignedZero), token.GTR, isSignedNotZero) // 0 > a survivingArg, ok := anyVal([]bool{ok1, ok2}, a, b) if ok { - return newUseNegativeDiagnostic(expr.Pos(), expr.End(), survivingArg) + return newUseNegativeDiagnostic(expr.Pos(), expr.End(), untype(survivingArg)) } case "False": @@ -95,12 +99,12 @@ func (checker NegativePositive) checkNegative(pass *analysis.Pass, call *CallMet } expr := call.Args[0] - a, _, ok1 := isStrictComparisonWith(pass, expr, p(isNotZero), token.GEQ, p(isZero)) // a >= 0 - _, b, ok2 := isStrictComparisonWith(pass, expr, p(isZero), token.LEQ, p(isNotZero)) // 0 <= a + a, _, ok1 := isStrictComparisonWith(pass, expr, isSignedNotZero, token.GEQ, p(isZeroOrSignedZero)) // a >= 0 + _, b, ok2 := isStrictComparisonWith(pass, expr, p(isZeroOrSignedZero), token.LEQ, isSignedNotZero) // 0 <= a survivingArg, ok := anyVal([]bool{ok1, ok2}, a, b) if ok { - return newUseNegativeDiagnostic(expr.Pos(), expr.End(), survivingArg) + return newUseNegativeDiagnostic(expr.Pos(), expr.End(), untype(survivingArg)) } } return nil @@ -125,8 +129,8 @@ func (checker NegativePositive) checkPositive(pass *analysis.Pass, call *CallMet } a, b := call.Args[0], call.Args[1] - if isNotZero(a) && isZero(b) { - return newUsePositiveDiagnostic(a.Pos(), b.End(), a) + if isNotAnyZero(a) && isAnyZero(b) { + return newUsePositiveDiagnostic(a.Pos(), b.End(), untype(a)) } case "Less": @@ -135,8 +139,8 @@ func (checker NegativePositive) checkPositive(pass *analysis.Pass, call *CallMet } a, b := call.Args[0], call.Args[1] - if isZero(a) && isNotZero(b) { - return newUsePositiveDiagnostic(a.Pos(), b.End(), b) + if isAnyZero(a) && isNotAnyZero(b) { + return newUsePositiveDiagnostic(a.Pos(), b.End(), untype(b)) } case "True": @@ -145,12 +149,12 @@ func (checker NegativePositive) checkPositive(pass *analysis.Pass, call *CallMet } expr := call.Args[0] - a, _, ok1 := isStrictComparisonWith(pass, expr, p(isNotZero), token.GTR, p(isZero)) // a > 0 - _, b, ok2 := isStrictComparisonWith(pass, expr, p(isZero), token.LSS, p(isNotZero)) // 0 < a + a, _, ok1 := isStrictComparisonWith(pass, expr, p(isNotAnyZero), token.GTR, p(isAnyZero)) // a > 0 + _, b, ok2 := isStrictComparisonWith(pass, expr, p(isAnyZero), token.LSS, p(isNotAnyZero)) // 0 < a survivingArg, ok := anyVal([]bool{ok1, ok2}, a, b) if ok { - return newUsePositiveDiagnostic(expr.Pos(), expr.End(), survivingArg) + return newUsePositiveDiagnostic(expr.Pos(), expr.End(), untype(survivingArg)) } case "False": @@ -159,12 +163,12 @@ func (checker NegativePositive) checkPositive(pass *analysis.Pass, call *CallMet } expr := call.Args[0] - a, _, ok1 := isStrictComparisonWith(pass, expr, p(isNotZero), token.LEQ, p(isZero)) // a <= 0 - _, b, ok2 := isStrictComparisonWith(pass, expr, p(isZero), token.GEQ, p(isNotZero)) // 0 >= a + a, _, ok1 := isStrictComparisonWith(pass, expr, p(isNotAnyZero), token.LEQ, p(isAnyZero)) // a <= 0 + _, b, ok2 := isStrictComparisonWith(pass, expr, p(isAnyZero), token.GEQ, p(isNotAnyZero)) // 0 >= a survivingArg, ok := anyVal([]bool{ok1, ok2}, a, b) if ok { - return newUsePositiveDiagnostic(expr.Pos(), expr.End(), survivingArg) + return newUsePositiveDiagnostic(expr.Pos(), expr.End(), untype(survivingArg)) } } return nil diff --git a/internal/testgen/gen_negative_positive.go b/internal/testgen/gen_negative_positive.go index 1de5cf63..2fd222f6 100644 --- a/internal/testgen/gen_negative_positive.go +++ b/internal/testgen/gen_negative_positive.go @@ -1,6 +1,7 @@ package main import ( + "fmt" "strings" "text/template" @@ -19,166 +20,231 @@ func (g NegativePositiveTestsGenerator) TemplateData() any { report = checker + ": use %s.%s" ) + var invalidAssertions []Assertion + + for _, zeroType := range []string{ + "", "int", "int8", "int16", "int32", "int64", + } { + v := fmt.Sprintf("%s(a)", zeroType) + zero := fmt.Sprintf("%s(0)", zeroType) + + if zeroType == "" { + v, zero = "a", "0" + } + + invalidAssertions = append(invalidAssertions, + Assertion{Fn: "Less", Argsf: "a, " + zero, ReportMsgf: report, ProposedFn: "Negative", ProposedArgsf: "a"}, + Assertion{Fn: "Greater", Argsf: zero + ", a", ReportMsgf: report, ProposedFn: "Negative", ProposedArgsf: "a"}, + Assertion{Fn: "True", Argsf: v + " < " + zero, ReportMsgf: report, ProposedFn: "Negative", ProposedArgsf: "a"}, + Assertion{Fn: "True", Argsf: zero + " > " + v, ReportMsgf: report, ProposedFn: "Negative", ProposedArgsf: "a"}, + Assertion{Fn: "False", Argsf: v + " >= " + zero, ReportMsgf: report, ProposedFn: "Negative", ProposedArgsf: "a"}, + Assertion{Fn: "False", Argsf: zero + " <= " + v, ReportMsgf: report, ProposedFn: "Negative", ProposedArgsf: "a"}, + ) + } + + for _, zeroType := range []string{ + "", "int", "int8", "int16", "int32", "int64", + "uint", "uint8", "uint16", "uint32", "uint64", + } { + v := fmt.Sprintf("%s(a)", zeroType) + zero := fmt.Sprintf("%s(0)", zeroType) + + if zeroType == "" { + v, zero = "a", "0" + } + + invalidAssertions = append(invalidAssertions, + Assertion{Fn: "Greater", Argsf: "a, " + zero, ReportMsgf: report, ProposedFn: "Positive", ProposedArgsf: "a"}, + Assertion{Fn: "Less", Argsf: zero + ", a", ReportMsgf: report, ProposedFn: "Positive", ProposedArgsf: "a"}, + Assertion{Fn: "True", Argsf: v + " > " + zero, ReportMsgf: report, ProposedFn: "Positive", ProposedArgsf: "a"}, + Assertion{Fn: "True", Argsf: zero + " < " + v, ReportMsgf: report, ProposedFn: "Positive", ProposedArgsf: "a"}, + Assertion{Fn: "False", Argsf: v + " <= " + zero, ReportMsgf: report, ProposedFn: "Positive", ProposedArgsf: "a"}, + Assertion{Fn: "False", Argsf: zero + " >= " + v, ReportMsgf: report, ProposedFn: "Positive", ProposedArgsf: "a"}, + ) + } + + var ignoredAssertions []Assertion + + for _, fn := range []string{"Equal", "NotEqual", "GreaterOrEqual", "LessOrEqual"} { + for _, arg := range []string{"-1", "0", "1"} { + ignoredAssertions = append(ignoredAssertions, + Assertion{Fn: fn, Argsf: arg + ", a"}, + Assertion{Fn: fn, Argsf: "a, " + arg}, + ) + } + + for _, zeroType := range []string{ + "int", "int8", "int16", "int32", "int64", + "uint", "uint8", "uint16", "uint32", "uint64", + "CustomInt16", + } { + v := fmt.Sprintf("%s(a)", zeroType) + zero := fmt.Sprintf("%s(0)", zeroType) + + ignoredAssertions = append(ignoredAssertions, + Assertion{Fn: fn, Argsf: zero + ", " + v}, + Assertion{Fn: fn, Argsf: v + ", " + zero}, + ) + } + } + + for _, fn := range []string{"Greater", "Less"} { + for _, arg := range []string{"-1", "CustomInt16(0)", "1"} { + ignoredAssertions = append(ignoredAssertions, + Assertion{Fn: fn, Argsf: arg + ", a"}, + Assertion{Fn: fn, Argsf: "a, " + arg}, + ) + } + } + + for _, fn := range []string{"True", "False"} { + for _, arg := range []string{"-1", "1"} { + for _, op := range []string{">", "<", ">=", "<=", "==", "!="} { + ignoredAssertions = append(ignoredAssertions, + Assertion{Fn: fn, Argsf: fmt.Sprintf("a %s %s", op, arg)}, + Assertion{Fn: fn, Argsf: fmt.Sprintf("%s %s a", arg, op)}, + ) + } + } + } + for _, zeroType := range []string{ + "", + "int", "int8", "int16", "int32", "int64", + "uint", "uint8", "uint16", "uint32", "uint64", + "CustomInt16", + } { + v := fmt.Sprintf("%s(a)", zeroType) + zero := fmt.Sprintf("%s(0)", zeroType) + + if zeroType == "" { + v, zero = "a", "0" + } + + for _, op := range []string{">=", "<=", "==", "!="} { + ignoredAssertions = append(ignoredAssertions, + Assertion{Fn: "True", Argsf: fmt.Sprintf("%s %s %s", v, op, zero)}, + Assertion{Fn: "True", Argsf: fmt.Sprintf("%s %s %s", zero, op, v)}, + ) + } + } + for _, zeroType := range []string{ + "", + "int", "int8", "int16", "int32", "int64", + "uint", "uint8", "uint16", "uint32", "uint64", + "CustomInt16", + } { + v := fmt.Sprintf("%s(a)", zeroType) + zero := fmt.Sprintf("%s(0)", zeroType) + + if zeroType == "" { + v, zero = "a", "0" + } + + for _, op := range []string{">", "<", "==", "!="} { + ignoredAssertions = append(ignoredAssertions, + Assertion{Fn: "False", Argsf: fmt.Sprintf("%s %s %s", v, op, zero)}, + Assertion{Fn: "False", Argsf: fmt.Sprintf("%s %s %s", zero, op, v)}, + ) + } + } + + // assert.Negative only cases. + for _, zeroType := range []string{ + "uint", "uint8", "uint16", "uint32", "uint64", + "CustomInt16", + } { + v := fmt.Sprintf("%s(a)", zeroType) + zero := fmt.Sprintf("%s(0)", zeroType) + + ignoredAssertions = append(ignoredAssertions, + Assertion{Fn: "Less", Argsf: v + ", " + zero}, + Assertion{Fn: "Greater", Argsf: zero + ", " + v}, + Assertion{Fn: "True", Argsf: v + " < " + zero}, + Assertion{Fn: "True", Argsf: zero + " > " + v}, + Assertion{Fn: "False", Argsf: v + " >= " + zero}, + Assertion{Fn: "False", Argsf: zero + " <= " + v}, + ) + } + + // These one will be reported by useless-assert. + ignoredAssertions = append(ignoredAssertions, + Assertion{Fn: "Equal", Argsf: "0, 0"}, + Assertion{Fn: "Equal", Argsf: "a, a"}, + Assertion{Fn: "NotEqual", Argsf: "0, 0"}, + Assertion{Fn: "NotEqual", Argsf: "a, a"}, + Assertion{Fn: "Greater", Argsf: "0, 0"}, + Assertion{Fn: "Greater", Argsf: "a, a"}, + Assertion{Fn: "GreaterOrEqual", Argsf: "0, 0"}, + Assertion{Fn: "GreaterOrEqual", Argsf: "a, a"}, + Assertion{Fn: "Less", Argsf: "0, 0"}, + Assertion{Fn: "Less", Argsf: "a, a"}, + Assertion{Fn: "LessOrEqual", Argsf: "0, 0"}, + Assertion{Fn: "LessOrEqual", Argsf: "a, a"}, + Assertion{Fn: "True", Argsf: "a > a"}, + Assertion{Fn: "True", Argsf: "a < a"}, + Assertion{Fn: "True", Argsf: "a >= a"}, + Assertion{Fn: "True", Argsf: "a <= a"}, + Assertion{Fn: "True", Argsf: "a == a"}, + Assertion{Fn: "True", Argsf: "a != a"}, + Assertion{Fn: "False", Argsf: "-1 > -1"}, + Assertion{Fn: "False", Argsf: "-1 < -1"}, + Assertion{Fn: "False", Argsf: "-1 >= -1"}, + Assertion{Fn: "False", Argsf: "-1 <= -1"}, + Assertion{Fn: "False", Argsf: "-1 == -1"}, + Assertion{Fn: "False", Argsf: "-1 != -1"}, + ) + + // These one will be reported by incorrect-assert. + ignoredAssertions = append(ignoredAssertions, + Assertion{Fn: "Negative", Argsf: "uint(a)"}, + Assertion{Fn: "Less", Argsf: "uint(a), 0"}, + Assertion{Fn: "True", Argsf: "uint(a) < 0"}, + Assertion{Fn: "True", Argsf: "0 > uint(a)"}, + Assertion{Fn: "False", Argsf: "uint(a) >= 0"}, + Assertion{Fn: "False", Argsf: "0 <= uint(a)"}, + ) + return struct { - CheckerName CheckerName - InvalidAssertions []Assertion - ValidAssertions []Assertion - IgnoredAssertions []Assertion + CheckerName CheckerName + InvalidAssertions []Assertion + ValidAssertions []Assertion + IgnoredAssertions []Assertion + RealLifeUintExamples []Assertion }{ - CheckerName: CheckerName(checker), - InvalidAssertions: []Assertion{ - {Fn: "Less", Argsf: "a, 0", ReportMsgf: report, ProposedFn: "Negative", ProposedArgsf: "a"}, - {Fn: "Greater", Argsf: "0, a", ReportMsgf: report, ProposedFn: "Negative", ProposedArgsf: "a"}, - {Fn: "True", Argsf: "a < 0", ReportMsgf: report, ProposedFn: "Negative", ProposedArgsf: "a"}, - {Fn: "True", Argsf: "0 > a", ReportMsgf: report, ProposedFn: "Negative", ProposedArgsf: "a"}, - {Fn: "False", Argsf: "a >= 0", ReportMsgf: report, ProposedFn: "Negative", ProposedArgsf: "a"}, - {Fn: "False", Argsf: "0 <= a", ReportMsgf: report, ProposedFn: "Negative", ProposedArgsf: "a"}, - - {Fn: "Greater", Argsf: "a, 0", ReportMsgf: report, ProposedFn: "Positive", ProposedArgsf: "a"}, - {Fn: "Less", Argsf: "0, a", ReportMsgf: report, ProposedFn: "Positive", ProposedArgsf: "a"}, - {Fn: "True", Argsf: "a > 0", ReportMsgf: report, ProposedFn: "Positive", ProposedArgsf: "a"}, - {Fn: "True", Argsf: "0 < a", ReportMsgf: report, ProposedFn: "Positive", ProposedArgsf: "a"}, - {Fn: "False", Argsf: "a <= 0", ReportMsgf: report, ProposedFn: "Positive", ProposedArgsf: "a"}, - {Fn: "False", Argsf: "0 >= a", ReportMsgf: report, ProposedFn: "Positive", ProposedArgsf: "a"}, - }, + CheckerName: CheckerName(checker), + InvalidAssertions: invalidAssertions, ValidAssertions: []Assertion{ {Fn: "Negative", Argsf: "a"}, {Fn: "Positive", Argsf: "a"}, }, - IgnoredAssertions: []Assertion{ - {Fn: "Equal", Argsf: "-1, a"}, - {Fn: "Equal", Argsf: "a, -1"}, - {Fn: "Equal", Argsf: "0, a"}, - {Fn: "Equal", Argsf: "a, 0"}, - {Fn: "Equal", Argsf: "1, a"}, - {Fn: "Equal", Argsf: "a, 1"}, - - {Fn: "NotEqual", Argsf: "-1, a"}, - {Fn: "NotEqual", Argsf: "a, -1"}, - {Fn: "NotEqual", Argsf: "0, a"}, - {Fn: "NotEqual", Argsf: "a, 0"}, - {Fn: "NotEqual", Argsf: "1, a"}, - {Fn: "NotEqual", Argsf: "a, 1"}, - - {Fn: "Greater", Argsf: "-1, a"}, - {Fn: "Greater", Argsf: "a, -1"}, - {Fn: "Greater", Argsf: "a, 1"}, - {Fn: "Greater", Argsf: "1, a"}, - - {Fn: "GreaterOrEqual", Argsf: "-1, a"}, - {Fn: "GreaterOrEqual", Argsf: "a, -1"}, - {Fn: "GreaterOrEqual", Argsf: "0, a"}, - {Fn: "GreaterOrEqual", Argsf: "a, 0"}, - {Fn: "GreaterOrEqual", Argsf: "1, a"}, - {Fn: "GreaterOrEqual", Argsf: "a, 1"}, - - {Fn: "Less", Argsf: "-1, a"}, - {Fn: "Less", Argsf: "a, -1"}, - {Fn: "Less", Argsf: "1, a"}, - {Fn: "Less", Argsf: "a, 1"}, - - {Fn: "LessOrEqual", Argsf: "-1, a"}, - {Fn: "LessOrEqual", Argsf: "a, -1"}, - {Fn: "LessOrEqual", Argsf: "0, a"}, - {Fn: "LessOrEqual", Argsf: "a, 0"}, - {Fn: "LessOrEqual", Argsf: "1, a"}, - {Fn: "LessOrEqual", Argsf: "a, 1"}, - - {Fn: "True", Argsf: "a > -1"}, - {Fn: "True", Argsf: "a < -1"}, - {Fn: "True", Argsf: "a >= -1"}, - {Fn: "True", Argsf: "a <= -1"}, - {Fn: "True", Argsf: "a == -1"}, - {Fn: "True", Argsf: "a != -1"}, - {Fn: "True", Argsf: "-1 > a"}, - {Fn: "True", Argsf: "-1 < a"}, - {Fn: "True", Argsf: "-1 >= a"}, - {Fn: "True", Argsf: "-1 <= a"}, - {Fn: "True", Argsf: "-1 == a"}, - {Fn: "True", Argsf: "-1 != a"}, - - {Fn: "True", Argsf: "a >= 0"}, - {Fn: "True", Argsf: "a <= 0"}, - {Fn: "True", Argsf: "a == 0"}, - {Fn: "True", Argsf: "a != 0"}, - {Fn: "True", Argsf: "0 >= a"}, - {Fn: "True", Argsf: "0 <= a"}, - {Fn: "True", Argsf: "0 == a"}, - {Fn: "True", Argsf: "0 != a"}, - - {Fn: "True", Argsf: "a > 1"}, - {Fn: "True", Argsf: "a < 1"}, - {Fn: "True", Argsf: "a >= 1"}, - {Fn: "True", Argsf: "a <= 1"}, - {Fn: "True", Argsf: "a == 1"}, - {Fn: "True", Argsf: "a != 1"}, - {Fn: "True", Argsf: "1 > a"}, - {Fn: "True", Argsf: "1 < a"}, - {Fn: "True", Argsf: "1 >= a"}, - {Fn: "True", Argsf: "1 <= a"}, - {Fn: "True", Argsf: "1 == a"}, - {Fn: "True", Argsf: "1 != a"}, - - {Fn: "False", Argsf: "a > -1"}, - {Fn: "False", Argsf: "a < -1"}, - {Fn: "False", Argsf: "a >= -1"}, - {Fn: "False", Argsf: "a <= -1"}, - {Fn: "False", Argsf: "a == -1"}, - {Fn: "False", Argsf: "a != -1"}, - {Fn: "False", Argsf: "-1 > a"}, - {Fn: "False", Argsf: "-1 < a"}, - {Fn: "False", Argsf: "-1 >= a"}, - {Fn: "False", Argsf: "-1 <= a"}, - {Fn: "False", Argsf: "-1 == a"}, - {Fn: "False", Argsf: "-1 != a"}, - - {Fn: "False", Argsf: "a > 0"}, - {Fn: "False", Argsf: "a < 0"}, - {Fn: "False", Argsf: "a == 0"}, - {Fn: "False", Argsf: "a != 0"}, - {Fn: "False", Argsf: "0 > a"}, - {Fn: "False", Argsf: "0 < a"}, - {Fn: "False", Argsf: "0 == a"}, - {Fn: "False", Argsf: "0 != a"}, - - {Fn: "False", Argsf: "a > 1"}, - {Fn: "False", Argsf: "a < 1"}, - {Fn: "False", Argsf: "a >= 1"}, - {Fn: "False", Argsf: "a <= 1"}, - {Fn: "False", Argsf: "a == 1"}, - {Fn: "False", Argsf: "a != 1"}, - {Fn: "False", Argsf: "1 > a"}, - {Fn: "False", Argsf: "1 < a"}, - {Fn: "False", Argsf: "1 >= a"}, - {Fn: "False", Argsf: "1 <= a"}, - {Fn: "False", Argsf: "1 == a"}, - {Fn: "False", Argsf: "1 != a"}, - - // These one will be reported by useless-assert. - {Fn: "Equal", Argsf: "0, 0"}, - {Fn: "Equal", Argsf: "a, a"}, - {Fn: "NotEqual", Argsf: "0, 0"}, - {Fn: "NotEqual", Argsf: "a, a"}, - {Fn: "Greater", Argsf: "0, 0"}, - {Fn: "Greater", Argsf: "a, a"}, - {Fn: "GreaterOrEqual", Argsf: "0, 0"}, - {Fn: "GreaterOrEqual", Argsf: "a, a"}, - {Fn: "Less", Argsf: "0, 0"}, - {Fn: "Less", Argsf: "a, a"}, - {Fn: "LessOrEqual", Argsf: "0, 0"}, - {Fn: "LessOrEqual", Argsf: "a, a"}, - {Fn: "True", Argsf: "a > a"}, - {Fn: "True", Argsf: "a < a"}, - {Fn: "True", Argsf: "a >= a"}, - {Fn: "True", Argsf: "a <= a"}, - {Fn: "True", Argsf: "a == a"}, - {Fn: "True", Argsf: "a != a"}, - {Fn: "False", Argsf: "-1 > -1"}, - {Fn: "False", Argsf: "-1 < -1"}, - {Fn: "False", Argsf: "-1 >= -1"}, - {Fn: "False", Argsf: "-1 <= -1"}, - {Fn: "False", Argsf: "-1 == -1"}, - {Fn: "False", Argsf: "-1 != -1"}, + IgnoredAssertions: ignoredAssertions, + RealLifeUintExamples: []Assertion{ + { + Fn: "Less", Argsf: "uint64(0), e.VideoMinutes", + ReportMsgf: report, ProposedFn: "Positive", ProposedArgsf: "e.VideoMinutes", + }, + { + Fn: "Less", Argsf: "uint32(0), c.stats.Rto", + ReportMsgf: report, ProposedFn: "Positive", ProposedArgsf: "c.stats.Rto", + }, + { + Fn: "Less", Argsf: "uint32(0), c.stats.Ato", + ReportMsgf: report, ProposedFn: "Positive", ProposedArgsf: "c.stats.Ato", + }, + { + Fn: "Less", Argsf: "uint64(0), baseLineHeap", + ReportMsgf: report, ProposedFn: "Positive", ProposedArgsf: "baseLineHeap", + }, + { + Fn: "Greater", Argsf: "uint64(state.LastUpdatedEpoch), uint64(0)", + ReportMsgf: report, ProposedFn: "Positive", ProposedArgsf: "state.LastUpdatedEpoch", + }, + { + Fn: "True", Argsf: `uint64(0) < prod["last_claim_time"].(uint64)`, + ReportMsgf: report, ProposedFn: "Positive", ProposedArgsf: `prod["last_claim_time"].(uint64)`, + }, + + {Fn: "Greater", Argsf: "uint64(result.GasUsed), minGasExpected"}, }, } } @@ -229,4 +295,20 @@ func {{ .CheckerName.AsTestName }}(t *testing.T) { {{- end }} } } + +func {{ .CheckerName.AsTestName }}_RealLifeUintExamples(t *testing.T) { + var e struct{ VideoMinutes uint64 } + var c struct{ stats struct{ Rto, Ato uint64 } } + var baseLineHeap, minGasExpected uint64 + var result struct{ GasUsed int } + var state struct{ LastUpdatedEpoch ChainEpoch } + var prod map[string]any + + {{ range $ai, $assrn := $.RealLifeUintExamples }} + {{ NewAssertionExpander.Expand $assrn "assert" "t" nil }} + {{- end }} +} + +type CustomInt16 int16 +type ChainEpoch int64 `