chore: seperate large files
This commit is contained in:
parent
ebbf516689
commit
76e1298ded
44 changed files with 5745 additions and 4173 deletions
58
internal/format/srt/lyrics_test.go
Normal file
58
internal/format/srt/lyrics_test.go
Normal file
|
@ -0,0 +1,58 @@
|
|||
package srt
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"sub-cli/internal/model"
|
||||
)
|
||||
|
||||
func TestConvertToLyrics(t *testing.T) {
|
||||
// Create test entries
|
||||
entries := []model.SRTEntry{
|
||||
{
|
||||
Number: 1,
|
||||
StartTime: model.Timestamp{Hours: 0, Minutes: 0, Seconds: 1, Milliseconds: 0},
|
||||
EndTime: model.Timestamp{Hours: 0, Minutes: 0, Seconds: 4, Milliseconds: 0},
|
||||
Content: "This is the first line.",
|
||||
},
|
||||
{
|
||||
Number: 2,
|
||||
StartTime: model.Timestamp{Hours: 0, Minutes: 0, Seconds: 5, Milliseconds: 0},
|
||||
EndTime: model.Timestamp{Hours: 0, Minutes: 0, Seconds: 8, Milliseconds: 0},
|
||||
Content: "This is the second line.",
|
||||
},
|
||||
{
|
||||
Number: 3,
|
||||
StartTime: model.Timestamp{Hours: 0, Minutes: 0, Seconds: 9, Milliseconds: 0},
|
||||
EndTime: model.Timestamp{Hours: 0, Minutes: 0, Seconds: 12, Milliseconds: 0},
|
||||
Content: "This is the third line.",
|
||||
},
|
||||
}
|
||||
|
||||
// Convert to Lyrics
|
||||
lyrics := ConvertToLyrics(entries)
|
||||
|
||||
// Check result
|
||||
if len(lyrics.Timeline) != 3 {
|
||||
t.Errorf("Expected 3 timeline entries, got %d", len(lyrics.Timeline))
|
||||
}
|
||||
if len(lyrics.Content) != 3 {
|
||||
t.Errorf("Expected 3 content entries, got %d", len(lyrics.Content))
|
||||
}
|
||||
|
||||
// Check first entry
|
||||
if lyrics.Timeline[0].Hours != 0 || lyrics.Timeline[0].Minutes != 0 ||
|
||||
lyrics.Timeline[0].Seconds != 1 || lyrics.Timeline[0].Milliseconds != 0 {
|
||||
t.Errorf("First timeline: expected 00:00:01,000, got %+v", lyrics.Timeline[0])
|
||||
}
|
||||
if lyrics.Content[0] != "This is the first line." {
|
||||
t.Errorf("First content: expected 'This is the first line.', got '%s'", lyrics.Content[0])
|
||||
}
|
||||
|
||||
// Check with empty entries
|
||||
emptyLyrics := ConvertToLyrics([]model.SRTEntry{})
|
||||
if len(emptyLyrics.Timeline) != 0 || len(emptyLyrics.Content) != 0 {
|
||||
t.Errorf("Expected empty lyrics for empty entries, got %d timeline and %d content",
|
||||
len(emptyLyrics.Timeline), len(emptyLyrics.Content))
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue