Class: Mu::Xtractr::Field::Test::Value::Test

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/mu/xtractr/test/tc_field.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



96
97
98
# File 'lib/mu/xtractr/test/tc_field.rb', line 96

def value
  @value
end

#xtractrObject (readonly)

Returns the value of attribute xtractr.



95
96
97
# File 'lib/mu/xtractr/test/tc_field.rb', line 95

def xtractr
  @xtractr
end

Instance Method Details

#setupObject



98
99
100
101
# File 'lib/mu/xtractr/test/tc_field.rb', line 98

def setup
    @xtractr = Xtractr.new
    @value = xtractr.field('dns.qry.name').values.first
end

#test_countObject



118
119
120
121
122
123
# File 'lib/mu/xtractr/test/tc_field.rb', line 118

def test_count
    value.count('pkt.src').each do |c|
        assert_kind_of(Views::Count, c)
        assert_equal('pkt.src', c.field.name)
    end
end

#test_each_packetObject



113
114
115
116
# File 'lib/mu/xtractr/test/tc_field.rb', line 113

def test_each_packet
    v = value.each_packet { |pkt| assert_kind_of(Packet, pkt) }
    assert_equal(value, v)
end

#test_inspectObject



132
133
134
# File 'lib/mu/xtractr/test/tc_field.rb', line 132

def test_inspect
    assert_nothing_raised { value.inspect }
end

#test_packetsObject



107
108
109
110
111
# File 'lib/mu/xtractr/test/tc_field.rb', line 107

def test_packets
    packets = value.packets
    assert_kind_of(Packets, packets)
    assert_equal('dns.qry.name:"ax.search.itunes.apple.com"', packets.q)
end

#test_qObject



103
104
105
# File 'lib/mu/xtractr/test/tc_field.rb', line 103

def test_q
    assert_equal('dns.qry.name:"ax.search.itunes.apple.com"', value.q)
end

#test_sumObject



125
126
127
128
129
130
# File 'lib/mu/xtractr/test/tc_field.rb', line 125

def test_sum
    value.sum('pkt.src', 'pkt.length').each do |s|
        assert_kind_of(Views::Sum, s)
        assert_equal('pkt.src', s.field.name)
    end
end