package natsort import "testing" func TestLess(t *testing.T) { cases := []struct { a, b string want bool }{ {"page1", "page2", true}, {"page2", "page10", true}, {"page10", "page2", false}, {"01 - Track.mp3", "02 - Track.mp3", true}, {"Chapter 1.mp3", "Chapter 10.mp3", true}, {"Chapter 10.mp3", "Chapter 9.mp3", false}, {"page01", "page1", false}, // numerically equal {"page1", "page01", false}, {"a", "b", true}, {"b", "a", false}, {"", "a", true}, {"a", "", false}, } for _, c := range cases { if got := Less(c.a, c.b); got != c.want { t.Errorf("Less(%q, %q) = %v, want %v", c.a, c.b, got, c.want) } } }