File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ struct Rectangle {
12
12
impl Rectangle {
13
13
// Only change the test functions themselves
14
14
pub fn new ( width : i32 , height : i32 ) -> Self {
15
- if width < 0 || height < 0 {
15
+ if width <= 0 || height <= 0 {
16
16
panic ! ( "Rectangle width and height cannot be negative!" )
17
17
}
18
18
Rectangle { width, height}
@@ -33,13 +33,13 @@ mod tests {
33
33
34
34
#[ test]
35
35
fn negative_width ( ) {
36
- // This test should check if thread panics when we try to create rectangle with negative width
36
+ // This test should check if program panics when we try to create rectangle with negative width
37
37
let _rect = Rectangle :: new ( -10 , 10 ) ;
38
38
}
39
39
40
40
#[ test]
41
41
fn negative_height ( ) {
42
- // This test should check if thread panics when we try to create rectangle with negative height
42
+ // This test should check if program panics when we try to create rectangle with negative height
43
43
let _rect = Rectangle :: new ( 10 , -10 ) ;
44
44
}
45
45
}
You can’t perform that action at this time.
0 commit comments