1
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
func TestOrderViewStatus(t *testing.T) {
|
||||
@@ -228,54 +227,16 @@ func TestOrderDelivering(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// 88 67 【组合菜】尖椒茄子(茄子500g 青尖椒200g)700g/组(茄子500g 青椒200g)
|
||||
// 90 60
|
||||
func TestLen(t *testing.T) {
|
||||
aa := "【组合菜】尖椒茄子(茄子500g 青尖椒200g)700g/组(茄子500g 青椒200g)"
|
||||
var count int // 中文
|
||||
var punctZh int // 中文标点
|
||||
var punctEn int // 英文标点
|
||||
var punctAZ int // 字母
|
||||
var punctNum int // 字母
|
||||
var spance int // 空格
|
||||
for _, v := range aa {
|
||||
if unicode.Is(unicode.Han, v) { // 中文
|
||||
count++
|
||||
continue
|
||||
}
|
||||
if unicode.IsPunct(v) { // 字符
|
||||
if v >= 1000 {
|
||||
fmt.Println(v)
|
||||
punctZh++
|
||||
} else {
|
||||
punctEn++
|
||||
}
|
||||
continue
|
||||
}
|
||||
if unicode.IsLetter(v) {
|
||||
punctAZ++
|
||||
continue
|
||||
}
|
||||
if unicode.IsNumber(v) {
|
||||
punctNum++
|
||||
continue
|
||||
}
|
||||
if unicode.IsSpace(v) {
|
||||
spance++
|
||||
continue
|
||||
}
|
||||
func TestApplyCompensation(t *testing.T) {
|
||||
param := &ApplyCompensationRes{
|
||||
OrderId: 3500902110034359123,
|
||||
Reason: "申请退款",
|
||||
ApplyStatus: 110,
|
||||
Amount: 35.31,
|
||||
//FoodData: nil,
|
||||
}
|
||||
err := api.ApplyCompensation(param)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
fmt.Println("count:= ", count)
|
||||
fmt.Println("count:= ", punctZh)
|
||||
fmt.Println("count:= ", punctEn)
|
||||
fmt.Println("count:= ", punctAZ)
|
||||
fmt.Println("count:= ", punctNum)
|
||||
|
||||
fmt.Println("all = ", (count*2)+(punctZh*2)+punctEn+punctAZ+punctNum+spance)
|
||||
}
|
||||
|
||||
func TestName(t *testing.T) {
|
||||
data := map[int]int{101: 1, 102: 1, 103: 1}
|
||||
|
||||
fmt.Println(data[1] == 1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user