393 Star 2.7K Fork 654

GVPJohn/gf

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
gipv4_z_unit_mac_test.go 866 Bytes
一键复制 编辑 原始数据 按行查看 历史
oldme 提交于 2024-12-17 21:17 +08:00 . test(net/gipv4): add unit tests (#4052)
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package gipv4_test
import (
"testing"
"github.com/gogf/gf/v2/net/gipv4"
"github.com/gogf/gf/v2/test/gtest"
)
func TestGetMac(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
mac, err := gipv4.GetMac()
t.AssertNil(err)
t.AssertNE(mac, "")
// MAC addresses are typically 17 characters in length
t.Assert(len(mac), 17)
})
}
func TestGetMacArray(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
macs, err := gipv4.GetMacArray()
t.AssertNil(err)
t.AssertGT(len(macs), 0)
for _, mac := range macs {
// MAC addresses are typically 17 characters in length
t.Assert(len(mac), 17)
}
})
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/johng/gf.git
git@gitee.com:johng/gf.git
johng
gf
gf
master

搜索帮助