Files
bluray/bluray_test.go

63 lines
1.2 KiB
Go

package bluray
import (
"encoding/json"
"fmt"
"testing"
)
func TestGetBDVersion(t *testing.T) {
version := GetBDVersion()
if version == "" {
t.Errorf("Expected non-empty version string, got empty string")
}
fmt.Printf("libbluray version: %s\n", version)
}
func TestBD(t *testing.T) {
db, err := BDOpen("path")
if err != nil {
t.Errorf("Expected non-nil DBStruct, got nil")
return
}
info, err := db.GetDiscInfo()
if err != nil {
t.Errorf("Expected non-nil BlurayDiscInfo, got nil")
return
}
res, err := json.Marshal(info)
if err != nil {
t.Errorf("json.Marshal failed: %v", err)
return
}
fmt.Println(string(res))
num, err := db.GetTitles(TitlesAll, 0)
if err != nil {
t.Errorf("Expected non-nil BlurayTitle, got nil")
return
}
fmt.Printf("titles: %v\n", num)
mainTitle, err := db.GetMainTitle()
if err != nil {
t.Errorf("Expected non-nil BlurayTitle, got nil")
return
}
fmt.Printf("main title: %v\n", mainTitle)
tInfo, err := db.GetTitleInfo(mainTitle, 0)
if err != nil {
t.Errorf("Expected non-nil BlurayTitle, got nil")
return
}
res, err = json.Marshal(tInfo)
if err != nil {
t.Errorf("json.Marshal failed: %v", err)
return
}
fmt.Println(string(res))
}