func exceptedError1(t *testing.T, v snmpclient2.Variable) {
	defer func() {
		if o := recover(); nil == o {
			t.Errorf("Failed to call BigInt()")
		}
	}()
	v.Int()
}
func TestIpaddress(t *testing.T) {
	expStr := "192.168.1.1"
	expInt := int64(3232235777)
	expBuf := []byte{0x40, 0x04, 0xc0, 0xa8, 0x01, 0x01}
	var v snmpclient2.Variable = snmpclient2.NewIpaddress(0xc0, 0xa8, 0x01, 0x01)

	if expInt != v.Int() {
		t.Errorf("BigInt() - expected [%d], actual [%d]", expInt, v.Int())
	}

	if expStr != v.ToString() {
		t.Errorf("ToString() - expected [%s], actual[%s]", expStr, v.ToString())
	}

	buf, err := v.Marshal()
	if err != nil {
		t.Errorf("Marshal(): %v", err)
	}
	if !bytes.Equal(expBuf, buf) {
		t.Errorf("Marshal() - expected [%s], actual [%s]",
			snmpclient2.ToHexStr(expBuf, " "), snmpclient2.ToHexStr(buf, " "))
	}

	var w snmpclient2.Ipaddress
	rest, err := (&w).Unmarshal(buf)
	if len(rest) != 0 || err != nil {
		t.Errorf("Unmarshal() - len[%d] err[%v]", len(rest), err)
	}
	if expStr != w.ToString() {
		t.Errorf("Unmarshal() - expected [%s], actual [%s]", expStr, w.ToString())
	}

	buf = append(buf, 0x00)
	rest, err = (&w).Unmarshal(buf)
	if len(rest) != 1 || err != nil {
		t.Errorf("Unmarshal() with rest - len[%d] err[%v]", len(rest), err)
	}
	if expStr != w.ToString() {
		t.Errorf("Unmarshal() with rest - expected [%s], actual [%s]", expStr, w.ToString())
	}
}
func TestTimeTicks(t *testing.T) {
	expInt := int64(4294967295)
	expStr := "4294967295"
	expBuf := []byte{0x43, 0x05, 0x00, 0xff, 0xff, 0xff, 0xff}
	var v snmpclient2.Variable = snmpclient2.NewTimeTicks(uint32(expInt))

	if expInt != v.Int() {
		t.Errorf("BigInt() - expected [%d], actual [%d]", expInt, v.Int())
	}

	if expStr != v.ToString() {
		t.Errorf("ToString() - expected [%s], actual [%s]", expStr, v.ToString())
	}

	buf, err := v.Marshal()
	if err != nil {
		t.Errorf("Marshal(): %v", err)
	}
	if !bytes.Equal(expBuf, buf) {
		t.Errorf("Marshal() - expected [%s], actual [%s]",
			snmpclient2.ToHexStr(expBuf, " "), snmpclient2.ToHexStr(buf, " "))
	}

	var w snmpclient2.TimeTicks
	rest, err := (&w).Unmarshal(buf)
	if len(rest) != 0 || err != nil {
		t.Errorf("Unmarshal() - len[%d] err[%v]", len(rest), err)
	}
	if expStr != w.ToString() {
		t.Errorf("Unmarshal() - expected [%s], actual [%s]", expStr, w.ToString())
	}

	buf = append(buf, 0x00)
	rest, err = (&w).Unmarshal(buf)
	if len(rest) != 1 || err != nil {
		t.Errorf("Unmarshal() with rest - len[%d] err[%v]", len(rest), err)
	}
	if expStr != w.ToString() {
		t.Errorf("Unmarshal() with rest - expected [%s], actual [%s]", expStr, w.ToString())
	}
}
func TestInteger(t *testing.T) {
	expInt := int64(2147483647)
	expStr := "2147483647"
	expBuf := []byte{0x02, 0x04, 0x7f, 0xff, 0xff, 0xff}
	var v snmpclient2.Variable = snmpclient2.NewInteger(int32(expInt))

	if expInt != v.Int() {
		t.Errorf("BigInt() - expected [%d], actual [%d]", expInt, v.Int())
	}

	if expStr != v.ToString() {
		t.Errorf("ToString() - expected [%s], actual [%s]", expStr, v.ToString())
	}

	buf, err := v.Marshal()
	if err != nil {
		t.Errorf("Marshal(): %v", err)
	}
	if !bytes.Equal(expBuf, buf) {
		t.Errorf("Marshal() - expected [%s], actual [%s]",
			snmpclient2.ToHexStr(expBuf, " "), snmpclient2.ToHexStr(buf, " "))
	}

	var w snmpclient2.Integer
	rest, err := (&w).Unmarshal(buf)
	if len(rest) != 0 || err != nil {
		t.Errorf("Unmarshal() - len[%d] err[%v]", len(rest), err)
	}
	if expStr != w.ToString() {
		t.Errorf("Unmarshal() - expected [%s], actual [%s]", expStr, w.ToString())
	}

	buf = append(buf, 0x00)
	rest, err = (&w).Unmarshal(buf)
	if len(rest) != 1 || err != nil {
		t.Errorf("Unmarshal() with rest - len[%d] err[%v]", len(rest), err)
	}
	if expStr != w.ToString() {
		t.Errorf("Unmarshal() with rest - expected [%s], actual [%s]", expStr, w.ToString())
	}
}