Skip to content

Commit

Permalink
fix get model (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ns2Kracy authored Jul 2, 2024
1 parent 2698533 commit 9c1f2b7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bios/bios_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,22 @@ func GetModel() string {
if err != nil {
return ""
}
if string(content) == "ZimaCube" {

if strings.Contains(strings.ToLower(string(content)), "zimacube") {
return ZIMACUBE
}
if string(content) == "ZimaCubePro" {
if strings.Contains(strings.ToLower(string(content)), "zimacubepro") {
return ZIMACUBEPRO
}
return ""

return ""
}
}

func GetSerialNumber() string {
src := "/sys/class/dmi/id/board_version"
_, err := os.Stat(src)
//ccc
// ccc
if os.IsNotExist(err) {
return ""
} else {
Expand Down
22 changes: 22 additions & 0 deletions bios/bios_info_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package bios

import "testing"

func TestGetModel(t *testing.T) {
t.Run("ZimaCube", func(t *testing.T) {
// ccc
model := GetModel()
t.Log("Model:", model)
if model != ZIMACUBE {
t.Errorf("Expected %s, got %s", ZIMACUBE, model)
}
})
t.Run("ZimaCubePro", func(t *testing.T) {
// ccc
model := GetModel()
t.Log("Model:", model)
if model != ZIMACUBEPRO {
t.Errorf("Expected %s, got %s", ZIMACUBEPRO, model)
}
})
}

0 comments on commit 9c1f2b7

Please sign in to comment.