Skip to content

Commit a1c452d

Browse files
committed
Improve core::cmp coverage
1 parent eec6bd9 commit a1c452d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

library/coretests/tests/cmp.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ fn test_user_defined_eq() {
118118
assert!(SketchyNum { num: 25 } != SketchyNum { num: 57 });
119119
}
120120

121+
#[test]
122+
fn test_clamp() {
123+
assert_eq!((-3).clamp(-2, 1), -2);
124+
assert_eq!(0.clamp(-2, 1), 0);
125+
assert_eq!(2.clamp(-2, 1), 1);
126+
}
127+
121128
#[test]
122129
fn ordering_const() {
123130
// test that the methods of `Ordering` are usable in a const context

0 commit comments

Comments
 (0)