1
0
mirror of https://github.com/mgechev/revive.git synced 2024-11-24 08:32:22 +02:00
revive/testdata/constant-logical-expr.go
subham sarkar 54d9a09ab5
Incorrect handling of token.{LEQ,GEQ} for constant-logical-expr (#642)
* fix: incorrect handling of token.{LEQ,GEQ} for constant-logical-expr lint

Signed-off-by: subham sarkar <sarkar.subhams2@gmail.com>

* tiny modification in comments

Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
2022-02-27 09:37:51 +01:00

29 lines
1.2 KiB
Go

package fixtures
import "fmt"
// from github.com/ugorji/go/codec/helper.go
func isNaN(f float64) bool { return f != f } // MATCH /expression always evaluates to false/
func skip(f float64) bool { return f != g }
func foo1(f float64) bool { return foo2(2.) > foo2(2.) } // MATCH /expression always evaluates to false/
func foo2(f float64) bool { return f < f } // MATCH /expression always evaluates to false/
func foo3(f float64) bool { return f <= f } // MATCH /expression always evaluates to true/
func foo4(f float64) bool { return f >= f } // MATCH /expression always evaluates to true/
func foo5(f float64) bool { return f == f } // MATCH /expression always evaluates to true/
func foo6(f float64) bool { return fmt.Sprintf("%s", buf1.Bytes()) == fmt.Sprintf("%s", buf1.Bytes()) } // MATCH /expression always evaluates to true/
func foo7(f float64) bool {
return fFoo(fBar(isNaN(10.), bpar), 10000) || fFoo(fBar(isNaN(10.), bpar), 10000) // MATCH /left and right hand-side sub-expressions are the same/
}
func foo8(f float64) bool {
return fFoo(fBar(isNaN(10.), bpar), 10000) && fFoo(fBar(isNaN(10.), bpar), 10000) // MATCH /left and right hand-side sub-expressions are the same/
}