trema 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 7a766e638ef31efd626005c5459901d9e0e5c7df
4
- data.tar.gz: 5f136d6cacc764e8b55ed06727b08e100bca3baf
5
- SHA512:
6
- metadata.gz: c905422655133ca3a741a6d71f45561b94c7997466f9a5fa066b1db7b063ea307b25c0aed00620f071f14fad772c84d8771e0c3dcc987d5f94954b1ac62198e9
7
- data.tar.gz: 337f159d2325e2115003391322e1986c79a58ca13f8046ec1620607fa78c7baf550380a884e886f1d99ea6944e43b7d76f494ad37a38b425149512acf3665167
@@ -1,100 +0,0 @@
1
- #
2
- # Copyright (C) 2008-2013 NEC Corporation
3
- #
4
- # This program is free software; you can redistribute it and/or modify
5
- # it under the terms of the GNU General Public License, version 2, as
6
- # published by the Free Software Foundation.
7
- #
8
- # This program is distributed in the hope that it will be useful,
9
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- # GNU General Public License for more details.
12
- #
13
- # You should have received a copy of the GNU General Public License along
14
- # with this program; if not, write to the Free Software Foundation, Inc.,
15
- # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
- #
17
-
18
-
19
- require File.join( File.dirname( __FILE__ ), "..", "spec_helper" )
20
- require "trema/mac"
21
-
22
-
23
- module Trema
24
- describe Mac, ".new(invalid_value)" do
25
- subject { Mac.new( value ) }
26
-
27
- context %{when "INVALID MAC ADDRESS"} do
28
- let( :value ) { "INVALID MAC ADDRESS" }
29
- it { expect { subject }.to raise_error( ArgumentError ) }
30
- end
31
-
32
- context "when -1" do
33
- let( :value ) { -1 }
34
- it { expect { subject }.to raise_error( ArgumentError ) }
35
- end
36
-
37
- context "when 0x1000000000000" do
38
- let( :value ) { 0x1000000000000 }
39
- it { expect { subject }.to raise_error( ArgumentError ) }
40
- end
41
-
42
- context "when [ 1, 2, 3 ]" do
43
- let( :value ) { [ 1, 2, 3 ] }
44
- it { expect { subject }.to raise_error( TypeError ) }
45
- end
46
- end
47
-
48
-
49
- describe Mac, ".new(value)" do
50
- subject { Mac.new( value ) }
51
-
52
- context %{when "11:22:33:44:55:66"} do
53
- let( :value ) { "11:22:33:44:55:66" }
54
- it { should == Mac.new( "11:22:33:44:55:66" ) }
55
- its( :value ) { should == 0x112233445566 }
56
- its( :to_s ) { should == "11:22:33:44:55:66" }
57
- its( :to_a ) { should == [ 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 ] }
58
- its( :multicast? ){ should be_true }
59
- its( :broadcast? ){ should be_false }
60
- end
61
-
62
- context "when 0" do
63
- let( :value ) { 0 }
64
- it { should == Mac.new( 0 ) }
65
- its( :value ) { should == 0 }
66
- its( :to_s ) { should == "00:00:00:00:00:00" }
67
- its( :to_a ) { should == [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ] }
68
- its( :multicast? ){ should be_false }
69
- its( :broadcast? ){ should be_false }
70
- end
71
-
72
- context "when 0xffffffffffff" do
73
- let( :value ) { 0xffffffffffff }
74
- it { should == Mac.new( 0xffffffffffff ) }
75
- its( :value ) { should == 0xffffffffffff }
76
- its( :to_s ) { should == "ff:ff:ff:ff:ff:ff" }
77
- its( :to_a ) { should == [ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff ] }
78
- its( :multicast? ){ should be_true }
79
- its( :broadcast? ){ should be_true }
80
- end
81
- end
82
-
83
-
84
- describe Mac do
85
- context "when querying FDB" do
86
- it "can be used for Hash keys" do
87
- fdb = {}
88
- fdb[ Mac.new( "00:00:00:00:00:01" ) ] = "Port #1"
89
- expect( fdb[ Mac.new( "00:00:00:00:00:01" ) ] ).to eq( "Port #1" )
90
- end
91
- end
92
- end
93
- end
94
-
95
-
96
- ### Local variables:
97
- ### mode: Ruby
98
- ### coding: utf-8-unix
99
- ### indent-tabs-mode: nil
100
- ### End: