added some SNMP app-specific types and cleaned up some BER-encoding problems

with integers.
This commit is contained in:
blackhedd 2006-12-17 19:04:41 +00:00
parent e550dc80ab
commit eac464bcb9
4 changed files with 92 additions and 23 deletions

View file

@ -18,9 +18,9 @@ class TestBer < Test::Unit::TestCase
# 5000000000 is a Bignum, which hits different code.
def test_ber_integers
assert_equal( "\002\001\005", 5.to_ber )
assert_equal( "\002\002\203t", 500.to_ber )
assert_equal( "\002\003\203\206P", 50000.to_ber )
assert_equal( "\002\005\222\320\227\344\000", 5000000000.to_ber )
assert_equal( "\002\002\001\364", 500.to_ber )
assert_equal( "\002\003\0\303P", 50000.to_ber )
assert_equal( "\002\005\001*\005\362\000", 5000000000.to_ber )
end
def test_ber_bignums

View file

@ -113,6 +113,15 @@ class TestSnmp < Test::Unit::TestCase
# Not specifying variables doesn't create an error. (Maybe it should?)
end
def test_snmp_integers
c32 = Net::SNMP::Counter32.new(100)
assert_equal( "A\001d", c32.to_ber )
g32 = Net::SNMP::Gauge32.new(100)
assert_equal( "B\001d", g32.to_ber )
t32 = Net::SNMP::TimerTicks32.new(100)
assert_equal( "C\001d", t32.to_ber )
end
end