• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

yitsushi / macpot / 5047895837

pending completion
5047895837

push

github

GitHub
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3

180 of 192 relevant lines covered (93.75%)

10.7 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/with_oui.go
1
package macpot
2

3
import (
4
        "fmt"
5
        "strconv"
6
        "strings"
7
)
8

9
// WithOUI is an Option for New() that sets the generated MAC address with fixed
10
// OUI.
11
func WithOUI(oui string) Option {
9✔
12
        parts := strings.Split(oui, ":")
9✔
13

9✔
14
        return func(mac *MAC) error {
18✔
15
                if len(parts) != ouiByteLength {
11✔
16
                        return OUIError{Message: fmt.Sprintf("invalid OUI: %s", oui)}
2✔
17
                }
2✔
18

19
                for idx := 0; idx < ouiByteLength; idx++ {
27✔
20
                        value, err := strconv.ParseInt(parts[idx], base16, ipIntSize)
20✔
21
                        if err != nil {
21✔
22
                                return OUIError{Message: err.Error()}
1✔
23
                        }
1✔
24

25
                        if err := mac.SetOctet(idx, byte(value)); err != nil {
19✔
26
                                return err
×
27
                        }
×
28
                }
29

30
                return nil
6✔
31
        }
32
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc