Unbewohnte
3 years ago
9 changed files with 122 additions and 27 deletions
@ -0,0 +1,34 @@
|
||||
package id3ed |
||||
|
||||
import ( |
||||
"os" |
||||
"testing" |
||||
) |
||||
|
||||
func TestGetHeader(t *testing.T) { |
||||
f, err := os.Open("./testData/testreadv2.mp3") |
||||
if err != nil { |
||||
t.Errorf("%s", err) |
||||
} |
||||
|
||||
header, err := GetHeader(f) |
||||
if err != nil { |
||||
t.Errorf("GetHeader failed: %s", err) |
||||
} |
||||
|
||||
if header.Identifier != "ID3" { |
||||
t.Errorf("GetHeader failed: expected identifier %s; got %s", "ID3", header.Identifier) |
||||
} |
||||
|
||||
if header.Compressed != false { |
||||
t.Errorf("GetHeader failed: expected flag %v; got %v", false, header.Compressed) |
||||
} |
||||
|
||||
if header.Unsynchronisated != false { |
||||
t.Errorf("GetHeader failed: expected flag %v; got %v", false, header.Unsynchronisated) |
||||
} |
||||
|
||||
if header.Size != 1138 { |
||||
t.Errorf("GetHeader failed: expected size %v; got %v", 1138, header.Size) |
||||
} |
||||
} |
@ -1,15 +0,0 @@
|
||||
package id3ed |
||||
|
||||
import ( |
||||
"io" |
||||
"os" |
||||
) |
||||
|
||||
// I`m still a bit confused about interfaces,
|
||||
// I`ll look into them and try to figure out
|
||||
// how to use them properly
|
||||
type Metadata interface { |
||||
Read(io.ReadSeeker) error |
||||
Write(io.WriteSeeker) error |
||||
WriteToFile(*os.File) error |
||||
} |
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue