github.com/seeker-insurance/kit@v0.0.13/sortlib/sortlib_test.go (about)

     1  package sortlib
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  const beta = "Β"
     8  
     9  func TestByBytes(t *testing.T) {
    10  	type args struct {
    11  		s string
    12  	}
    13  
    14  	tests := []struct {
    15  		name string
    16  		args args
    17  		want string
    18  	}{
    19  
    20  		{
    21  			name: "ok",
    22  			args: args{"aaZZAA"},
    23  			want: "AAZZaa",
    24  		},
    25  		{
    26  			name: "unicode",
    27  			args: args{beta},
    28  			want: string([]byte{146, 206}),
    29  		},
    30  	}
    31  	for _, tt := range tests {
    32  		t.Run(tt.name, func(t *testing.T) {
    33  			if got := ByBytes(tt.args.s); got != tt.want {
    34  				t.Errorf("ByBytes() = %v, want %v", []uint8(got), (tt.want))
    35  			}
    36  		})
    37  	}
    38  }