Skip to content

Commit

Permalink
Merge pull request #69 from wmnsk/test-uint8-ie
Browse files Browse the repository at this point in the history
Add tests for methods that return uint8 values
  • Loading branch information
wmnsk authored Oct 28, 2020
2 parents 61e261a + f23d846 commit a872333
Show file tree
Hide file tree
Showing 8 changed files with 854 additions and 19 deletions.
4 changes: 2 additions & 2 deletions ie/atsss-ll-control-information.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ func (i *IE) ATSSSLLControlInformation() (uint8, error) {
switch i.Type {
case ATSSSLLControlInformation:
return i.Payload[0], nil
case ATSSSControlParameters:
ies, err := i.ATSSSControlParameters()
case ProvideATSSSControlInformation:
ies, err := i.ProvideATSSSControlInformation()
if err != nil {
return 0, err
}
Expand Down
11 changes: 0 additions & 11 deletions ie/bar-id.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,6 @@ func (i *IE) BARID() (uint8, error) {
}
}
return 0, ErrIENotFound
case QueryURR:
ies, err := i.QueryURR()
if err != nil {
return 0, err
}
for _, x := range ies {
if x.Type == BARID {
return x.BARID()
}
}
return 0, ErrIENotFound
case CreateBAR:
ies, err := i.CreateBAR()
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions ie/dropped-dl-traffic-threshold.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
)

// NewDroppedDLTrafficThreshold creates a new DroppedDLTrafficThreshold IE.
//
// TODO: structurize
func NewDroppedDLTrafficThreshold(dlpa, dlby bool, packets, bytes uint64) *IE {
if dlpa {
if dlby { // has both
Expand Down Expand Up @@ -38,6 +40,8 @@ func NewDroppedDLTrafficThreshold(dlpa, dlby bool, packets, bytes uint64) *IE {
}

// DroppedDLTrafficThreshold returns DroppedDLTrafficThreshold in uint8 if the type of IE matches.
//
// TODO: implement!
func (i *IE) DroppedDLTrafficThreshold() (uint8, error) {
if len(i.Payload) < 1 {
return 0, io.ErrUnexpectedEOF
Expand Down
2 changes: 1 addition & 1 deletion ie/ethernet-filter-properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func (i *IE) EthernetFilterProperties() (uint8, error) {
return 0, err
}
for _, x := range ies {
if x.Type == EthernetPacketFilter {
if x.Type == EthernetFilterProperties {
return x.EthernetFilterProperties()
}
}
Expand Down
Loading

0 comments on commit a872333

Please sign in to comment.