-
Notifications
You must be signed in to change notification settings - Fork 627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Box tests #926
Box tests #926
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errr clicked approve accidentally. as you were
_max.Y = value.Y; | ||
} | ||
|
||
_max = value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? that changes the meaning?
If I have a Box e.g. Box2(0,0,5,5)
and set min to (0,10)
Box2 will be (0,10,5,10), therefore it having Height of zero.
I would expect it to be similar to the rubberband rectangle in e.g. paint. If you drag the minimal value over to the other side, it will automatically set the max value automatically...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work @frederikja163 . Nicely written tests and great coverage.
|
||
[<Property>] | ||
let ``The distance should never be negative`` (b1 : Box3, v1 : Vector3) = | ||
Assert.True(b1.DistanceToNearestEdge(v1) >= (float32)0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, but it's preferable to use a float literal here. 0.0f
[<Properties(Arbitrary = [|typeof<OpenTKGen>|])>] | ||
module Equality = | ||
[<Property>] | ||
let ``Any box should be equal to itself`` (b1 : Box3) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whenever we test equality, always a good idea to test hashcode too.
|
||
b.Size <- v1 | ||
|
||
Assert.Equal(b1.Size/(float32)2, b1.HalfSize) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using literals is preferable to converting. 2 -> 2.0f
@@ -370,7 +288,7 @@ public override int GetHashCode() | |||
/// <inheritdoc/> | |||
public override string ToString() | |||
{ | |||
return $"({Min.X}{ListSeparator} {Min.Y}) - ({Max.X}{ListSeparator} {Max.Y})"; | |||
return $"({Min.X}{ListSeparator} {Min.Y}{ListSeparator} {Min.Z}) - ({Max.X}{ListSeparator} {Max.Y}{ListSeparator} {Max.Z})"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not necessary to use an explicit ListSeparator
.
Purpose of this PR
Comments