@@ -865,6 +865,32 @@ func Error(err error, a ...any) {
865
865
}
866
866
}
867
867
868
+ // Greater asserts that the value is greater than want. If it is not it panics
869
+ // and builds a violation message. Thanks to inlining, the performance penalty
870
+ // is equal to a single 'if-statement' that is almost nothing.
871
+ //
872
+ // Note that when [Plain] asserter is used ([SetDefault]), optional arguments
873
+ // are used to override the auto-generated assert violation message.
874
+ func Greater [T Number ](val , want T , a ... any ) {
875
+ if val <= want {
876
+ defMsg := fmt .Sprintf (assertionMsg + ": got '%v', want <= '%v'" , val , want )
877
+ current ().reportAssertionFault (defMsg , a )
878
+ }
879
+ }
880
+
881
+ // Less asserts that the value is less than want. If it is not it panics and
882
+ // builds a violation message. Thanks to inlining, the performance penalty is
883
+ // equal to a single 'if-statement' that is almost nothing.
884
+ //
885
+ // Note that when [Plain] asserter is used ([SetDefault]), optional arguments
886
+ // are used to override the auto-generated assert violation message.
887
+ func Less [T Number ](val , want T , a ... any ) {
888
+ if val >= want {
889
+ defMsg := fmt .Sprintf (assertionMsg + ": got '%v', want >= '%v'" , val , want )
890
+ current ().reportAssertionFault (defMsg , a )
891
+ }
892
+ }
893
+
868
894
// Zero asserts that the value is 0. If it is not it panics and builds a
869
895
// violation message. Thanks to inlining, the performance penalty is equal to a
870
896
// single 'if-statement' that is almost nothing.
0 commit comments