-
Notifications
You must be signed in to change notification settings - Fork 2
feature: Adds a unitless percent unit
#15
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
base: main
Are you sure you want to change the base?
feature: Adds a unitless percent unit
#15
Conversation
|
Looks good to me! |
NeedleInAJayStack
left a comment
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.
Thanks Jairon! Glad to see it #justworks
| ) | ||
| } | ||
|
|
||
| func testPercent() throws { |
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.
Please add an additional test in the DefinitionsTests.swift and copy the formatting there.
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.
I don't see that file?
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.
Whoops - my bad. I meant DefinitionTests.swift:
https://github.com/NeedleInAJayStack/Units/blob/main/Tests/UnitsTests/DefinitionTests.swift
de8256c to
21f7aa4
Compare
21f7aa4 to
858247b
Compare
| try { | ||
| let percent1 = 5.measured(in: .percent) | ||
| let value2 = 5.measured(in: .none) | ||
| XCTAssertThrowsError(try percent1 + value2) |
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.
Ah, looks like this test is failing in CI because this no longer throws an error. I've added cross-unit addition/subtraction support since this MR was opened, so this will succeed and result in 505%.
Adds support for a
percentunit type.Some review will be needed to make sure I've tested everything worth testing in this regard.
So far, everything seems to 'just work'.