Apply .gitignore rules

This commit is contained in:
皮蛋13361098506
2025-01-06 16:21:36 +08:00
parent 1b77f62820
commit ccd2c530cf
580 changed files with 69806 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
package stringUtil
import (
"testing"
)
func Test1(t *testing.T) {
s := HashCode("abc")
s1 := HashCode("abc")
if s != s1 {
t.Errorf("s1 hashcode:%v,s2 hashcode:%v,2个code值不相等", s, s1)
}
}
func Test2(t *testing.T) {
s := HashCode("abc")
s1 := HashCode("bcd")
if s == s1 {
t.Errorf("s1 hashcode:%v,s2 hashcode:%v,2个code值相等", s, s1)
}
}

View File

@@ -0,0 +1,60 @@
package stringUtil
import (
"testing"
)
func TestGetNewGUID(t *testing.T) {
guidMap := make(map[string]bool, 1024)
count := 10
for i := 0; i < count; i++ {
guid := GetNewGUID()
guidMap[guid] = true
}
if len(guidMap) != count {
t.Errorf("there should be %d 条不重复的数据,但是现在只有%d条", count, len(guidMap))
}
}
func TestGetEmptyGUID(t *testing.T) {
guid := GetEmptyGUID()
expected := "00000000-0000-0000-0000-000000000000"
if guid != expected {
t.Errorf("guid should be %s, but now is %s", expected, guid)
}
}
// test IsGUIDEmpty
func TestIsGUIDEmpty(t *testing.T) {
isOk := IsGUIDEmpty("")
if isOk == false {
t.Error("test is Not pass:")
return
}
isOk = IsGUIDEmpty("00000000-0000-0000-0000-000000000000")
if isOk == false {
t.Error("test is Not pass:00000000-0000-0000-0000-000000000000")
return
}
isOk = IsGUIDEmpty("00000000-0000-0000-0000-000000000001")
if isOk == true {
t.Error("test is Not pass:00000000-0000-0000-0000-000000000001")
return
}
}
func TestGetNewUUID(t *testing.T) {
guidMap := make(map[string]bool, 1024)
count := 10
for i := 0; i < count; i++ {
guid := GetNewUUID()
guidMap[guid] = true
}
if len(guidMap) != count {
t.Errorf("there should be %d 条不重复的数据,但是现在只有%d条", count, len(guidMap))
}
}

View File

@@ -0,0 +1,28 @@
package qcloud
// 公有字段
type commonField struct {
// 签名
Sig string `json:"sig"`
// Unix时间戳
Time int64 `json:"time"`
// 通道扩展码,可选字段,默认没有开通(需要填空)。
Extend string `json:"extend"`
// 用户的session内容腾讯server回包中会原样返回
Ext string `json:"ext"`
// 接收方
// 单发短信时填mobile
// 群发时填[]mobile
Tel interface{} `json:"tel"`
}
func newCommonField(sig string, time int64, extend string, ext string, tel interface{}) *commonField {
return &commonField{
Sig: sig,
Time: time,
Extend: extend,
Ext: ext,
Tel: tel,
}
}