Skip to content

Commit f53ff75

Browse files
authored
Merge pull request #1 from glaslos/coverage
increasing test coverage
2 parents 8be1ab1 + 6a441d8 commit f53ff75

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ go:
33
- "1.8.x"
44
- "1.9.x"
55
- "1.10.x"
6+
67
sudo: false
78
install:
89
- go get -u github.com/go-audio/audio
910
- go get -u github.com/go-audio/wav
10-
- go get -u github.com/go-audio/aiff
11+
- go get -u github.com/go-audio/aiff

file.go

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ var (
2828
Aiff Format = "aiff"
2929
// VideoMP4 is the video mp4 format
3030
VideoMP4 Format = "video/mp4"
31+
// VideoAvi is the video avi format
32+
VideoAvi Format = "video/avi"
33+
// VideoWebm is the video webm format
34+
VideoWebm Format = "video/webm"
3135
// Mp3 is the audio mpeg/3 format
3236
Mp3 Format = "mp3"
3337
// MIDI is the MIDI format

file_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ func TestFileFormat(t *testing.T) {
1616
}{
1717
{name: "wav", path: "../wav/fixtures/bass.wav", want: audiotools.Wav},
1818
{name: "aiff", path: "../aiff/fixtures/kick.aif", want: audiotools.Aiff},
19+
// Venture beyone supported decoder formats
20+
{name: "avi", path: "../wav/fixtures/sample.avi", want: audiotools.Unknown},
1921
}
2022
for _, tt := range tests {
2123
t.Run(tt.name, func(t *testing.T) {

header_test.go

+10
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ func TestHeaderFormat(t *testing.T) {
3232
header: []byte{0x00, 0x00, 0x00, 0x20, 0x66, 0x74, 0x79, 0x70, 0x4D, 0x34, 0x41, 0x20, 0x00, 0x00, 0x00, 0x00, 0x4D, 0x34, 0x41, 0x20, 0x6D, 0x70, 0x34, 0x32, 0x69, 0x73, 0x6F, 0x6D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x97, 0x2B, 0x6D, 0x6F, 0x6F, 0x76, 0x00, 0x00, 0x00, 0x6C, 0x6D, 0x76, 0x68, 0x64, 0x00, 0x00, 0x00, 0x00, 0xD1, 0xB1, 0xAB, 0xCC, 0xCD, 0x84, 0x91, 0x5C},
3333
want: VideoMP4,
3434
},
35+
{
36+
name: "avi",
37+
header: []byte{0x52, 0x49, 0x46, 0x46, 0x2c, 0x4f, 0x0a, 0x00, 0x41, 0x56, 0x49, 0x20},
38+
want: VideoAvi,
39+
},
40+
{
41+
name: "webm",
42+
header: []byte{0x1a, 0x45, 0xdf, 0xa3, 0x42},
43+
want: VideoWebm,
44+
},
3545
{
3646
name: "unknown",
3747
header: []byte{0x70, 0x61, 0x63, 0x6B, 0x61, 0x67, 0x65, 0x20, 0x61, 0x75, 0x64, 0x69, 0x6F, 0x74, 0x6F, 0x6F, 0x6C, 0x73, 0x0A, 0x0A, 0x69, 0x6D, 0x70, 0x6F, 0x72, 0x74, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6E, 0x67, 0x22, 0x0A, 0x0A, 0x66, 0x75, 0x6E, 0x63, 0x20, 0x54, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x46, 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x28, 0x74, 0x20, 0x2A, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6E, 0x67, 0x2E, 0x54, 0x29, 0x20, 0x00},

0 commit comments

Comments
 (0)