package main

import (
	"testing"
)

func TestIsAudioFile(t *testing.T) {

	tests := []struct {
		name     string
		path     string
		expected bool
	}{
		{"mp3 file", "song.mp3", true},
		{"flac file", "song.flac", true},
		{"m4a file", "song.m4a", true},
		{"wav file", "song.wav", true},
		{"ogg file", "song.ogg", true},
		{"aac file", "song.aac", false},
		{"wma file", "song.wma", false},
		{"uppercase extension", "song.MP3", true},
		{"mixed case", "song.Mp3", true},
		{"txt file", "song.txt", false},
		{"jpg file", "song.jpg", false},
		{"no extension", "song", false},
		{"dot in name", "my.song.mp3", true},
		{"multiple dots", "my.song.final.mp3", true},
		{"path with directory", "/path/to/song.mp3", true},
		{"Windows path", "C:\\Music\\song.mp3", true},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			result := isAudioFile(tt.path)
			if result != tt.expected {
				t.Errorf("isAudioFile(%q) = %v, want %v", tt.path, result, tt.expected)
			}
		})
	}
}
