# _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # # for lib/mega/version.rb # # Extracted Fri Oct 28 14:20:18 EDT 2005 # Unit Tools Reap Test Extractor # require 'mega/version.rb' require 'test/unit' class TC_Version < Test::Unit::TestCase def setup @version0 = Version["1.2"] @version1 = Version["1.2.3"] @version2 = Version[1,2,4] @version3 = Version["10.3.5"] end def test_major assert_equal( 1, @version1.major ) assert_equal( 1, @version2.major ) assert_equal( 10, @version3.major ) end def test_minor assert_equal( 2, @version1.minor ) assert_equal( 2, @version2.minor ) assert_equal( 3, @version3.minor ) end def test_teeny assert_equal( 3, @version1.teeny ) assert_equal( 4, @version2.teeny ) assert_equal( 5, @version3.teeny ) end def test_major_eq @version1.major = 2 assert_equal( 2, @version1.major ) @version2.major = 3 assert_equal( 3, @version2.major ) @version3.major = 9 assert_equal( 9, @version3.major ) end def test_minor_eq @version1.minor = 5 assert_equal( 5, @version1.minor ) @version2.minor = 5 assert_equal( 5, @version2.minor ) @version3.minor = 5 assert_equal( 5, @version3.minor ) end def test_teeny_eq @version1.teeny = 6 assert_equal( 6, @version1.teeny ) @version2.teeny = 6 assert_equal( 6, @version2.teeny ) @version3.teeny = 6 assert_equal( 6, @version3.teeny ) end def test_compare assert( @version1 < @version2 ) assert( @version2 < @version3 ) assert( @version3 > @version1 ) assert( @version3 > @version2 ) end def test_equal assert_equal( Version["1.2.3"], @version1 ) end def test_next! @version1.next_teeny! assert_equal( Version[1,2,4], @version1 ) @version1.next_minor! assert_equal( Version[1,3,0], @version1 ) @version1.next_major! assert_equal( Version[2,0,0], @version1 ) end def test_to_a assert_equal( [1,2,3], @version1.to_a ) assert_equal( [1,2,4], @version2.to_a ) end def test_to_s assert_equal( "1.2.3", @version1.to_s ) assert_equal( "1.2.4", @version2.to_s ) end end