mirror of
https://github.com/Jguer/yay.git
synced 2024-11-06 09:07:21 +01:00
f2579f26a3
types is pretty generic as a module name, this should be split into seperate modules.
34 lines
1.2 KiB
Go
34 lines
1.2 KiB
Go
package main
|
|
|
|
import "testing"
|
|
|
|
func TestLessRunes(t *testing.T) {
|
|
t.Parallel()
|
|
type args struct {
|
|
iRunes []rune
|
|
jRunes []rune
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want bool
|
|
}{
|
|
{name: "nilslices", args: args{iRunes: nil, jRunes: nil}, want: false},
|
|
{name: "emptyslices", args: args{iRunes: []rune{}, jRunes: []rune{}}, want: false},
|
|
{name: "simpleslice a,b", args: args{iRunes: []rune{'a'}, jRunes: []rune{'b'}}, want: true},
|
|
{name: "simpleslice b,a", args: args{iRunes: []rune{'b'}, jRunes: []rune{'a'}}, want: false},
|
|
{name: "equalslice", args: args{iRunes: []rune{'a', 'a', 'a'}, jRunes: []rune{'a', 'a', 'a'}}, want: false},
|
|
{name: "uppercase", args: args{iRunes: []rune{'a'}, jRunes: []rune{'A'}}, want: false},
|
|
{name: "longerFirstArg", args: args{iRunes: []rune{'a', 'b'}, jRunes: []rune{'a'}}, want: false},
|
|
{name: "longerSecondArg", args: args{iRunes: []rune{'a'}, jRunes: []rune{'a', 'b'}}, want: true},
|
|
{name: "utf8 less", args: args{iRunes: []rune{'世', '2', '0'}, jRunes: []rune{'世', '界', '3'}}, want: true},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := LessRunes(tt.args.iRunes, tt.args.jRunes); got != tt.want {
|
|
t.Errorf("LessRunes() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|