Skip to content

Conversation

@CrownedPhoenix
Copy link

Adds support for a percent unit 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'.

@bjschoenfeld
Copy link

Looks good to me!

Copy link
Owner

@NeedleInAJayStack NeedleInAJayStack left a 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 {
Copy link
Owner

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.

Copy link
Author

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?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CrownedPhoenix CrownedPhoenix force-pushed the feature/percent-unit branch from 21f7aa4 to 858247b Compare June 2, 2025 19:57
try {
let percent1 = 5.measured(in: .percent)
let value2 = 5.measured(in: .none)
XCTAssertThrowsError(try percent1 + value2)
Copy link
Owner

@NeedleInAJayStack NeedleInAJayStack Jun 3, 2025

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%.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants