48 lines
844 B
Go
48 lines
844 B
Go
|
package guess
|
||
|
|
||
|
import (
|
||
|
"git.gammaspectra.live/S.O.N.G/Kirika/test"
|
||
|
"os"
|
||
|
"path"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func DoTest(ext string, t *testing.T) {
|
||
|
for _, location := range test.TestSampleLocations {
|
||
|
entries, err := os.ReadDir(location)
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
return
|
||
|
}
|
||
|
for _, f := range entries {
|
||
|
if path.Ext(f.Name()) == ext {
|
||
|
fullPath := path.Join(location, f.Name())
|
||
|
t.Run(f.Name(), func(t *testing.T) {
|
||
|
t.Parallel()
|
||
|
fp, err := os.Open(fullPath)
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
return
|
||
|
}
|
||
|
defer fp.Close()
|
||
|
decoders, err := GetDecoders(fp, fullPath)
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
return
|
||
|
}
|
||
|
source, err := Open(fp, decoders)
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
//Decode
|
||
|
for range source.Blocks {
|
||
|
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|