Created
January 15, 2015 07:57
-
-
Save spedepekka/4bce774f34d8448d4cf2 to your computer and use it in GitHub Desktop.
run_loop 1.2.1 version compare problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
============ Test =============== | |
require 'run_loop' | |
def compare(a, b) | |
a = RunLoop::Version.new(a) | |
b = RunLoop::Version.new(b) | |
if a < b | |
puts "#{a} < #{b}" | |
elsif a > b | |
puts "#{a} > #{b}" | |
else | |
puts "#{a} == #{b}" | |
end | |
end | |
compare("0.12.0", "0.12.0.pre1") | |
compare("0.12.0", "0.12.0.pre") | |
compare("0.1", "0.2") | |
compare("0.1.1", "0.2") | |
compare("0.2", "0.21") | |
compare("0.2", "0.2.1") | |
compare("0.2.1", "0.2.1") | |
compare("0.2.1.a", "0.2.1") | |
compare("0.2.1.a", "0.2.1.b") | |
compare("0.2.1.c1", "0.2.1.c2") | |
============ Output =============== | |
0.12.0 < 0.12.0.pre1 | |
0.12.0 < 0.12.0.pre | |
0.1 < 0.2 | |
0.1.1 < 0.2 | |
0.2 < 0.21 | |
0.2 < 0.2.1 | |
0.2.1 == 0.2.1 | |
0.2.1.a > 0.2.1 | |
0.2.1.a == 0.2.1.b | |
0.2.1.c1 < 0.2.1.c2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment