2023-09-04 18:00:09 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2023-09-13 14:43:05 +08:00
|
|
|
"goweb/database"
|
2023-09-04 18:00:09 +08:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2023-09-13 14:43:05 +08:00
|
|
|
// func TestAdd(t *testing.T) {
|
|
|
|
// if database.CreateTable() != 0 {
|
|
|
|
// t.Errorf("数据库同步失败")
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
2023-09-04 18:00:09 +08:00
|
|
|
|
2023-09-13 14:43:05 +08:00
|
|
|
func TestAdd_Delwol(t *testing.T) {
|
|
|
|
wol := new(database.Wol)
|
|
|
|
wol.Mac = "8F:26:58:C1:85:83"
|
|
|
|
wol.Name = "text"
|
|
|
|
database.Insert(wol)
|
|
|
|
wolarray := make([]database.Wol, 0)
|
|
|
|
database.Getallwol(&wolarray)
|
|
|
|
|
|
|
|
for _, item := range wolarray {
|
|
|
|
if item.Name == wol.Name {
|
|
|
|
database.Del(item.ID)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
t.Errorf("并没有找到")
|
2023-09-04 18:00:09 +08:00
|
|
|
}
|