summaryrefslogtreecommitdiff
path: root/swig/ruby/tests
diff options
context:
space:
mode:
authorbiao716.wang <biao716.wang@samsung.com>2020-03-06 02:26:13 +0900
committerbiao716.wang <biao716.wang@samsung.com>2020-03-06 22:06:03 +0900
commitf2f1a310c855e9a9d19b1e3d1e7737784dc6ce7b (patch)
tree4d1ddd6f943fc35fc80999064d440c8c87674bcb /swig/ruby/tests
parent23ca0cab871cc21b827c6d7caaedd4fcbde06224 (diff)
downloadlibzypp-bindings-f2f1a310c855e9a9d19b1e3d1e7737784dc6ce7b.tar.gz
libzypp-bindings-f2f1a310c855e9a9d19b1e3d1e7737784dc6ce7b.tar.bz2
libzypp-bindings-f2f1a310c855e9a9d19b1e3d1e7737784dc6ce7b.zip
Change-Id: I9f33b96eeef6ba2a2fb0d1a4784cb88f90c8de67 Signed-off-by: biao716.wang <biao716.wang@samsung.com>
Diffstat (limited to 'swig/ruby/tests')
-rw-r--r--swig/ruby/tests/arch.rb31
-rw-r--r--swig/ruby/tests/bytecount.rb9
-rw-r--r--swig/ruby/tests/target.rb15
3 files changed, 26 insertions, 29 deletions
diff --git a/swig/ruby/tests/arch.rb b/swig/ruby/tests/arch.rb
index 3e2f508..eafca1b 100644
--- a/swig/ruby/tests/arch.rb
+++ b/swig/ruby/tests/arch.rb
@@ -12,44 +12,43 @@ class Zypp::Arch
end
class ArchTest < Test::Unit::TestCase
- include Zypp
def test_arch
# define i386, a builtin
- a = Arch.new("i386")
+ a = Zypp::Arch.new("i386")
assert a
assert_equal "i386", a.to_s
assert_equal true, a.is_builtin
# i486 is 'bigger' than i386
- b = Arch.new("i486")
+ b = Zypp::Arch.new("i486")
assert b
assert_equal "i486", b.to_s
assert b.is_builtin
- if VERSION > 800
+ if Zypp::VERSION > 800
assert_equal a, b.base_arch
end
assert a < b
assert a.compatible_with?(b)
# A new, adventurous architecture
- z = Arch.new("xyzzy")
+ z = Zypp::Arch.new("xyzzy")
assert z
assert_equal "xyzzy", z.to_s
assert_equal false, z.is_builtin
# predefined archs
- assert_equal Arch.new("noarch"), Arch.noarch
- assert_equal a, Arch.i386
- assert_equal b, Arch.i486
- assert_equal Arch.new("i586"), Arch.i586
- assert_equal Arch.new("i686"), Arch.i686
- assert_equal Arch.new("x86_64"), Arch.x86_64
- assert_equal Arch.new("ia64"), Arch.ia64
- assert_equal Arch.new("ppc"), Arch.ppc
- assert_equal Arch.new("ppc64"), Arch.ppc64
- assert_equal Arch.new("s390"), Arch.s390
- assert_equal Arch.new("s390x"), Arch.s390x
+ assert_equal Zypp::Arch.new("noarch"), Zypp::Arch.noarch
+ assert_equal a, Zypp::Arch.i386
+ assert_equal b, Zypp::Arch.i486
+ assert_equal Zypp::Arch.new("i586"), Zypp::Arch.i586
+ assert_equal Zypp::Arch.new("i686"), Zypp::Arch.i686
+ assert_equal Zypp::Arch.new("x86_64"), Zypp::Arch.x86_64
+ assert_equal Zypp::Arch.new("ia64"), Zypp::Arch.ia64
+ assert_equal Zypp::Arch.new("ppc"), Zypp::Arch.ppc
+ assert_equal Zypp::Arch.new("ppc64"), Zypp::Arch.ppc64
+ assert_equal Zypp::Arch.new("s390"), Zypp::Arch.s390
+ assert_equal Zypp::Arch.new("s390x"), Zypp::Arch.s390x
end
end
diff --git a/swig/ruby/tests/bytecount.rb b/swig/ruby/tests/bytecount.rb
index 5b46e14..bda6f0a 100644
--- a/swig/ruby/tests/bytecount.rb
+++ b/swig/ruby/tests/bytecount.rb
@@ -10,16 +10,15 @@ require 'test/unit'
class LoadTest < Test::Unit::TestCase
require 'zypp'
- include Zypp
def test_bytecount
- g = ByteCount.new(ByteCount.G)
+ g = Zypp::ByteCount.new(Zypp::ByteCount.G)
assert g
- gb = ByteCount.new(ByteCount.GB)
+ gb = Zypp::ByteCount.new(Zypp::ByteCount.GB)
assert gb
- k = ByteCount.new(ByteCount.K)
+ k = Zypp::ByteCount.new(Zypp::ByteCount.K)
assert k.to_i == 1024
- mb = ByteCount.new(ByteCount.MB)
+ mb = Zypp::ByteCount.new(Zypp::ByteCount.MB)
assert mb.to_i == 1000*1000
end
end
diff --git a/swig/ruby/tests/target.rb b/swig/ruby/tests/target.rb
index 7594c79..1b8e45b 100644
--- a/swig/ruby/tests/target.rb
+++ b/swig/ruby/tests/target.rb
@@ -7,12 +7,11 @@ $:.unshift "../../../build/swig/ruby"
# test loading of extension
require 'test/unit'
+require 'zypp'
class LoadTest < Test::Unit::TestCase
- require 'zypp'
- include Zypp
def test_target
- z = ZYppFactory::instance.getZYpp
+ z = Zypp::ZYppFactory::instance.getZYpp
assert z.homePath
assert z.tmpPath
@@ -35,17 +34,17 @@ class LoadTest < Test::Unit::TestCase
break if i > 10
# PoolItems have status and a resolvable
r = pi.resolvable
- assert pi.is_a? PoolItem
+ assert pi.is_a? Zypp::PoolItem
end
#try iterate with kind
i = 0
- p.each_by_kind(ResKind.package) do |pi|
+ p.each_by_kind(Zypp::ResKind.package) do |pi|
i = i + 1
break if i > 10
- assert pi.is_a? PoolItem
+ assert pi.is_a? Zypp::PoolItem
r = pi.resolvable
- assert isKindPackage(pi)
+ assert Zypp::isKindPackage(pi)
end
i = 0
@@ -53,7 +52,7 @@ class LoadTest < Test::Unit::TestCase
p.each_by_name("libzypp") do |pi|
i = i + 1
break if i > 10
- assert pi.is_a? PoolItem
+ assert pi.is_a? Zypp::PoolItem
r = pi.resolvable
# broken in current SWIG assert_equal "libzypp",r.name
#try to download it