1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-07 18:57:18 -05:00
OpenDiablo2/tests/MPQ_test.go

33 lines
738 B
Go
Raw Normal View History

package tests
import (
"path"
"strings"
"testing"
"github.com/OpenDiablo2/OpenDiablo2/mpq"
"github.com/OpenDiablo2/OpenDiablo2/common"
)
func TestMPQScanPerformance(t *testing.T) {
mpq.InitializeCryptoBuffer()
common.ConfigBasePath = "../"
config := common.LoadConfiguration()
for _, fileName := range config.MpqLoadOrder {
mpqFile := path.Join(config.MpqPath, fileName)
archive, _ := mpq.Load(mpqFile)
files, err := archive.GetFileList()
if err != nil {
continue
}
for _, archiveFile := range files {
// Temporary until all audio formats are supported
if strings.Contains(archiveFile, ".wav") || strings.Contains(archiveFile, ".pif") {
continue
}
_, _ = archive.ReadFile(archiveFile)
}
}
}