Bump to libzypp-bindings 0.7.4
[platform/upstream/libzypp-bindings.git] / swig / ruby / tests / arch.rb
1 #
2 # Arch
3 #
4
5 $:.unshift File.expand_path(File.join(File.dirname(__FILE__),"..","..","..","build","swig","ruby"))
6
7 require 'test/unit'
8 require 'zypp'
9
10 class Zypp::Arch
11   include Comparable
12 end
13
14 class ArchTest < Test::Unit::TestCase
15   def test_arch
16     # define i386, a builtin
17     
18     a = Zypp::Arch.new("i386")
19     assert a
20     assert_equal "i386", a.to_s
21     assert_equal true, a.is_builtin
22     
23     # i486 is 'bigger' than i386
24     
25     b = Zypp::Arch.new("i486")
26     assert b
27     assert_equal "i486", b.to_s
28     assert b.is_builtin
29     if Zypp::VERSION > 800
30       assert_equal a, b.base_arch
31     end
32     assert a < b
33     assert a.compatible_with?(b)
34
35     # A new, adventurous architecture
36     z = Zypp::Arch.new("xyzzy")
37     assert z
38     assert_equal "xyzzy", z.to_s
39     assert_equal false, z.is_builtin
40     
41     # predefined archs
42     assert_equal Zypp::Arch.new("noarch"), Zypp::Arch.noarch 
43     assert_equal a, Zypp::Arch.i386
44     assert_equal b, Zypp::Arch.i486
45     assert_equal Zypp::Arch.new("i586"), Zypp::Arch.i586
46     assert_equal Zypp::Arch.new("i686"), Zypp::Arch.i686
47     assert_equal Zypp::Arch.new("x86_64"), Zypp::Arch.x86_64
48     assert_equal Zypp::Arch.new("ia64"), Zypp::Arch.ia64
49     assert_equal Zypp::Arch.new("ppc"), Zypp::Arch.ppc
50     assert_equal Zypp::Arch.new("ppc64"), Zypp::Arch.ppc64
51     assert_equal Zypp::Arch.new("s390"), Zypp::Arch.s390
52     assert_equal Zypp::Arch.new("s390x"), Zypp::Arch.s390x
53   end
54 end