Skip to content
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

Fix the bug in version comparison and add unit tests. #105

Merged
merged 2 commits into from
Aug 5, 2023
Merged

Fix the bug in version comparison and add unit tests. #105

merged 2 commits into from
Aug 5, 2023

Conversation

CrazyFanFan
Copy link
Contributor

Due to the absence of the == comparison, both func < and func > have bugs that can result in situations where Version("1.2.3-alpha") > Version("1.2.4") and Version("1.2.4") > Version("1.2.3-alpha") both return true.

@codecov
Copy link

codecov bot commented Aug 5, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (b467f8b) 100.00% compared to head (2f8b9dd) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #105   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines          224       231    +7     
=========================================
+ Hits           224       231    +7     
Files Changed Coverage Δ
Sources/SemVer/Version.swift 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ffried
Copy link
Member

ffried commented Aug 5, 2023

@CrazyFanFan Wow, very good catch, thank you!

I've fixed the build on Swift 5.6, merged the test method into the main test class (and got rid of the optionals), and simplified the comparison a bit.
Great work, though! Very glad about the extended tests now (using operators).

@ffried ffried merged commit dc8f59c into sersoft-gmbh:main Aug 5, 2023
16 checks passed
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.

None yet

2 participants