-
Notifications
You must be signed in to change notification settings - Fork 159
Update and simplify GCD and associated tests. #320
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?
Conversation
Changed GCD.swift to GreatestCommonDivisor.swift. Chagned GCDTests.swift to GreatestCommonDivisorTests.swift
Updated gcd to return Magnitude. Updated tests to SwiftTesting.
I'm still debating |
Totally get that. I do worry that it will add program crashes that can be avoided if people (especially those new to the language) don't think about using |
btw, my first pass was purely additive which may be the solution that we want. (Note that this isn't that version, just a quick code writeup to show the idea.) |
Incorporating @xwu's thoughts, I think that we should rework this into |
Here's the update with |
This PR does the following:
Simplifies GCD to gcd(T, T) -> T.Magnitude, which has the following benefits.
Updates the test cases to use SwiftTesting. It also removes one test case that was 2's complement specific.
Renames the source code files to more descriptive names similar to the rest of the repo.