github.com/songzhibin97/go-baseutils@v0.0.2-0.20240302024150-487d8ce9c082/base/bslice/any_test.go (about)

     1  package bslice
     2  
     3  import (
     4  	"github.com/songzhibin97/go-baseutils/base/bcomparator"
     5  	"github.com/stretchr/testify/assert"
     6  	"testing"
     7  )
     8  
     9  func TestUnsafeAnyBSlice_EqualFunc(t *testing.T) {
    10  	type fields struct {
    11  		e []int
    12  	}
    13  	type args struct {
    14  		es []int
    15  		f  func(int, int) bool
    16  	}
    17  	tests := []struct {
    18  		name   string
    19  		fields fields
    20  		args   args
    21  		want   bool
    22  	}{
    23  		{
    24  			name: "nil",
    25  			fields: fields{
    26  				e: nil,
    27  			},
    28  			args: args{
    29  				es: nil,
    30  				f:  nil,
    31  			},
    32  			want: true,
    33  		},
    34  		{
    35  			name: "nil",
    36  			fields: fields{
    37  				e: []int{},
    38  			},
    39  			args: args{
    40  				es: nil,
    41  				f:  nil,
    42  			},
    43  			want: true,
    44  		},
    45  		{
    46  			name: "nil",
    47  			fields: fields{
    48  				e: nil,
    49  			},
    50  			args: args{
    51  				es: []int{},
    52  				f:  nil,
    53  			},
    54  			want: true,
    55  		},
    56  		{
    57  			name: "",
    58  			fields: fields{
    59  				e: []int{1, 2, 3},
    60  			},
    61  			args: args{
    62  				es: []int{1, 2, 3},
    63  				f:  nil,
    64  			},
    65  			want: true,
    66  		},
    67  		{
    68  			name: "",
    69  			fields: fields{
    70  				e: []int{1, 1, 1},
    71  			},
    72  			args: args{
    73  				es: []int{2, 2, 2},
    74  				f: func(i int, i2 int) bool {
    75  					return true
    76  				},
    77  			},
    78  			want: true,
    79  		},
    80  		{
    81  			name: "",
    82  			fields: fields{
    83  				e: []int{1, 1, 1},
    84  			},
    85  			args: args{
    86  				es: []int{2, 2, 2},
    87  				f: func(i int, i2 int) bool {
    88  					return i == i2
    89  				},
    90  			},
    91  			want: false,
    92  		},
    93  	}
    94  	for _, tt := range tests {
    95  		t.Run(tt.name, func(t *testing.T) {
    96  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
    97  			if got := x.EqualFunc(tt.args.es, tt.args.f); got != tt.want {
    98  				t.Errorf("EqualFunc() = %v, want %v", got, tt.want)
    99  			}
   100  		})
   101  	}
   102  }
   103  
   104  func TestUnsafeAnyBSlice_CompareFunc(t *testing.T) {
   105  	type fields struct {
   106  		e []int
   107  	}
   108  	type args struct {
   109  		es []int
   110  	}
   111  	tests := []struct {
   112  		name   string
   113  		fields fields
   114  		args   args
   115  		want   int
   116  	}{
   117  		{
   118  			name: "nil",
   119  			fields: fields{
   120  				e: nil,
   121  			},
   122  			args: args{
   123  				es: nil,
   124  			},
   125  			want: 0,
   126  		},
   127  		{
   128  			name: "",
   129  			fields: fields{
   130  				e: []int{},
   131  			},
   132  			args: args{
   133  				es: nil,
   134  			},
   135  			want: 0,
   136  		},
   137  		{
   138  			name: "",
   139  			fields: fields{
   140  				e: nil,
   141  			},
   142  			args: args{
   143  				es: []int{},
   144  			},
   145  			want: 0,
   146  		},
   147  		{
   148  			name: "",
   149  			fields: fields{
   150  				e: []int{1},
   151  			},
   152  			args: args{
   153  				es: []int{},
   154  			},
   155  			want: 1,
   156  		},
   157  		{
   158  			name: "",
   159  			fields: fields{
   160  				e: []int{},
   161  			},
   162  			args: args{
   163  				es: []int{1},
   164  			},
   165  			want: -1,
   166  		},
   167  		{
   168  			name: "",
   169  			fields: fields{
   170  				e: []int{2, 2},
   171  			},
   172  			args: args{
   173  				es: []int{2, 1, 1},
   174  			},
   175  			want: 1,
   176  		},
   177  		{
   178  			name: "",
   179  			fields: fields{
   180  				e: []int{2, 1, 1},
   181  			},
   182  			args: args{
   183  				es: []int{2, 2},
   184  			},
   185  			want: -1,
   186  		},
   187  	}
   188  	for _, tt := range tests {
   189  		t.Run(tt.name, func(t *testing.T) {
   190  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
   191  			if got := x.CompareFunc(tt.args.es, bcomparator.IntComparator()); got != tt.want {
   192  				t.Errorf("CompareFunc() = %v, want %v", got, tt.want)
   193  			}
   194  		})
   195  	}
   196  }
   197  
   198  func TestUnsafeAnyBSlice_IndexFunc(t *testing.T) {
   199  	type fields struct {
   200  		e []int
   201  	}
   202  	type args struct {
   203  		f func(int2 int) bool
   204  	}
   205  	tests := []struct {
   206  		name   string
   207  		fields fields
   208  		args   args
   209  		want   int
   210  	}{
   211  		{
   212  			name: "nil",
   213  			fields: fields{
   214  				e: nil,
   215  			},
   216  			args: args{
   217  				f: func(int2 int) bool {
   218  					return true
   219  				},
   220  			},
   221  			want: -1,
   222  		},
   223  		{
   224  			name: "",
   225  			fields: fields{
   226  				e: []int{},
   227  			},
   228  			args: args{
   229  				f: func(int2 int) bool {
   230  					return true
   231  				},
   232  			},
   233  			want: -1,
   234  		},
   235  		{
   236  			name: "",
   237  			fields: fields{
   238  				e: []int{1, 2, 3},
   239  			},
   240  			args: args{
   241  				f: func(int2 int) bool {
   242  					return false
   243  				},
   244  			},
   245  			want: -1,
   246  		},
   247  		{
   248  			name: "",
   249  			fields: fields{
   250  				e: []int{1, 2, 3},
   251  			},
   252  			args: args{
   253  				f: func(i int) bool {
   254  					return i == -1
   255  				},
   256  			},
   257  			want: -1,
   258  		},
   259  		{
   260  			name: "",
   261  			fields: fields{
   262  				e: []int{1, 2, 3},
   263  			},
   264  			args: args{
   265  				f: func(i int) bool {
   266  					return i == 1
   267  				},
   268  			},
   269  			want: 0,
   270  		},
   271  		{
   272  			name: "",
   273  			fields: fields{
   274  				e: []int{1, 2, 3},
   275  			},
   276  			args: args{
   277  				f: func(i int) bool {
   278  					return i == 2
   279  				},
   280  			},
   281  			want: 1,
   282  		},
   283  		{
   284  			name: "",
   285  			fields: fields{
   286  				e: []int{1, 2, 3},
   287  			},
   288  			args: args{
   289  				f: func(i int) bool {
   290  					return i == 3
   291  				},
   292  			},
   293  			want: 2,
   294  		},
   295  		{
   296  			name: "",
   297  			fields: fields{
   298  				e: []int{1, 2, 3},
   299  			},
   300  			args: args{
   301  				f: func(i int) bool {
   302  					return i == 4
   303  				},
   304  			},
   305  			want: -1,
   306  		},
   307  	}
   308  	for _, tt := range tests {
   309  		t.Run(tt.name, func(t *testing.T) {
   310  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
   311  			if got := x.IndexFunc(tt.args.f); got != tt.want {
   312  				t.Errorf("IndexFunc() = %v, want %v", got, tt.want)
   313  			}
   314  		})
   315  	}
   316  }
   317  
   318  func TestUnsafeAnyBSlice_Insert(t *testing.T) {
   319  	type fields struct {
   320  		e []int
   321  	}
   322  	type args struct {
   323  		i int
   324  		e []int
   325  	}
   326  	tests := []struct {
   327  		name   string
   328  		fields fields
   329  		args   args
   330  		want   []int
   331  	}{
   332  		{
   333  			name: "nil",
   334  			fields: fields{
   335  				e: nil,
   336  			},
   337  			args: args{
   338  				i: 0,
   339  				e: nil,
   340  			},
   341  			want: nil,
   342  		},
   343  		{
   344  			name: "nil",
   345  			fields: fields{
   346  				e: nil,
   347  			},
   348  			args: args{
   349  				i: 0,
   350  				e: []int{4, 5},
   351  			},
   352  			want: []int{4, 5},
   353  		},
   354  		{
   355  			name: "nil",
   356  			fields: fields{
   357  				e: nil,
   358  			},
   359  			args: args{
   360  				i: 1,
   361  				e: []int{4, 5},
   362  			},
   363  			want: nil,
   364  		},
   365  		{
   366  			name: "",
   367  			fields: fields{
   368  				e: []int{1, 2, 3},
   369  			},
   370  			args: args{
   371  				i: 0,
   372  				e: []int{4, 5},
   373  			},
   374  			want: []int{4, 5, 1, 2, 3},
   375  		},
   376  		{
   377  			name: "",
   378  			fields: fields{
   379  				e: []int{1, 2, 3},
   380  			},
   381  			args: args{
   382  				i: 1,
   383  				e: []int{4, 5},
   384  			},
   385  			want: []int{1, 4, 5, 2, 3},
   386  		},
   387  		{
   388  			name: "",
   389  			fields: fields{
   390  				e: []int{1, 2, 3},
   391  			},
   392  			args: args{
   393  				i: 2,
   394  				e: []int{4, 5},
   395  			},
   396  			want: []int{1, 2, 4, 5, 3},
   397  		},
   398  		{
   399  			name: "",
   400  			fields: fields{
   401  				e: []int{1, 2, 3},
   402  			},
   403  			args: args{
   404  				i: 3,
   405  				e: []int{4, 5},
   406  			},
   407  			want: []int{1, 2, 3, 4, 5},
   408  		},
   409  		{
   410  			name: "",
   411  			fields: fields{
   412  				e: []int{1, 2, 3},
   413  			},
   414  			args: args{
   415  				i: 4,
   416  				e: []int{4, 5},
   417  			},
   418  			want: []int{1, 2, 3},
   419  		},
   420  	}
   421  	for _, tt := range tests {
   422  		t.Run(tt.name, func(t *testing.T) {
   423  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
   424  			x.Insert(tt.args.i, tt.args.e...)
   425  			assert.Equal(t, tt.want, x.ToMetaSlice())
   426  		})
   427  	}
   428  }
   429  
   430  func TestUnsafeAnyBSlice_InsertE(t *testing.T) {
   431  	type fields struct {
   432  		e []int
   433  	}
   434  	type args struct {
   435  		i int
   436  		e []int
   437  	}
   438  	tests := []struct {
   439  		name    string
   440  		fields  fields
   441  		args    args
   442  		want    []int
   443  		wanterr bool
   444  	}{
   445  		{
   446  			name: "nil",
   447  			fields: fields{
   448  				e: nil,
   449  			},
   450  			args: args{
   451  				i: 0,
   452  				e: nil,
   453  			},
   454  			want:    nil,
   455  			wanterr: false,
   456  		},
   457  		{
   458  			name: "nil",
   459  			fields: fields{
   460  				e: nil,
   461  			},
   462  			args: args{
   463  				i: 0,
   464  				e: []int{4, 5},
   465  			},
   466  			want:    []int{4, 5},
   467  			wanterr: false,
   468  		},
   469  		{
   470  			name: "nil",
   471  			fields: fields{
   472  				e: nil,
   473  			},
   474  			args: args{
   475  				i: 1,
   476  				e: []int{4, 5},
   477  			},
   478  			want:    nil,
   479  			wanterr: true,
   480  		},
   481  		{
   482  			name: "",
   483  			fields: fields{
   484  				e: []int{1, 2, 3},
   485  			},
   486  			args: args{
   487  				i: 0,
   488  				e: []int{4, 5},
   489  			},
   490  			want:    []int{4, 5, 1, 2, 3},
   491  			wanterr: false,
   492  		},
   493  		{
   494  			name: "",
   495  			fields: fields{
   496  				e: []int{1, 2, 3},
   497  			},
   498  			args: args{
   499  				i: 1,
   500  				e: []int{4, 5},
   501  			},
   502  			want:    []int{1, 4, 5, 2, 3},
   503  			wanterr: false,
   504  		},
   505  		{
   506  			name: "",
   507  			fields: fields{
   508  				e: []int{1, 2, 3},
   509  			},
   510  			args: args{
   511  				i: 2,
   512  				e: []int{4, 5},
   513  			},
   514  			want:    []int{1, 2, 4, 5, 3},
   515  			wanterr: false,
   516  		},
   517  		{
   518  			name: "",
   519  			fields: fields{
   520  				e: []int{1, 2, 3},
   521  			},
   522  			args: args{
   523  				i: 3,
   524  				e: []int{4, 5},
   525  			},
   526  			want:    []int{1, 2, 3, 4, 5},
   527  			wanterr: false,
   528  		},
   529  		{
   530  			name: "",
   531  			fields: fields{
   532  				e: []int{1, 2, 3},
   533  			},
   534  			args: args{
   535  				i: 4,
   536  				e: []int{4, 5},
   537  			},
   538  			want:    []int{1, 2, 3},
   539  			wanterr: true,
   540  		},
   541  	}
   542  	for _, tt := range tests {
   543  		t.Run(tt.name, func(t *testing.T) {
   544  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
   545  			err := x.InsertE(tt.args.i, tt.args.e...)
   546  			assert.Equal(t, tt.wanterr, err != nil)
   547  			assert.Equal(t, tt.want, x.ToMetaSlice())
   548  		})
   549  	}
   550  }
   551  
   552  func TestUnsafeAnyBSlice_Delete(t *testing.T) {
   553  	type fields struct {
   554  		e []int
   555  	}
   556  	type args struct {
   557  		i int
   558  		j int
   559  	}
   560  	tests := []struct {
   561  		name   string
   562  		fields fields
   563  		args   args
   564  		want   []int
   565  	}{
   566  		{
   567  			name: "nil",
   568  			fields: fields{
   569  				e: nil,
   570  			},
   571  			args: args{
   572  				i: 0,
   573  				j: 0,
   574  			},
   575  			want: nil,
   576  		},
   577  		{
   578  			name: "",
   579  			fields: fields{
   580  				e: []int{},
   581  			},
   582  			args: args{
   583  				i: 0,
   584  				j: 0,
   585  			},
   586  			want: []int{},
   587  		},
   588  		{
   589  			name: "",
   590  			fields: fields{
   591  				e: []int{0, 1, 2, 3, 4, 5},
   592  			},
   593  			args: args{
   594  				i: -1,
   595  				j: -1,
   596  			},
   597  			want: []int{0, 1, 2, 3, 4, 5},
   598  		},
   599  		{
   600  			name: "",
   601  			fields: fields{
   602  				e: []int{0, 1, 2, 3, 4, 5},
   603  			},
   604  			args: args{
   605  				i: 6,
   606  				j: 6,
   607  			},
   608  			want: []int{0, 1, 2, 3, 4, 5},
   609  		},
   610  		{
   611  			name: "",
   612  			fields: fields{
   613  				e: []int{0, 1, 2, 3, 4, 5},
   614  			},
   615  			args: args{
   616  				i: 0,
   617  				j: 6,
   618  			},
   619  			want: []int{},
   620  		},
   621  		{
   622  			name: "",
   623  			fields: fields{
   624  				e: []int{0, 1, 2, 3, 4, 5},
   625  			},
   626  			args: args{
   627  				i: 1,
   628  				j: 1,
   629  			},
   630  			want: []int{0, 1, 2, 3, 4, 5},
   631  		},
   632  		{
   633  			name: "",
   634  			fields: fields{
   635  				e: []int{0, 1, 2, 3, 4, 5},
   636  			},
   637  			args: args{
   638  				i: 1,
   639  				j: 2,
   640  			},
   641  			want: []int{0, 2, 3, 4, 5},
   642  		},
   643  		{
   644  			name: "",
   645  			fields: fields{
   646  				e: []int{0, 1, 2, 3, 4, 5},
   647  			},
   648  			args: args{
   649  				i: 2,
   650  				j: 3,
   651  			},
   652  			want: []int{0, 1, 3, 4, 5},
   653  		},
   654  		{
   655  			name: "",
   656  			fields: fields{
   657  				e: []int{0, 1, 2, 3, 4, 5},
   658  			},
   659  			args: args{
   660  				i: 3,
   661  				j: 6,
   662  			},
   663  			want: []int{0, 1, 2},
   664  		},
   665  	}
   666  	for _, tt := range tests {
   667  		t.Run(tt.name, func(t *testing.T) {
   668  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
   669  			x.Delete(tt.args.i, tt.args.j)
   670  			assert.Equal(t, tt.want, x.ToMetaSlice())
   671  		})
   672  	}
   673  }
   674  
   675  func TestUnsafeAnyBSlice_DeleteE(t *testing.T) {
   676  	type fields struct {
   677  		e []int
   678  	}
   679  	type args struct {
   680  		i int
   681  		j int
   682  	}
   683  	tests := []struct {
   684  		name    string
   685  		fields  fields
   686  		args    args
   687  		want    []int
   688  		wanterr bool
   689  	}{
   690  		{
   691  			name: "nil",
   692  			fields: fields{
   693  				e: nil,
   694  			},
   695  			args: args{
   696  				i: 0,
   697  				j: 0,
   698  			},
   699  			want:    nil,
   700  			wanterr: false,
   701  		},
   702  		{
   703  			name: "",
   704  			fields: fields{
   705  				e: []int{},
   706  			},
   707  			args: args{
   708  				i: 0,
   709  				j: 0,
   710  			},
   711  			want:    []int{},
   712  			wanterr: false,
   713  		},
   714  		{
   715  			name: "",
   716  			fields: fields{
   717  				e: []int{0, 1, 2, 3, 4, 5},
   718  			},
   719  			args: args{
   720  				i: -1,
   721  				j: -1,
   722  			},
   723  			want:    []int{0, 1, 2, 3, 4, 5},
   724  			wanterr: true,
   725  		},
   726  		{
   727  			name: "",
   728  			fields: fields{
   729  				e: []int{0, 1, 2, 3, 4, 5},
   730  			},
   731  			args: args{
   732  				i: 6,
   733  				j: 6,
   734  			},
   735  			want:    []int{0, 1, 2, 3, 4, 5},
   736  			wanterr: false,
   737  		},
   738  		{
   739  			name: "",
   740  			fields: fields{
   741  				e: []int{0, 1, 2, 3, 4, 5},
   742  			},
   743  			args: args{
   744  				i: 0,
   745  				j: 6,
   746  			},
   747  			want:    []int{},
   748  			wanterr: false,
   749  		},
   750  		{
   751  			name: "",
   752  			fields: fields{
   753  				e: []int{0, 1, 2, 3, 4, 5},
   754  			},
   755  			args: args{
   756  				i: 1,
   757  				j: 1,
   758  			},
   759  			want:    []int{0, 1, 2, 3, 4, 5},
   760  			wanterr: false,
   761  		},
   762  		{
   763  			name: "",
   764  			fields: fields{
   765  				e: []int{0, 1, 2, 3, 4, 5},
   766  			},
   767  			args: args{
   768  				i: 1,
   769  				j: 2,
   770  			},
   771  			want:    []int{0, 2, 3, 4, 5},
   772  			wanterr: false,
   773  		},
   774  		{
   775  			name: "",
   776  			fields: fields{
   777  				e: []int{0, 1, 2, 3, 4, 5},
   778  			},
   779  			args: args{
   780  				i: 2,
   781  				j: 3,
   782  			},
   783  			want:    []int{0, 1, 3, 4, 5},
   784  			wanterr: false,
   785  		},
   786  		{
   787  			name: "",
   788  			fields: fields{
   789  				e: []int{0, 1, 2, 3, 4, 5},
   790  			},
   791  			args: args{
   792  				i: 3,
   793  				j: 6,
   794  			},
   795  			want:    []int{0, 1, 2},
   796  			wanterr: false,
   797  		},
   798  	}
   799  	for _, tt := range tests {
   800  		t.Run(tt.name, func(t *testing.T) {
   801  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
   802  			err := x.DeleteE(tt.args.i, tt.args.j)
   803  			assert.Equal(t, tt.wanterr, err != nil)
   804  			assert.Equal(t, tt.want, x.ToMetaSlice())
   805  		})
   806  	}
   807  }
   808  
   809  func TestUnsafeAnyBSlice_DeleteToSlice(t *testing.T) {
   810  	type fields struct {
   811  		e []int
   812  	}
   813  	type args struct {
   814  		i int
   815  		j int
   816  	}
   817  	tests := []struct {
   818  		name   string
   819  		fields fields
   820  		args   args
   821  		want   []int
   822  	}{
   823  		{
   824  			name: "nil",
   825  			fields: fields{
   826  				e: nil,
   827  			},
   828  			args: args{
   829  				i: 0,
   830  				j: 0,
   831  			},
   832  			want: nil,
   833  		},
   834  		{
   835  			name: "",
   836  			fields: fields{
   837  				e: []int{},
   838  			},
   839  			args: args{
   840  				i: 0,
   841  				j: 0,
   842  			},
   843  			want: nil,
   844  		},
   845  		{
   846  			name: "",
   847  			fields: fields{
   848  				e: []int{0, 1, 2, 3, 4, 5},
   849  			},
   850  			args: args{
   851  				i: -1,
   852  				j: -1,
   853  			},
   854  			want: nil,
   855  		},
   856  		{
   857  			name: "",
   858  			fields: fields{
   859  				e: []int{0, 1, 2, 3, 4, 5},
   860  			},
   861  			args: args{
   862  				i: 6,
   863  				j: 6,
   864  			},
   865  			want: []int{0, 1, 2, 3, 4, 5},
   866  		},
   867  		{
   868  			name: "",
   869  			fields: fields{
   870  				e: []int{0, 1, 2, 3, 4, 5},
   871  			},
   872  			args: args{
   873  				i: 0,
   874  				j: 6,
   875  			},
   876  			want: []int{},
   877  		},
   878  		{
   879  			name: "",
   880  			fields: fields{
   881  				e: []int{0, 1, 2, 3, 4, 5},
   882  			},
   883  			args: args{
   884  				i: 1,
   885  				j: 1,
   886  			},
   887  			want: []int{0, 1, 2, 3, 4, 5},
   888  		},
   889  		{
   890  			name: "",
   891  			fields: fields{
   892  				e: []int{0, 1, 2, 3, 4, 5},
   893  			},
   894  			args: args{
   895  				i: 1,
   896  				j: 2,
   897  			},
   898  			want: []int{0, 2, 3, 4, 5},
   899  		},
   900  		{
   901  			name: "",
   902  			fields: fields{
   903  				e: []int{0, 1, 2, 3, 4, 5},
   904  			},
   905  			args: args{
   906  				i: 2,
   907  				j: 3,
   908  			},
   909  			want: []int{0, 1, 3, 4, 5},
   910  		},
   911  		{
   912  			name: "",
   913  			fields: fields{
   914  				e: []int{0, 1, 2, 3, 4, 5},
   915  			},
   916  			args: args{
   917  				i: 3,
   918  				j: 6,
   919  			},
   920  			want: []int{0, 1, 2},
   921  		},
   922  	}
   923  	for _, tt := range tests {
   924  		t.Run(tt.name, func(t *testing.T) {
   925  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
   926  			assert.Equalf(t, tt.want, x.DeleteToSlice(tt.args.i, tt.args.j), "DeleteToSlice(%v, %v)", tt.args.i, tt.args.j)
   927  		})
   928  	}
   929  }
   930  
   931  func TestUnsafeAnyBSlice_DeleteToSliceE(t *testing.T) {
   932  	type fields struct {
   933  		e []int
   934  	}
   935  	type args struct {
   936  		i int
   937  		j int
   938  	}
   939  	tests := []struct {
   940  		name    string
   941  		fields  fields
   942  		args    args
   943  		want    []int
   944  		wanterr bool
   945  	}{
   946  		{
   947  			name: "nil",
   948  			fields: fields{
   949  				e: nil,
   950  			},
   951  			args: args{
   952  				i: 0,
   953  				j: 0,
   954  			},
   955  			want:    nil,
   956  			wanterr: false,
   957  		},
   958  		{
   959  			name: "",
   960  			fields: fields{
   961  				e: []int{},
   962  			},
   963  			args: args{
   964  				i: 0,
   965  				j: 0,
   966  			},
   967  			want:    nil,
   968  			wanterr: false,
   969  		},
   970  		{
   971  			name: "",
   972  			fields: fields{
   973  				e: []int{0, 1, 2, 3, 4, 5},
   974  			},
   975  			args: args{
   976  				i: -1,
   977  				j: -1,
   978  			},
   979  			want:    nil,
   980  			wanterr: true,
   981  		},
   982  		{
   983  			name: "",
   984  			fields: fields{
   985  				e: []int{0, 1, 2, 3, 4, 5},
   986  			},
   987  			args: args{
   988  				i: 6,
   989  				j: 6,
   990  			},
   991  			want:    []int{0, 1, 2, 3, 4, 5},
   992  			wanterr: false,
   993  		},
   994  		{
   995  			name: "",
   996  			fields: fields{
   997  				e: []int{0, 1, 2, 3, 4, 5},
   998  			},
   999  			args: args{
  1000  				i: 0,
  1001  				j: 6,
  1002  			},
  1003  			want:    []int{},
  1004  			wanterr: false,
  1005  		},
  1006  		{
  1007  			name: "",
  1008  			fields: fields{
  1009  				e: []int{0, 1, 2, 3, 4, 5},
  1010  			},
  1011  			args: args{
  1012  				i: 1,
  1013  				j: 1,
  1014  			},
  1015  			want:    []int{0, 1, 2, 3, 4, 5},
  1016  			wanterr: false,
  1017  		},
  1018  		{
  1019  			name: "",
  1020  			fields: fields{
  1021  				e: []int{0, 1, 2, 3, 4, 5},
  1022  			},
  1023  			args: args{
  1024  				i: 1,
  1025  				j: 2,
  1026  			},
  1027  			want:    []int{0, 2, 3, 4, 5},
  1028  			wanterr: false,
  1029  		},
  1030  		{
  1031  			name: "",
  1032  			fields: fields{
  1033  				e: []int{0, 1, 2, 3, 4, 5},
  1034  			},
  1035  			args: args{
  1036  				i: 2,
  1037  				j: 3,
  1038  			},
  1039  			want:    []int{0, 1, 3, 4, 5},
  1040  			wanterr: false,
  1041  		},
  1042  		{
  1043  			name: "",
  1044  			fields: fields{
  1045  				e: []int{0, 1, 2, 3, 4, 5},
  1046  			},
  1047  			args: args{
  1048  				i: 3,
  1049  				j: 6,
  1050  			},
  1051  			want:    []int{0, 1, 2},
  1052  			wanterr: false,
  1053  		},
  1054  	}
  1055  	for _, tt := range tests {
  1056  		t.Run(tt.name, func(t *testing.T) {
  1057  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  1058  			v, err := x.DeleteToSliceE(tt.args.i, tt.args.j)
  1059  			assert.Equal(t, tt.wanterr, err != nil)
  1060  			assert.Equal(t, tt.want, v)
  1061  		})
  1062  	}
  1063  }
  1064  
  1065  func TestUnsafeAnyBSlice_DeleteToBSlice(t *testing.T) {
  1066  	type fields struct {
  1067  		e []int
  1068  	}
  1069  	type args struct {
  1070  		i int
  1071  		j int
  1072  	}
  1073  	tests := []struct {
  1074  		name   string
  1075  		fields fields
  1076  		args   args
  1077  		want   []int
  1078  	}{
  1079  		{
  1080  			name: "nil",
  1081  			fields: fields{
  1082  				e: nil,
  1083  			},
  1084  			args: args{
  1085  				i: 0,
  1086  				j: 0,
  1087  			},
  1088  			want: []int{},
  1089  		},
  1090  		{
  1091  			name: "",
  1092  			fields: fields{
  1093  				e: []int{},
  1094  			},
  1095  			args: args{
  1096  				i: 0,
  1097  				j: 0,
  1098  			},
  1099  			want: []int{},
  1100  		},
  1101  		{
  1102  			name: "",
  1103  			fields: fields{
  1104  				e: []int{0, 1, 2, 3, 4, 5},
  1105  			},
  1106  			args: args{
  1107  				i: -1,
  1108  				j: -1,
  1109  			},
  1110  			want: []int{},
  1111  		},
  1112  		{
  1113  			name: "",
  1114  			fields: fields{
  1115  				e: []int{0, 1, 2, 3, 4, 5},
  1116  			},
  1117  			args: args{
  1118  				i: 6,
  1119  				j: 6,
  1120  			},
  1121  			want: []int{0, 1, 2, 3, 4, 5},
  1122  		},
  1123  		{
  1124  			name: "",
  1125  			fields: fields{
  1126  				e: []int{0, 1, 2, 3, 4, 5},
  1127  			},
  1128  			args: args{
  1129  				i: 0,
  1130  				j: 6,
  1131  			},
  1132  			want: []int{},
  1133  		},
  1134  		{
  1135  			name: "",
  1136  			fields: fields{
  1137  				e: []int{0, 1, 2, 3, 4, 5},
  1138  			},
  1139  			args: args{
  1140  				i: 1,
  1141  				j: 1,
  1142  			},
  1143  			want: []int{0, 1, 2, 3, 4, 5},
  1144  		},
  1145  		{
  1146  			name: "",
  1147  			fields: fields{
  1148  				e: []int{0, 1, 2, 3, 4, 5},
  1149  			},
  1150  			args: args{
  1151  				i: 1,
  1152  				j: 2,
  1153  			},
  1154  			want: []int{0, 2, 3, 4, 5},
  1155  		},
  1156  		{
  1157  			name: "",
  1158  			fields: fields{
  1159  				e: []int{0, 1, 2, 3, 4, 5},
  1160  			},
  1161  			args: args{
  1162  				i: 2,
  1163  				j: 3,
  1164  			},
  1165  			want: []int{0, 1, 3, 4, 5},
  1166  		},
  1167  		{
  1168  			name: "",
  1169  			fields: fields{
  1170  				e: []int{0, 1, 2, 3, 4, 5},
  1171  			},
  1172  			args: args{
  1173  				i: 3,
  1174  				j: 6,
  1175  			},
  1176  			want: []int{0, 1, 2},
  1177  		},
  1178  	}
  1179  	for _, tt := range tests {
  1180  		t.Run(tt.name, func(t *testing.T) {
  1181  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  1182  			assert.Equalf(t, tt.want, x.DeleteToBSlice(tt.args.i, tt.args.j).ToMetaSlice(), "DeleteToSlice(%v, %v)", tt.args.i, tt.args.j)
  1183  		})
  1184  	}
  1185  }
  1186  
  1187  func TestUnsafeAnyBSlice_DeleteToBSliceE(t *testing.T) {
  1188  	type fields struct {
  1189  		e []int
  1190  	}
  1191  	type args struct {
  1192  		i int
  1193  		j int
  1194  	}
  1195  	tests := []struct {
  1196  		name    string
  1197  		fields  fields
  1198  		args    args
  1199  		want    []int
  1200  		wanterr bool
  1201  	}{
  1202  		{
  1203  			name: "nil",
  1204  			fields: fields{
  1205  				e: nil,
  1206  			},
  1207  			args: args{
  1208  				i: 0,
  1209  				j: 0,
  1210  			},
  1211  			want:    []int{},
  1212  			wanterr: false,
  1213  		},
  1214  		{
  1215  			name: "",
  1216  			fields: fields{
  1217  				e: []int{},
  1218  			},
  1219  			args: args{
  1220  				i: 0,
  1221  				j: 0,
  1222  			},
  1223  			want:    []int{},
  1224  			wanterr: false,
  1225  		},
  1226  		{
  1227  			name: "",
  1228  			fields: fields{
  1229  				e: []int{0, 1, 2, 3, 4, 5},
  1230  			},
  1231  			args: args{
  1232  				i: -1,
  1233  				j: -1,
  1234  			},
  1235  			want:    []int{},
  1236  			wanterr: true,
  1237  		},
  1238  		{
  1239  			name: "",
  1240  			fields: fields{
  1241  				e: []int{0, 1, 2, 3, 4, 5},
  1242  			},
  1243  			args: args{
  1244  				i: 6,
  1245  				j: 6,
  1246  			},
  1247  			want:    []int{0, 1, 2, 3, 4, 5},
  1248  			wanterr: false,
  1249  		},
  1250  		{
  1251  			name: "",
  1252  			fields: fields{
  1253  				e: []int{0, 1, 2, 3, 4, 5},
  1254  			},
  1255  			args: args{
  1256  				i: 0,
  1257  				j: 6,
  1258  			},
  1259  			want:    []int{},
  1260  			wanterr: false,
  1261  		},
  1262  		{
  1263  			name: "",
  1264  			fields: fields{
  1265  				e: []int{0, 1, 2, 3, 4, 5},
  1266  			},
  1267  			args: args{
  1268  				i: 1,
  1269  				j: 1,
  1270  			},
  1271  			want:    []int{0, 1, 2, 3, 4, 5},
  1272  			wanterr: false,
  1273  		},
  1274  		{
  1275  			name: "",
  1276  			fields: fields{
  1277  				e: []int{0, 1, 2, 3, 4, 5},
  1278  			},
  1279  			args: args{
  1280  				i: 1,
  1281  				j: 2,
  1282  			},
  1283  			want:    []int{0, 2, 3, 4, 5},
  1284  			wanterr: false,
  1285  		},
  1286  		{
  1287  			name: "",
  1288  			fields: fields{
  1289  				e: []int{0, 1, 2, 3, 4, 5},
  1290  			},
  1291  			args: args{
  1292  				i: 2,
  1293  				j: 3,
  1294  			},
  1295  			want:    []int{0, 1, 3, 4, 5},
  1296  			wanterr: false,
  1297  		},
  1298  		{
  1299  			name: "",
  1300  			fields: fields{
  1301  				e: []int{0, 1, 2, 3, 4, 5},
  1302  			},
  1303  			args: args{
  1304  				i: 3,
  1305  				j: 6,
  1306  			},
  1307  			want:    []int{0, 1, 2},
  1308  			wanterr: false,
  1309  		},
  1310  	}
  1311  	for _, tt := range tests {
  1312  		t.Run(tt.name, func(t *testing.T) {
  1313  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  1314  			v, err := x.DeleteToBSliceE(tt.args.i, tt.args.j)
  1315  			assert.Equal(t, tt.wanterr, err != nil)
  1316  			assert.Equal(t, tt.want, v.ToMetaSlice())
  1317  		})
  1318  	}
  1319  }
  1320  
  1321  func TestUnsafeAnyBSlice_Replace(t *testing.T) {
  1322  	type fields struct {
  1323  		e []int
  1324  	}
  1325  	type args struct {
  1326  		i int
  1327  		j int
  1328  		e []int
  1329  	}
  1330  	tests := []struct {
  1331  		name   string
  1332  		fields fields
  1333  		args   args
  1334  		want   []int
  1335  	}{
  1336  		{
  1337  			name: "nil",
  1338  			fields: fields{
  1339  				e: nil,
  1340  			},
  1341  			args: args{
  1342  				i: 0,
  1343  				j: 0,
  1344  				e: nil,
  1345  			},
  1346  			want: nil,
  1347  		},
  1348  		{
  1349  			name: "",
  1350  			fields: fields{
  1351  				e: nil,
  1352  			},
  1353  			args: args{
  1354  				i: 0,
  1355  				j: 0,
  1356  				e: []int{4, 5},
  1357  			},
  1358  			want: []int{4, 5},
  1359  		},
  1360  		{
  1361  			name: "",
  1362  			fields: fields{
  1363  				e: nil,
  1364  			},
  1365  			args: args{
  1366  				i: 0,
  1367  				j: 1,
  1368  				e: []int{4, 5},
  1369  			},
  1370  			want: nil,
  1371  		},
  1372  		{
  1373  			name: "",
  1374  			fields: fields{
  1375  				e: []int{},
  1376  			},
  1377  			args: args{
  1378  				i: 0,
  1379  				j: 1,
  1380  				e: []int{4, 5},
  1381  			},
  1382  			want: []int{},
  1383  		},
  1384  		{
  1385  			name: "",
  1386  			fields: fields{
  1387  				e: []int{0, 1, 2, 3},
  1388  			},
  1389  			args: args{
  1390  				i: 0,
  1391  				j: 0,
  1392  				e: []int{4, 5},
  1393  			},
  1394  			want: []int{4, 5, 0, 1, 2, 3},
  1395  		},
  1396  		{
  1397  			name: "",
  1398  			fields: fields{
  1399  				e: []int{0, 1, 2, 3},
  1400  			},
  1401  			args: args{
  1402  				i: 0,
  1403  				j: 4,
  1404  				e: []int{4, 5},
  1405  			},
  1406  			want: []int{4, 5},
  1407  		},
  1408  		{
  1409  			name: "",
  1410  			fields: fields{
  1411  				e: []int{0, 1, 2, 3},
  1412  			},
  1413  			args: args{
  1414  				i: 0,
  1415  				j: 5,
  1416  				e: []int{4, 5},
  1417  			},
  1418  			want: []int{0, 1, 2, 3},
  1419  		},
  1420  		{
  1421  			name: "",
  1422  			fields: fields{
  1423  				e: []int{0, 1, 2, 3},
  1424  			},
  1425  			args: args{
  1426  				i: 4,
  1427  				j: 1,
  1428  				e: []int{4, 5},
  1429  			},
  1430  			want: []int{0, 1, 2, 3},
  1431  		},
  1432  		{
  1433  			name: "",
  1434  			fields: fields{
  1435  				e: []int{0, 1, 2, 3},
  1436  			},
  1437  			args: args{
  1438  				i: 4,
  1439  				j: 4,
  1440  				e: []int{4, 5},
  1441  			},
  1442  			want: []int{0, 1, 2, 3, 4, 5},
  1443  		},
  1444  		{
  1445  			name: "",
  1446  			fields: fields{
  1447  				e: []int{0, 1, 2, 3},
  1448  			},
  1449  			args: args{
  1450  				i: 1,
  1451  				j: 3,
  1452  				e: []int{4, 5},
  1453  			},
  1454  			want: []int{0, 4, 5, 3},
  1455  		},
  1456  	}
  1457  	for _, tt := range tests {
  1458  		t.Run(tt.name, func(t *testing.T) {
  1459  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  1460  			x.Replace(tt.args.i, tt.args.j, tt.args.e...)
  1461  			assert.Equal(t, tt.want, x.ToMetaSlice())
  1462  		})
  1463  	}
  1464  }
  1465  
  1466  func TestUnsafeAnyBSlice_ReplaceE(t *testing.T) {
  1467  	type fields struct {
  1468  		e []int
  1469  	}
  1470  	type args struct {
  1471  		i int
  1472  		j int
  1473  		e []int
  1474  	}
  1475  	tests := []struct {
  1476  		name    string
  1477  		fields  fields
  1478  		args    args
  1479  		want    []int
  1480  		wanterr bool
  1481  	}{
  1482  		{
  1483  			name: "nil",
  1484  			fields: fields{
  1485  				e: nil,
  1486  			},
  1487  			args: args{
  1488  				i: 0,
  1489  				j: 0,
  1490  				e: nil,
  1491  			},
  1492  			want:    nil,
  1493  			wanterr: false,
  1494  		},
  1495  		{
  1496  			name: "",
  1497  			fields: fields{
  1498  				e: nil,
  1499  			},
  1500  			args: args{
  1501  				i: 0,
  1502  				j: 0,
  1503  				e: []int{4, 5},
  1504  			},
  1505  			want:    []int{4, 5},
  1506  			wanterr: false,
  1507  		},
  1508  		{
  1509  			name: "",
  1510  			fields: fields{
  1511  				e: nil,
  1512  			},
  1513  			args: args{
  1514  				i: 0,
  1515  				j: 1,
  1516  				e: []int{4, 5},
  1517  			},
  1518  			want:    nil,
  1519  			wanterr: true,
  1520  		},
  1521  		{
  1522  			name: "",
  1523  			fields: fields{
  1524  				e: []int{},
  1525  			},
  1526  			args: args{
  1527  				i: 0,
  1528  				j: 1,
  1529  				e: []int{4, 5},
  1530  			},
  1531  			want:    []int{},
  1532  			wanterr: true,
  1533  		},
  1534  		{
  1535  			name: "",
  1536  			fields: fields{
  1537  				e: []int{0, 1, 2, 3},
  1538  			},
  1539  			args: args{
  1540  				i: 0,
  1541  				j: 0,
  1542  				e: []int{4, 5},
  1543  			},
  1544  			want:    []int{4, 5, 0, 1, 2, 3},
  1545  			wanterr: false,
  1546  		},
  1547  		{
  1548  			name: "",
  1549  			fields: fields{
  1550  				e: []int{0, 1, 2, 3},
  1551  			},
  1552  			args: args{
  1553  				i: 0,
  1554  				j: 4,
  1555  				e: []int{4, 5},
  1556  			},
  1557  			want:    []int{4, 5},
  1558  			wanterr: false,
  1559  		},
  1560  		{
  1561  			name: "",
  1562  			fields: fields{
  1563  				e: []int{0, 1, 2, 3},
  1564  			},
  1565  			args: args{
  1566  				i: 0,
  1567  				j: 5,
  1568  				e: []int{4, 5},
  1569  			},
  1570  			want:    []int{0, 1, 2, 3},
  1571  			wanterr: true,
  1572  		},
  1573  		{
  1574  			name: "",
  1575  			fields: fields{
  1576  				e: []int{0, 1, 2, 3},
  1577  			},
  1578  			args: args{
  1579  				i: 4,
  1580  				j: 1,
  1581  				e: []int{4, 5},
  1582  			},
  1583  			want:    []int{0, 1, 2, 3},
  1584  			wanterr: true,
  1585  		},
  1586  		{
  1587  			name: "",
  1588  			fields: fields{
  1589  				e: []int{0, 1, 2, 3},
  1590  			},
  1591  			args: args{
  1592  				i: 4,
  1593  				j: 4,
  1594  				e: []int{4, 5},
  1595  			},
  1596  			want:    []int{0, 1, 2, 3, 4, 5},
  1597  			wanterr: false,
  1598  		},
  1599  		{
  1600  			name: "",
  1601  			fields: fields{
  1602  				e: []int{0, 1, 2, 3},
  1603  			},
  1604  			args: args{
  1605  				i: 1,
  1606  				j: 3,
  1607  				e: []int{4, 5},
  1608  			},
  1609  			want:    []int{0, 4, 5, 3},
  1610  			wanterr: false,
  1611  		},
  1612  	}
  1613  	for _, tt := range tests {
  1614  		t.Run(tt.name, func(t *testing.T) {
  1615  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  1616  			err := x.ReplaceE(tt.args.i, tt.args.j, tt.args.e...)
  1617  			assert.Equal(t, tt.wanterr, err != nil)
  1618  			assert.Equal(t, tt.want, x.ToMetaSlice())
  1619  		})
  1620  	}
  1621  }
  1622  
  1623  func TestUnsafeAnyBSlice_CloneToSlice(t *testing.T) {
  1624  	type fields struct {
  1625  		e []int
  1626  	}
  1627  	tests := []struct {
  1628  		name   string
  1629  		fields fields
  1630  		want   []int
  1631  	}{
  1632  		{
  1633  			name: "nil",
  1634  			fields: fields{
  1635  				e: nil,
  1636  			},
  1637  			want: nil,
  1638  		},
  1639  		{
  1640  			name: "",
  1641  			fields: fields{
  1642  				e: []int{},
  1643  			},
  1644  			want: []int{},
  1645  		},
  1646  		{
  1647  			name: "",
  1648  			fields: fields{
  1649  				e: []int{1, 2, 3},
  1650  			},
  1651  			want: []int{1, 2, 3},
  1652  		},
  1653  	}
  1654  	for _, tt := range tests {
  1655  		t.Run(tt.name, func(t *testing.T) {
  1656  			x := NewUnsafeComparableBSliceBySlice(tt.fields.e)
  1657  			assert.Equalf(t, tt.want, x.CloneToSlice(), "CloneToSlice()")
  1658  		})
  1659  	}
  1660  }
  1661  
  1662  func TestUnsafeAnyBSlice_CloneToBSlice(t *testing.T) {
  1663  	type fields struct {
  1664  		e []int
  1665  	}
  1666  	tests := []struct {
  1667  		name   string
  1668  		fields fields
  1669  		want   []int
  1670  	}{
  1671  		{
  1672  			name: "nil",
  1673  			fields: fields{
  1674  				e: nil,
  1675  			},
  1676  			want: nil,
  1677  		},
  1678  		{
  1679  			name: "",
  1680  			fields: fields{
  1681  				e: []int{},
  1682  			},
  1683  			want: []int{},
  1684  		},
  1685  		{
  1686  			name: "",
  1687  			fields: fields{
  1688  				e: []int{1, 2, 3},
  1689  			},
  1690  			want: []int{1, 2, 3},
  1691  		},
  1692  	}
  1693  	for _, tt := range tests {
  1694  		t.Run(tt.name, func(t *testing.T) {
  1695  			x := NewUnsafeComparableBSliceBySlice(tt.fields.e)
  1696  			assert.Equalf(t, tt.want, x.CloneToBSlice().ToMetaSlice(), "CloneToSlice()")
  1697  		})
  1698  	}
  1699  }
  1700  
  1701  func TestUnsafeAnyBSlice_CompactFunc(t *testing.T) {
  1702  	type fields struct {
  1703  		e []int
  1704  	}
  1705  	type args struct {
  1706  		f func(int, int) bool
  1707  	}
  1708  	tests := []struct {
  1709  		name   string
  1710  		fields fields
  1711  		args   args
  1712  		want   []int
  1713  	}{
  1714  		{
  1715  			name: "nil",
  1716  			fields: fields{
  1717  				e: nil,
  1718  			},
  1719  			args: args{
  1720  				func(i int, i2 int) bool {
  1721  					return i == i2
  1722  				},
  1723  			},
  1724  			want: nil,
  1725  		},
  1726  		{
  1727  			name: "",
  1728  			fields: fields{
  1729  				e: []int{},
  1730  			},
  1731  			args: args{
  1732  				func(i int, i2 int) bool {
  1733  					return i == i2
  1734  				},
  1735  			},
  1736  			want: []int{},
  1737  		},
  1738  		{
  1739  			name: "",
  1740  			fields: fields{
  1741  				e: []int{1, 1, 2, 2, 3, 3, 3},
  1742  			},
  1743  			args: args{
  1744  				func(i int, i2 int) bool {
  1745  					return i == i2
  1746  				},
  1747  			},
  1748  			want: []int{1, 2, 3},
  1749  		},
  1750  	}
  1751  	for _, tt := range tests {
  1752  		t.Run(tt.name, func(t *testing.T) {
  1753  			x := NewUnsafeComparableBSliceBySlice(tt.fields.e)
  1754  			x.CompactFunc(tt.args.f)
  1755  			assert.Equal(t, tt.want, x.ToMetaSlice())
  1756  		})
  1757  	}
  1758  }
  1759  
  1760  func TestUnsafeAnyBSlice_Grow(t *testing.T) {
  1761  	type fields struct {
  1762  		e []int
  1763  	}
  1764  	type args struct {
  1765  		i int
  1766  	}
  1767  	tests := []struct {
  1768  		name   string
  1769  		fields fields
  1770  		args   args
  1771  		want   int
  1772  	}{
  1773  		{
  1774  			name: "nil",
  1775  			fields: fields{
  1776  				e: nil,
  1777  			},
  1778  			args: args{
  1779  				i: 0,
  1780  			},
  1781  			want: 0,
  1782  		},
  1783  		{
  1784  			name: "",
  1785  			fields: fields{
  1786  				e: []int{},
  1787  			},
  1788  			args: args{
  1789  				i: 0,
  1790  			},
  1791  			want: 0,
  1792  		},
  1793  		{
  1794  			name: "",
  1795  			fields: fields{
  1796  				e: []int{},
  1797  			},
  1798  			args: args{
  1799  				i: 10,
  1800  			},
  1801  			want: 10,
  1802  		},
  1803  		{
  1804  			name: "",
  1805  			fields: fields{
  1806  				e: nil,
  1807  			},
  1808  			args: args{
  1809  				i: 10,
  1810  			},
  1811  			want: 10,
  1812  		},
  1813  		{
  1814  			name: "",
  1815  			fields: fields{
  1816  				e: make([]int, 10),
  1817  			},
  1818  			args: args{
  1819  				i: 10,
  1820  			},
  1821  			want: 20,
  1822  		},
  1823  	}
  1824  	for _, tt := range tests {
  1825  		t.Run(tt.name, func(t *testing.T) {
  1826  			x := NewUnsafeComparableBSliceBySlice(tt.fields.e)
  1827  			x.Grow(tt.args.i)
  1828  			assert.Equal(t, tt.want, cap(x.ToMetaSlice()))
  1829  		})
  1830  	}
  1831  }
  1832  
  1833  func TestUnsafeAnyBSlice_Clip(t *testing.T) {
  1834  	type fields struct {
  1835  		e []int
  1836  	}
  1837  	tests := []struct {
  1838  		name   string
  1839  		fields fields
  1840  		want   int
  1841  	}{
  1842  		{
  1843  			name: "",
  1844  			fields: fields{
  1845  				e: nil,
  1846  			},
  1847  			want: 0,
  1848  		},
  1849  		{
  1850  			name: "",
  1851  			fields: fields{
  1852  				e: []int{},
  1853  			},
  1854  			want: 0,
  1855  		},
  1856  		{
  1857  			name: "",
  1858  			fields: fields{
  1859  				e: make([]int, 10, 20),
  1860  			},
  1861  			want: 10,
  1862  		},
  1863  	}
  1864  	for _, tt := range tests {
  1865  		t.Run(tt.name, func(t *testing.T) {
  1866  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  1867  			x.Clip()
  1868  		})
  1869  	}
  1870  }
  1871  
  1872  func TestUnsafeAnyBSlice_SortFunc(t *testing.T) {
  1873  	type fields struct {
  1874  		e []int
  1875  	}
  1876  
  1877  	tests := []struct {
  1878  		name   string
  1879  		fields fields
  1880  		want   []int
  1881  	}{
  1882  		{
  1883  			name: "nil",
  1884  			fields: fields{
  1885  				e: nil,
  1886  			},
  1887  			want: nil,
  1888  		},
  1889  		{
  1890  			name: "",
  1891  			fields: fields{
  1892  				e: []int{},
  1893  			},
  1894  			want: []int{},
  1895  		},
  1896  		{
  1897  			name: "",
  1898  			fields: fields{
  1899  				e: []int{1, 2, 3},
  1900  			},
  1901  			want: []int{1, 2, 3},
  1902  		},
  1903  		{
  1904  			name: "",
  1905  			fields: fields{
  1906  				e: []int{2, 1, 3},
  1907  			},
  1908  			want: []int{1, 2, 3},
  1909  		},
  1910  	}
  1911  	for _, tt := range tests {
  1912  		t.Run(tt.name, func(t *testing.T) {
  1913  			x := NewUnsafeComparableBSliceBySlice(tt.fields.e)
  1914  			x.SortFunc(func(i int, j int) bool {
  1915  				return i < j
  1916  			})
  1917  			assert.Equal(t, tt.want, x.ToMetaSlice())
  1918  		})
  1919  	}
  1920  }
  1921  
  1922  func TestUnsafeAnyBSlice_SortFuncToSlice(t *testing.T) {
  1923  	type fields struct {
  1924  		e []int
  1925  	}
  1926  
  1927  	tests := []struct {
  1928  		name   string
  1929  		fields fields
  1930  		want   []int
  1931  	}{
  1932  		{
  1933  			name: "nil",
  1934  			fields: fields{
  1935  				e: nil,
  1936  			},
  1937  			want: []int{},
  1938  		},
  1939  		{
  1940  			name: "",
  1941  			fields: fields{
  1942  				e: []int{},
  1943  			},
  1944  			want: []int{},
  1945  		},
  1946  		{
  1947  			name: "",
  1948  			fields: fields{
  1949  				e: []int{1, 2, 3},
  1950  			},
  1951  			want: []int{1, 2, 3},
  1952  		},
  1953  		{
  1954  			name: "",
  1955  			fields: fields{
  1956  				e: []int{2, 1, 3},
  1957  			},
  1958  			want: []int{1, 2, 3},
  1959  		},
  1960  	}
  1961  	for _, tt := range tests {
  1962  		t.Run(tt.name, func(t *testing.T) {
  1963  			x := NewUnsafeComparableBSliceBySlice(tt.fields.e)
  1964  			v := x.SortFuncToSlice(func(i int, j int) bool {
  1965  				return i < j
  1966  			})
  1967  			assert.Equal(t, tt.want, v)
  1968  		})
  1969  	}
  1970  }
  1971  
  1972  func TestUnsafeAnyBSlice_SortFuncToBSlice(t *testing.T) {
  1973  	type fields struct {
  1974  		e []int
  1975  	}
  1976  
  1977  	tests := []struct {
  1978  		name   string
  1979  		fields fields
  1980  		want   []int
  1981  	}{
  1982  		{
  1983  			name: "nil",
  1984  			fields: fields{
  1985  				e: nil,
  1986  			},
  1987  			want: []int{},
  1988  		},
  1989  		{
  1990  			name: "",
  1991  			fields: fields{
  1992  				e: []int{},
  1993  			},
  1994  			want: []int{},
  1995  		},
  1996  		{
  1997  			name: "",
  1998  			fields: fields{
  1999  				e: []int{1, 2, 3},
  2000  			},
  2001  			want: []int{1, 2, 3},
  2002  		},
  2003  		{
  2004  			name: "",
  2005  			fields: fields{
  2006  				e: []int{2, 1, 3},
  2007  			},
  2008  			want: []int{1, 2, 3},
  2009  		},
  2010  	}
  2011  	for _, tt := range tests {
  2012  		t.Run(tt.name, func(t *testing.T) {
  2013  			x := NewUnsafeComparableBSliceBySlice(tt.fields.e)
  2014  			v := x.SortFuncToBSlice(func(i int, j int) bool {
  2015  				return i < j
  2016  			})
  2017  			assert.Equal(t, tt.want, v.ToMetaSlice())
  2018  		})
  2019  	}
  2020  }
  2021  
  2022  func TestUnsafeAnyBSlice_SortStableFunc(t *testing.T) {
  2023  	type fields struct {
  2024  		e []int
  2025  	}
  2026  
  2027  	tests := []struct {
  2028  		name   string
  2029  		fields fields
  2030  		want   []int
  2031  	}{
  2032  		{
  2033  			name: "nil",
  2034  			fields: fields{
  2035  				e: nil,
  2036  			},
  2037  			want: nil,
  2038  		},
  2039  		{
  2040  			name: "",
  2041  			fields: fields{
  2042  				e: []int{},
  2043  			},
  2044  			want: []int{},
  2045  		},
  2046  		{
  2047  			name: "",
  2048  			fields: fields{
  2049  				e: []int{1, 2, 3},
  2050  			},
  2051  			want: []int{1, 2, 3},
  2052  		},
  2053  		{
  2054  			name: "",
  2055  			fields: fields{
  2056  				e: []int{2, 1, 3},
  2057  			},
  2058  			want: []int{1, 2, 3},
  2059  		},
  2060  	}
  2061  	for _, tt := range tests {
  2062  		t.Run(tt.name, func(t *testing.T) {
  2063  			x := NewUnsafeComparableBSliceBySlice(tt.fields.e)
  2064  			x.SortStableFunc(func(i int, j int) bool {
  2065  				return i < j
  2066  			})
  2067  			assert.Equal(t, tt.want, x.ToMetaSlice())
  2068  		})
  2069  	}
  2070  }
  2071  
  2072  func TestUnsafeAnyBSlice_SortStableFuncToSlice(t *testing.T) {
  2073  	type fields struct {
  2074  		e []int
  2075  	}
  2076  
  2077  	tests := []struct {
  2078  		name   string
  2079  		fields fields
  2080  		want   []int
  2081  	}{
  2082  		{
  2083  			name: "nil",
  2084  			fields: fields{
  2085  				e: nil,
  2086  			},
  2087  			want: []int{},
  2088  		},
  2089  		{
  2090  			name: "",
  2091  			fields: fields{
  2092  				e: []int{},
  2093  			},
  2094  			want: []int{},
  2095  		},
  2096  		{
  2097  			name: "",
  2098  			fields: fields{
  2099  				e: []int{1, 2, 3},
  2100  			},
  2101  			want: []int{1, 2, 3},
  2102  		},
  2103  		{
  2104  			name: "",
  2105  			fields: fields{
  2106  				e: []int{2, 1, 3},
  2107  			},
  2108  			want: []int{1, 2, 3},
  2109  		},
  2110  	}
  2111  	for _, tt := range tests {
  2112  		t.Run(tt.name, func(t *testing.T) {
  2113  			x := NewUnsafeComparableBSliceBySlice(tt.fields.e)
  2114  			v := x.SortStableFuncToSlice(func(i int, j int) bool {
  2115  				return i < j
  2116  			})
  2117  			assert.Equal(t, tt.want, v)
  2118  		})
  2119  	}
  2120  }
  2121  
  2122  func TestUnsafeAnyBSlice_SortStableFuncToBSlice(t *testing.T) {
  2123  	type fields struct {
  2124  		e []int
  2125  	}
  2126  
  2127  	tests := []struct {
  2128  		name   string
  2129  		fields fields
  2130  		want   []int
  2131  	}{
  2132  		{
  2133  			name: "nil",
  2134  			fields: fields{
  2135  				e: nil,
  2136  			},
  2137  			want: []int{},
  2138  		},
  2139  		{
  2140  			name: "",
  2141  			fields: fields{
  2142  				e: []int{},
  2143  			},
  2144  			want: []int{},
  2145  		},
  2146  		{
  2147  			name: "",
  2148  			fields: fields{
  2149  				e: []int{1, 2, 3},
  2150  			},
  2151  			want: []int{1, 2, 3},
  2152  		},
  2153  		{
  2154  			name: "",
  2155  			fields: fields{
  2156  				e: []int{2, 1, 3},
  2157  			},
  2158  			want: []int{1, 2, 3},
  2159  		},
  2160  	}
  2161  	for _, tt := range tests {
  2162  		t.Run(tt.name, func(t *testing.T) {
  2163  			x := NewUnsafeComparableBSliceBySlice(tt.fields.e)
  2164  			v := x.SortStableFuncToBSlice(func(i int, j int) bool {
  2165  				return i < j
  2166  			})
  2167  			assert.Equal(t, tt.want, v.ToMetaSlice())
  2168  		})
  2169  	}
  2170  }
  2171  
  2172  func TestUnsafeAnyBSlice_IsSortedFunc(t *testing.T) {
  2173  	type fields struct {
  2174  		e []int
  2175  	}
  2176  	tests := []struct {
  2177  		name   string
  2178  		fields fields
  2179  		want   bool
  2180  	}{
  2181  		{
  2182  			name: "",
  2183  			fields: fields{
  2184  				e: nil,
  2185  			},
  2186  			want: true,
  2187  		},
  2188  		{
  2189  			name: "",
  2190  			fields: fields{
  2191  				e: []int{},
  2192  			},
  2193  			want: true,
  2194  		},
  2195  		{
  2196  			name: "",
  2197  			fields: fields{
  2198  				e: []int{1, 1, 1},
  2199  			},
  2200  			want: true,
  2201  		},
  2202  		{
  2203  			name: "",
  2204  			fields: fields{
  2205  				e: []int{1, 2, 3},
  2206  			},
  2207  			want: true,
  2208  		},
  2209  		{
  2210  			name: "",
  2211  			fields: fields{
  2212  				e: []int{2, 1, 3},
  2213  			},
  2214  			want: false,
  2215  		},
  2216  		{
  2217  			name: "",
  2218  			fields: fields{
  2219  				e: []int{3, 2, 1},
  2220  			},
  2221  			want: false,
  2222  		},
  2223  	}
  2224  	for _, tt := range tests {
  2225  		t.Run(tt.name, func(t *testing.T) {
  2226  			x := NewUnsafeComparableBSliceBySlice(tt.fields.e)
  2227  			assert.Equalf(t, tt.want, x.IsSortedFunc(func(i, j int) bool {
  2228  				return i < j
  2229  			}), "IsSortedFunc()")
  2230  		})
  2231  	}
  2232  }
  2233  
  2234  func TestUnsafeAnyBSlice_BinarySearchFunc(t *testing.T) {
  2235  	type fields struct {
  2236  		e []int
  2237  	}
  2238  	type args struct {
  2239  		e int
  2240  	}
  2241  	tests := []struct {
  2242  		name   string
  2243  		fields fields
  2244  		args   args
  2245  		want   int
  2246  		want1  bool
  2247  	}{
  2248  		{
  2249  			name: "nil",
  2250  			fields: fields{
  2251  				e: nil,
  2252  			},
  2253  			args: args{
  2254  				e: 0,
  2255  			},
  2256  			want:  0,
  2257  			want1: false,
  2258  		},
  2259  		{
  2260  			name: "",
  2261  			fields: fields{
  2262  				e: []int{},
  2263  			},
  2264  			args: args{
  2265  				e: 0,
  2266  			},
  2267  			want:  0,
  2268  			want1: false,
  2269  		},
  2270  		{
  2271  			name: "",
  2272  			fields: fields{
  2273  				e: []int{1, 3, 5},
  2274  			},
  2275  			args: args{
  2276  				e: 0,
  2277  			},
  2278  			want:  0,
  2279  			want1: false,
  2280  		},
  2281  		{
  2282  			name: "",
  2283  			fields: fields{
  2284  				e: []int{1, 3, 5},
  2285  			},
  2286  			args: args{
  2287  				e: 1,
  2288  			},
  2289  			want:  0,
  2290  			want1: true,
  2291  		},
  2292  		{
  2293  			name: "",
  2294  			fields: fields{
  2295  				e: []int{1, 3, 5},
  2296  			},
  2297  			args: args{
  2298  				e: 2,
  2299  			},
  2300  			want:  1,
  2301  			want1: false,
  2302  		},
  2303  		{
  2304  			name: "",
  2305  			fields: fields{
  2306  				e: []int{1, 3, 5},
  2307  			},
  2308  			args: args{
  2309  				e: 3,
  2310  			},
  2311  			want:  1,
  2312  			want1: true,
  2313  		},
  2314  		{
  2315  			name: "",
  2316  			fields: fields{
  2317  				e: []int{1, 3, 5},
  2318  			},
  2319  			args: args{
  2320  				e: 4,
  2321  			},
  2322  			want:  2,
  2323  			want1: false,
  2324  		},
  2325  		{
  2326  			name: "",
  2327  			fields: fields{
  2328  				e: []int{1, 3, 5},
  2329  			},
  2330  			args: args{
  2331  				e: 5,
  2332  			},
  2333  			want:  2,
  2334  			want1: true,
  2335  		},
  2336  		{
  2337  			name: "",
  2338  			fields: fields{
  2339  				e: []int{1, 3, 5},
  2340  			},
  2341  			args: args{
  2342  				e: 6,
  2343  			},
  2344  			want:  3,
  2345  			want1: false,
  2346  		},
  2347  		{
  2348  			name: "",
  2349  			fields: fields{
  2350  				e: []int{1, 3, 5, 7},
  2351  			},
  2352  			args: args{
  2353  				e: 0,
  2354  			},
  2355  			want:  0,
  2356  			want1: false,
  2357  		},
  2358  		{
  2359  			name: "",
  2360  			fields: fields{
  2361  				e: []int{1, 3, 5, 7},
  2362  			},
  2363  			args: args{
  2364  				e: 1,
  2365  			},
  2366  			want:  0,
  2367  			want1: true,
  2368  		},
  2369  		{
  2370  			name: "",
  2371  			fields: fields{
  2372  				e: []int{1, 3, 5, 7},
  2373  			},
  2374  			args: args{
  2375  				e: 2,
  2376  			},
  2377  			want:  1,
  2378  			want1: false,
  2379  		},
  2380  		{
  2381  			name: "",
  2382  			fields: fields{
  2383  				e: []int{1, 3, 5, 7},
  2384  			},
  2385  			args: args{
  2386  				e: 3,
  2387  			},
  2388  			want:  1,
  2389  			want1: true,
  2390  		},
  2391  		{
  2392  			name: "",
  2393  			fields: fields{
  2394  				e: []int{1, 3, 5, 7},
  2395  			},
  2396  			args: args{
  2397  				e: 4,
  2398  			},
  2399  			want:  2,
  2400  			want1: false,
  2401  		},
  2402  		{
  2403  			name: "",
  2404  			fields: fields{
  2405  				e: []int{1, 3, 5, 7},
  2406  			},
  2407  			args: args{
  2408  				e: 5,
  2409  			},
  2410  			want:  2,
  2411  			want1: true,
  2412  		},
  2413  		{
  2414  			name: "",
  2415  			fields: fields{
  2416  				e: []int{1, 3, 5, 7},
  2417  			},
  2418  			args: args{
  2419  				e: 6,
  2420  			},
  2421  			want:  3,
  2422  			want1: false,
  2423  		},
  2424  		{
  2425  			name: "",
  2426  			fields: fields{
  2427  				e: []int{1, 3, 5, 7},
  2428  			},
  2429  			args: args{
  2430  				e: 7,
  2431  			},
  2432  			want:  3,
  2433  			want1: true,
  2434  		},
  2435  		{
  2436  			name: "",
  2437  			fields: fields{
  2438  				e: []int{1, 3, 5, 7},
  2439  			},
  2440  			args: args{
  2441  				e: 8,
  2442  			},
  2443  			want:  4,
  2444  			want1: false,
  2445  		},
  2446  	}
  2447  	for _, tt := range tests {
  2448  		t.Run(tt.name, func(t *testing.T) {
  2449  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  2450  			got, got1 := x.BinarySearchFunc(tt.args.e, bcomparator.IntComparator())
  2451  			assert.Equalf(t, tt.want, got, "BinarySearchFunc(%v, %v)", tt.args.e, bcomparator.IntComparator())
  2452  			assert.Equalf(t, tt.want1, got1, "BinarySearchFunc(%v, %v)", tt.args.e, bcomparator.IntComparator())
  2453  		})
  2454  	}
  2455  }
  2456  
  2457  func TestUnsafeAnyBSlice_Filter(t *testing.T) {
  2458  	type fields struct {
  2459  		e []int
  2460  	}
  2461  	type args struct {
  2462  		f func(int2 int) bool
  2463  	}
  2464  	tests := []struct {
  2465  		name   string
  2466  		fields fields
  2467  		args   args
  2468  		want   []int
  2469  	}{
  2470  		{
  2471  			name: "nil",
  2472  			fields: fields{
  2473  				e: nil,
  2474  			},
  2475  			args: args{
  2476  				f: func(int2 int) bool {
  2477  					return true
  2478  				},
  2479  			},
  2480  			want: nil,
  2481  		},
  2482  		{
  2483  			name: "",
  2484  			fields: fields{
  2485  				e: []int{0, 1, 2, 3, 4},
  2486  			},
  2487  			args: args{
  2488  				f: func(int2 int) bool {
  2489  					return true
  2490  				},
  2491  			},
  2492  			want: []int{0, 1, 2, 3, 4},
  2493  		},
  2494  		{
  2495  			name: "",
  2496  			fields: fields{
  2497  				e: []int{0, 1, 2, 3, 4},
  2498  			},
  2499  			args: args{
  2500  				f: func(i int) bool {
  2501  					return i%2 == 0
  2502  				},
  2503  			},
  2504  			want: []int{0, 2, 4},
  2505  		},
  2506  		{
  2507  			name: "",
  2508  			fields: fields{
  2509  				e: []int{0, 1, 2, 3, 4},
  2510  			},
  2511  			args: args{
  2512  				f: func(i int) bool {
  2513  					return i%2 != 0
  2514  				},
  2515  			},
  2516  			want: []int{1, 3},
  2517  		},
  2518  		{
  2519  			name: "",
  2520  			fields: fields{
  2521  				e: []int{0, 1, 2, 3, 4},
  2522  			},
  2523  			args: args{
  2524  				f: func(i int) bool {
  2525  					return false
  2526  				},
  2527  			},
  2528  			want: nil,
  2529  		},
  2530  	}
  2531  	for _, tt := range tests {
  2532  		t.Run(tt.name, func(t *testing.T) {
  2533  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  2534  			x.Filter(tt.args.f)
  2535  			assert.Equalf(t, tt.want, x.ToMetaSlice(), "Filter(%v)", tt.args.f)
  2536  		})
  2537  	}
  2538  }
  2539  
  2540  func TestUnsafeAnyBSlice_FilterToSlice(t *testing.T) {
  2541  	type fields struct {
  2542  		e []int
  2543  	}
  2544  	type args struct {
  2545  		f func(int2 int) bool
  2546  	}
  2547  	tests := []struct {
  2548  		name   string
  2549  		fields fields
  2550  		args   args
  2551  		want   []int
  2552  	}{
  2553  		{
  2554  			name: "nil",
  2555  			fields: fields{
  2556  				e: nil,
  2557  			},
  2558  			args: args{
  2559  				f: func(int2 int) bool {
  2560  					return true
  2561  				},
  2562  			},
  2563  			want: nil,
  2564  		},
  2565  		{
  2566  			name: "",
  2567  			fields: fields{
  2568  				e: []int{0, 1, 2, 3, 4},
  2569  			},
  2570  			args: args{
  2571  				f: func(int2 int) bool {
  2572  					return true
  2573  				},
  2574  			},
  2575  			want: []int{0, 1, 2, 3, 4},
  2576  		},
  2577  		{
  2578  			name: "",
  2579  			fields: fields{
  2580  				e: []int{0, 1, 2, 3, 4},
  2581  			},
  2582  			args: args{
  2583  				f: func(i int) bool {
  2584  					return i%2 == 0
  2585  				},
  2586  			},
  2587  			want: []int{0, 2, 4},
  2588  		},
  2589  		{
  2590  			name: "",
  2591  			fields: fields{
  2592  				e: []int{0, 1, 2, 3, 4},
  2593  			},
  2594  			args: args{
  2595  				f: func(i int) bool {
  2596  					return i%2 != 0
  2597  				},
  2598  			},
  2599  			want: []int{1, 3},
  2600  		},
  2601  		{
  2602  			name: "",
  2603  			fields: fields{
  2604  				e: []int{0, 1, 2, 3, 4},
  2605  			},
  2606  			args: args{
  2607  				f: func(i int) bool {
  2608  					return false
  2609  				},
  2610  			},
  2611  			want: nil,
  2612  		},
  2613  	}
  2614  	for _, tt := range tests {
  2615  		t.Run(tt.name, func(t *testing.T) {
  2616  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  2617  			assert.Equalf(t, tt.want, x.FilterToSlice(tt.args.f), "FilterToSlice(%v)", tt.args.f)
  2618  		})
  2619  	}
  2620  }
  2621  
  2622  func TestUnsafeAnyBSlice_FilterToBSlice(t *testing.T) {
  2623  	type fields struct {
  2624  		e []int
  2625  	}
  2626  	type args struct {
  2627  		f func(int2 int) bool
  2628  	}
  2629  	tests := []struct {
  2630  		name   string
  2631  		fields fields
  2632  		args   args
  2633  		want   []int
  2634  	}{
  2635  		{
  2636  			name: "nil",
  2637  			fields: fields{
  2638  				e: nil,
  2639  			},
  2640  			args: args{
  2641  				f: func(int2 int) bool {
  2642  					return true
  2643  				},
  2644  			},
  2645  			want: nil,
  2646  		},
  2647  		{
  2648  			name: "",
  2649  			fields: fields{
  2650  				e: []int{0, 1, 2, 3, 4},
  2651  			},
  2652  			args: args{
  2653  				f: func(int2 int) bool {
  2654  					return true
  2655  				},
  2656  			},
  2657  			want: []int{0, 1, 2, 3, 4},
  2658  		},
  2659  		{
  2660  			name: "",
  2661  			fields: fields{
  2662  				e: []int{0, 1, 2, 3, 4},
  2663  			},
  2664  			args: args{
  2665  				f: func(i int) bool {
  2666  					return i%2 == 0
  2667  				},
  2668  			},
  2669  			want: []int{0, 2, 4},
  2670  		},
  2671  		{
  2672  			name: "",
  2673  			fields: fields{
  2674  				e: []int{0, 1, 2, 3, 4},
  2675  			},
  2676  			args: args{
  2677  				f: func(i int) bool {
  2678  					return i%2 != 0
  2679  				},
  2680  			},
  2681  			want: []int{1, 3},
  2682  		},
  2683  		{
  2684  			name: "",
  2685  			fields: fields{
  2686  				e: []int{0, 1, 2, 3, 4},
  2687  			},
  2688  			args: args{
  2689  				f: func(i int) bool {
  2690  					return false
  2691  				},
  2692  			},
  2693  			want: nil,
  2694  		},
  2695  	}
  2696  	for _, tt := range tests {
  2697  		t.Run(tt.name, func(t *testing.T) {
  2698  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  2699  			assert.Equalf(t, tt.want, x.FilterToBSlice(tt.args.f).ToMetaSlice(), "FilterToBSlice(%v)", tt.args.f)
  2700  		})
  2701  	}
  2702  }
  2703  
  2704  func TestUnsafeAnyBSlice_Reverse(t *testing.T) {
  2705  	type fields struct {
  2706  		e []int
  2707  	}
  2708  	tests := []struct {
  2709  		name   string
  2710  		fields fields
  2711  		want   []int
  2712  	}{
  2713  		{
  2714  			name: "nil",
  2715  			fields: fields{
  2716  				e: nil,
  2717  			},
  2718  			want: nil,
  2719  		},
  2720  		{
  2721  			name: "",
  2722  			fields: fields{
  2723  				e: []int{},
  2724  			},
  2725  			want: []int{},
  2726  		},
  2727  		{
  2728  			name: "",
  2729  			fields: fields{
  2730  				e: []int{1},
  2731  			},
  2732  			want: []int{1},
  2733  		},
  2734  		{
  2735  			name: "",
  2736  			fields: fields{
  2737  				e: []int{1, 2, 3},
  2738  			},
  2739  			want: []int{3, 2, 1},
  2740  		},
  2741  		{
  2742  			name: "",
  2743  			fields: fields{
  2744  				e: []int{1, 2, 3, 4},
  2745  			},
  2746  			want: []int{4, 3, 2, 1},
  2747  		},
  2748  	}
  2749  	for _, tt := range tests {
  2750  		t.Run(tt.name, func(t *testing.T) {
  2751  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  2752  			x.Reverse()
  2753  			assert.Equalf(t, tt.want, x.ToMetaSlice(), "Reverse()")
  2754  		})
  2755  	}
  2756  }
  2757  
  2758  func TestUnsafeAnyBSlice_ReverseToSlice(t *testing.T) {
  2759  	type fields struct {
  2760  		e []int
  2761  	}
  2762  	tests := []struct {
  2763  		name   string
  2764  		fields fields
  2765  		want   []int
  2766  	}{
  2767  		{
  2768  			name: "nil",
  2769  			fields: fields{
  2770  				e: nil,
  2771  			},
  2772  			want: []int{},
  2773  		},
  2774  		{
  2775  			name: "",
  2776  			fields: fields{
  2777  				e: []int{},
  2778  			},
  2779  			want: []int{},
  2780  		},
  2781  		{
  2782  			name: "",
  2783  			fields: fields{
  2784  				e: []int{1},
  2785  			},
  2786  			want: []int{1},
  2787  		},
  2788  		{
  2789  			name: "",
  2790  			fields: fields{
  2791  				e: []int{1, 2, 3},
  2792  			},
  2793  			want: []int{3, 2, 1},
  2794  		},
  2795  		{
  2796  			name: "",
  2797  			fields: fields{
  2798  				e: []int{1, 2, 3, 4},
  2799  			},
  2800  			want: []int{4, 3, 2, 1},
  2801  		},
  2802  	}
  2803  	for _, tt := range tests {
  2804  		t.Run(tt.name, func(t *testing.T) {
  2805  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  2806  			assert.Equalf(t, tt.want, x.ReverseToSlice(), "ReverseToSlice()")
  2807  		})
  2808  	}
  2809  }
  2810  
  2811  func TestUnsafeAnyBSlice_ReverseToBSlice(t *testing.T) {
  2812  	type fields struct {
  2813  		e []int
  2814  	}
  2815  	tests := []struct {
  2816  		name   string
  2817  		fields fields
  2818  		want   []int
  2819  	}{
  2820  		{
  2821  			name: "nil",
  2822  			fields: fields{
  2823  				e: nil,
  2824  			},
  2825  			want: []int{},
  2826  		},
  2827  		{
  2828  			name: "",
  2829  			fields: fields{
  2830  				e: []int{},
  2831  			},
  2832  			want: []int{},
  2833  		},
  2834  		{
  2835  			name: "",
  2836  			fields: fields{
  2837  				e: []int{1},
  2838  			},
  2839  			want: []int{1},
  2840  		},
  2841  		{
  2842  			name: "",
  2843  			fields: fields{
  2844  				e: []int{1, 2, 3},
  2845  			},
  2846  			want: []int{3, 2, 1},
  2847  		},
  2848  		{
  2849  			name: "",
  2850  			fields: fields{
  2851  				e: []int{1, 2, 3, 4},
  2852  			},
  2853  			want: []int{4, 3, 2, 1},
  2854  		},
  2855  	}
  2856  	for _, tt := range tests {
  2857  		t.Run(tt.name, func(t *testing.T) {
  2858  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  2859  			assert.Equalf(t, tt.want, x.ReverseToBSlice().ToMetaSlice(), "ReverseToBSlice()")
  2860  		})
  2861  	}
  2862  }
  2863  
  2864  func TestUnsafeAnyBSlice_Marshal(t *testing.T) {
  2865  	type fields struct {
  2866  		e []int
  2867  	}
  2868  	tests := []struct {
  2869  		name   string
  2870  		fields fields
  2871  		want   []byte
  2872  	}{
  2873  		{
  2874  			name: "nil",
  2875  			fields: fields{
  2876  				e: nil,
  2877  			},
  2878  			want: []byte("[]"),
  2879  		},
  2880  		{
  2881  			name: "",
  2882  			fields: fields{
  2883  				e: []int{},
  2884  			},
  2885  			want: []byte("[]"),
  2886  		},
  2887  		{
  2888  			name: "",
  2889  			fields: fields{
  2890  				e: []int{1, 2, 3},
  2891  			},
  2892  			want: []byte("[1,2,3]"),
  2893  		},
  2894  	}
  2895  	for _, tt := range tests {
  2896  		t.Run(tt.name, func(t *testing.T) {
  2897  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  2898  			got, err := x.Marshal()
  2899  			assert.Equal(t, false, err != nil)
  2900  			assert.Equalf(t, tt.want, got, "Marshal()")
  2901  		})
  2902  	}
  2903  }
  2904  
  2905  func TestUnsafeAnyBSlice_Unmarshal(t *testing.T) {
  2906  	type fields struct {
  2907  		e []int
  2908  	}
  2909  	type args struct {
  2910  		data []byte
  2911  	}
  2912  	tests := []struct {
  2913  		name   string
  2914  		fields fields
  2915  		args   args
  2916  		want   []int
  2917  	}{
  2918  		{
  2919  			name:   "",
  2920  			fields: fields{},
  2921  			args: args{
  2922  				data: []byte("[]"),
  2923  			},
  2924  			want: []int{},
  2925  		},
  2926  		{
  2927  			name:   "",
  2928  			fields: fields{},
  2929  			args: args{
  2930  				data: []byte("[1,2,3]"),
  2931  			},
  2932  			want: []int{1, 2, 3},
  2933  		},
  2934  	}
  2935  	for _, tt := range tests {
  2936  		t.Run(tt.name, func(t *testing.T) {
  2937  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  2938  			err := x.Unmarshal(tt.args.data)
  2939  			assert.Equal(t, false, err != nil)
  2940  			assert.Equal(t, tt.want, x.ToMetaSlice())
  2941  
  2942  		})
  2943  	}
  2944  }
  2945  
  2946  func TestUnsafeAnyBSlice_Len(t *testing.T) {
  2947  	type fields struct {
  2948  		e []int
  2949  	}
  2950  	tests := []struct {
  2951  		name   string
  2952  		fields fields
  2953  		want   int
  2954  	}{
  2955  		{
  2956  			name: "nil",
  2957  			fields: fields{
  2958  				e: nil,
  2959  			},
  2960  			want: 0,
  2961  		},
  2962  		{
  2963  			name: "nil",
  2964  			fields: fields{
  2965  				e: []int{},
  2966  			},
  2967  			want: 0,
  2968  		},
  2969  		{
  2970  			name: "nil",
  2971  			fields: fields{
  2972  				e: make([]int, 0, 10),
  2973  			},
  2974  			want: 0,
  2975  		},
  2976  		{
  2977  			name: "nil",
  2978  			fields: fields{
  2979  				e: make([]int, 10),
  2980  			},
  2981  			want: 10,
  2982  		},
  2983  		{
  2984  			name: "nil",
  2985  			fields: fields{
  2986  				e: make([]int, 10, 20),
  2987  			},
  2988  			want: 10,
  2989  		},
  2990  	}
  2991  	for _, tt := range tests {
  2992  		t.Run(tt.name, func(t *testing.T) {
  2993  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  2994  			assert.Equalf(t, tt.want, x.Len(), "Len()")
  2995  		})
  2996  	}
  2997  }
  2998  
  2999  func TestUnsafeAnyBSlice_Cap(t *testing.T) {
  3000  	type fields struct {
  3001  		e []int
  3002  	}
  3003  	tests := []struct {
  3004  		name   string
  3005  		fields fields
  3006  		want   int
  3007  	}{
  3008  		{
  3009  			name: "nil",
  3010  			fields: fields{
  3011  				e: nil,
  3012  			},
  3013  			want: 0,
  3014  		},
  3015  		{
  3016  			name: "nil",
  3017  			fields: fields{
  3018  				e: []int{},
  3019  			},
  3020  			want: 0,
  3021  		},
  3022  		{
  3023  			name: "nil",
  3024  			fields: fields{
  3025  				e: make([]int, 0, 10),
  3026  			},
  3027  			want: 10,
  3028  		},
  3029  		{
  3030  			name: "nil",
  3031  			fields: fields{
  3032  				e: make([]int, 10),
  3033  			},
  3034  			want: 10,
  3035  		},
  3036  		{
  3037  			name: "nil",
  3038  			fields: fields{
  3039  				e: make([]int, 10, 20),
  3040  			},
  3041  			want: 20,
  3042  		},
  3043  	}
  3044  	for _, tt := range tests {
  3045  		t.Run(tt.name, func(t *testing.T) {
  3046  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  3047  			assert.Equalf(t, tt.want, x.Cap(), "Cap()")
  3048  		})
  3049  	}
  3050  }
  3051  
  3052  func TestUnsafeAnyBSlice_ToInterfaceSlice(t *testing.T) {
  3053  	type fields struct {
  3054  		e []int
  3055  	}
  3056  	tests := []struct {
  3057  		name   string
  3058  		fields fields
  3059  		want   []interface{}
  3060  	}{
  3061  		{
  3062  			name: "nil",
  3063  			fields: fields{
  3064  				e: nil,
  3065  			},
  3066  			want: []interface{}{},
  3067  		},
  3068  		{
  3069  			name: "nil",
  3070  			fields: fields{
  3071  				e: []int{},
  3072  			},
  3073  			want: []interface{}{},
  3074  		},
  3075  		{
  3076  			name: "nil",
  3077  			fields: fields{
  3078  				e: []int{1, 2, 3},
  3079  			},
  3080  			want: []interface{}{1, 2, 3},
  3081  		},
  3082  	}
  3083  	for _, tt := range tests {
  3084  		t.Run(tt.name, func(t *testing.T) {
  3085  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  3086  			assert.Equalf(t, tt.want, x.ToInterfaceSlice(), "ToInterfaceSlice()")
  3087  		})
  3088  	}
  3089  }
  3090  
  3091  func TestUnsafeAnyBSlice_Append(t *testing.T) {
  3092  	type fields struct {
  3093  		e []int
  3094  	}
  3095  	type args struct {
  3096  		es []int
  3097  	}
  3098  	tests := []struct {
  3099  		name   string
  3100  		fields fields
  3101  		args   args
  3102  		want   []int
  3103  	}{
  3104  		{
  3105  			name:   "",
  3106  			fields: fields{},
  3107  			args: args{
  3108  				es: nil,
  3109  			},
  3110  			want: nil,
  3111  		},
  3112  		{
  3113  			name: "",
  3114  			fields: fields{
  3115  				e: []int{},
  3116  			},
  3117  			args: args{
  3118  				es: nil,
  3119  			},
  3120  			want: []int{},
  3121  		},
  3122  		{
  3123  			name: "",
  3124  			fields: fields{
  3125  				e: nil,
  3126  			},
  3127  			args: args{
  3128  				es: []int{},
  3129  			},
  3130  			want: nil,
  3131  		},
  3132  		{
  3133  			name: "",
  3134  			fields: fields{
  3135  				e: nil,
  3136  			},
  3137  			args: args{
  3138  				es: []int{1, 2, 3},
  3139  			},
  3140  			want: []int{1, 2, 3},
  3141  		},
  3142  		{
  3143  			name: "",
  3144  			fields: fields{
  3145  				e: []int{1, 2, 3},
  3146  			},
  3147  			args: args{
  3148  				es: []int{4, 5, 6},
  3149  			},
  3150  			want: []int{1, 2, 3, 4, 5, 6},
  3151  		},
  3152  	}
  3153  	for _, tt := range tests {
  3154  		t.Run(tt.name, func(t *testing.T) {
  3155  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  3156  			x.Append(tt.args.es...)
  3157  			assert.Equalf(t, tt.want, x.ToMetaSlice(), "Append()")
  3158  		})
  3159  	}
  3160  }
  3161  
  3162  func TestUnsafeAnyBSlice_AppendToSlice(t *testing.T) {
  3163  	type fields struct {
  3164  		e []int
  3165  	}
  3166  	type args struct {
  3167  		es []int
  3168  	}
  3169  	tests := []struct {
  3170  		name   string
  3171  		fields fields
  3172  		args   args
  3173  		want   []int
  3174  	}{
  3175  		{
  3176  			name:   "",
  3177  			fields: fields{},
  3178  			args: args{
  3179  				es: nil,
  3180  			},
  3181  			want: []int{},
  3182  		},
  3183  		{
  3184  			name: "",
  3185  			fields: fields{
  3186  				e: []int{},
  3187  			},
  3188  			args: args{
  3189  				es: nil,
  3190  			},
  3191  			want: []int{},
  3192  		},
  3193  		{
  3194  			name: "",
  3195  			fields: fields{
  3196  				e: nil,
  3197  			},
  3198  			args: args{
  3199  				es: nil,
  3200  			},
  3201  			want: []int{},
  3202  		},
  3203  		{
  3204  			name: "",
  3205  			fields: fields{
  3206  				e: nil,
  3207  			},
  3208  			args: args{
  3209  				es: []int{1, 2, 3},
  3210  			},
  3211  			want: []int{1, 2, 3},
  3212  		},
  3213  		{
  3214  			name: "",
  3215  			fields: fields{
  3216  				e: []int{1, 2, 3},
  3217  			},
  3218  			args: args{
  3219  				es: []int{4, 5, 6},
  3220  			},
  3221  			want: []int{1, 2, 3, 4, 5, 6},
  3222  		},
  3223  	}
  3224  	for _, tt := range tests {
  3225  		t.Run(tt.name, func(t *testing.T) {
  3226  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  3227  			assert.Equalf(t, tt.want, x.AppendToSlice(tt.args.es...), "AppendToSlice()")
  3228  		})
  3229  	}
  3230  }
  3231  
  3232  func TestUnsafeAnyBSlice_AppendToBSlice(t *testing.T) {
  3233  	type fields struct {
  3234  		e []int
  3235  	}
  3236  	type args struct {
  3237  		es []int
  3238  	}
  3239  	tests := []struct {
  3240  		name   string
  3241  		fields fields
  3242  		args   args
  3243  		want   []int
  3244  	}{
  3245  		{
  3246  			name:   "",
  3247  			fields: fields{},
  3248  			args: args{
  3249  				es: nil,
  3250  			},
  3251  			want: []int{},
  3252  		},
  3253  		{
  3254  			name: "",
  3255  			fields: fields{
  3256  				e: []int{},
  3257  			},
  3258  			args: args{
  3259  				es: nil,
  3260  			},
  3261  			want: []int{},
  3262  		},
  3263  		{
  3264  			name: "",
  3265  			fields: fields{
  3266  				e: nil,
  3267  			},
  3268  			args: args{
  3269  				es: nil,
  3270  			},
  3271  			want: []int{},
  3272  		},
  3273  		{
  3274  			name: "",
  3275  			fields: fields{
  3276  				e: nil,
  3277  			},
  3278  			args: args{
  3279  				es: []int{1, 2, 3},
  3280  			},
  3281  			want: []int{1, 2, 3},
  3282  		},
  3283  		{
  3284  			name: "",
  3285  			fields: fields{
  3286  				e: []int{1, 2, 3},
  3287  			},
  3288  			args: args{
  3289  				es: []int{4, 5, 6},
  3290  			},
  3291  			want: []int{1, 2, 3, 4, 5, 6},
  3292  		},
  3293  	}
  3294  	for _, tt := range tests {
  3295  		t.Run(tt.name, func(t *testing.T) {
  3296  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  3297  			assert.Equalf(t, tt.want, x.AppendToBSlice(tt.args.es...).ToMetaSlice(), "AppendToBSlice()")
  3298  		})
  3299  	}
  3300  }
  3301  
  3302  func TestUnsafeAnyBSlice_CopyToSlice(t *testing.T) {
  3303  	type fields struct {
  3304  		e []int
  3305  	}
  3306  	tests := []struct {
  3307  		name   string
  3308  		fields fields
  3309  		want   []int
  3310  	}{
  3311  		{
  3312  			name:   "",
  3313  			fields: fields{},
  3314  
  3315  			want: []int{},
  3316  		},
  3317  		{
  3318  			name: "",
  3319  			fields: fields{
  3320  				e: []int{},
  3321  			},
  3322  			want: []int{},
  3323  		},
  3324  		{
  3325  			name: "",
  3326  			fields: fields{
  3327  				e: nil,
  3328  			},
  3329  			want: []int{},
  3330  		},
  3331  		{
  3332  			name: "",
  3333  			fields: fields{
  3334  				e: nil,
  3335  			},
  3336  			want: []int{},
  3337  		},
  3338  		{
  3339  			name: "",
  3340  			fields: fields{
  3341  				e: []int{1, 2, 3},
  3342  			},
  3343  			want: []int{1, 2, 3},
  3344  		},
  3345  	}
  3346  	for _, tt := range tests {
  3347  		t.Run(tt.name, func(t *testing.T) {
  3348  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  3349  			assert.Equalf(t, tt.want, x.CopyToSlice(), "CopyToSlice()")
  3350  		})
  3351  	}
  3352  }
  3353  
  3354  func TestUnsafeAnyBSlice_CopyToBSlice(t *testing.T) {
  3355  	type fields struct {
  3356  		e []int
  3357  	}
  3358  	tests := []struct {
  3359  		name   string
  3360  		fields fields
  3361  		want   []int
  3362  	}{
  3363  		{
  3364  			name:   "",
  3365  			fields: fields{},
  3366  
  3367  			want: []int{},
  3368  		},
  3369  		{
  3370  			name: "",
  3371  			fields: fields{
  3372  				e: []int{},
  3373  			},
  3374  			want: []int{},
  3375  		},
  3376  		{
  3377  			name: "",
  3378  			fields: fields{
  3379  				e: nil,
  3380  			},
  3381  			want: []int{},
  3382  		},
  3383  		{
  3384  			name: "",
  3385  			fields: fields{
  3386  				e: nil,
  3387  			},
  3388  			want: []int{},
  3389  		},
  3390  		{
  3391  			name: "",
  3392  			fields: fields{
  3393  				e: []int{1, 2, 3},
  3394  			},
  3395  			want: []int{1, 2, 3},
  3396  		},
  3397  	}
  3398  	for _, tt := range tests {
  3399  		t.Run(tt.name, func(t *testing.T) {
  3400  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  3401  			assert.Equalf(t, tt.want, x.CopyToBSlice().ToMetaSlice(), "CopyToBSlice()")
  3402  		})
  3403  	}
  3404  }
  3405  
  3406  func TestUnsafeAnyBSlice_GetByIndex(t *testing.T) {
  3407  	type fields struct {
  3408  		e []int
  3409  	}
  3410  	type args struct {
  3411  		index int
  3412  	}
  3413  	tests := []struct {
  3414  		name   string
  3415  		fields fields
  3416  		args   args
  3417  		want   int
  3418  	}{
  3419  		{
  3420  			name: "nil",
  3421  			fields: fields{
  3422  				e: nil,
  3423  			},
  3424  			args: args{
  3425  				index: 0,
  3426  			},
  3427  			want: 0,
  3428  		},
  3429  		{
  3430  			name: "nil",
  3431  			fields: fields{
  3432  				e: nil,
  3433  			},
  3434  			args: args{
  3435  				index: 1,
  3436  			},
  3437  			want: 0,
  3438  		},
  3439  		{
  3440  			name: "nil",
  3441  			fields: fields{
  3442  				e: nil,
  3443  			},
  3444  			args: args{
  3445  				index: -1,
  3446  			},
  3447  			want: 0,
  3448  		},
  3449  		{
  3450  			name: "",
  3451  			fields: fields{
  3452  				e: []int{1, 2, 3},
  3453  			},
  3454  			args: args{
  3455  				index: 0,
  3456  			},
  3457  			want: 1,
  3458  		},
  3459  		{
  3460  			name: "",
  3461  			fields: fields{
  3462  				e: []int{1, 2, 3},
  3463  			},
  3464  			args: args{
  3465  				index: 1,
  3466  			},
  3467  			want: 2,
  3468  		},
  3469  		{
  3470  			name: "",
  3471  			fields: fields{
  3472  				e: []int{1, 2, 3},
  3473  			},
  3474  			args: args{
  3475  				index: 2,
  3476  			},
  3477  			want: 3,
  3478  		},
  3479  		{
  3480  			name: "",
  3481  			fields: fields{
  3482  				e: []int{1, 2, 3},
  3483  			},
  3484  			args: args{
  3485  				index: 3,
  3486  			},
  3487  			want: 0,
  3488  		},
  3489  	}
  3490  	for _, tt := range tests {
  3491  		t.Run(tt.name, func(t *testing.T) {
  3492  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  3493  			assert.Equalf(t, tt.want, x.GetByIndex(tt.args.index), "GetByIndex(%v)", tt.args.index)
  3494  		})
  3495  	}
  3496  }
  3497  
  3498  func TestUnsafeAnyBSlice_GetByIndexE(t *testing.T) {
  3499  	type fields struct {
  3500  		e []int
  3501  	}
  3502  	type args struct {
  3503  		index int
  3504  	}
  3505  	tests := []struct {
  3506  		name    string
  3507  		fields  fields
  3508  		args    args
  3509  		want    int
  3510  		wanterr bool
  3511  	}{
  3512  		{
  3513  			name: "nil",
  3514  			fields: fields{
  3515  				e: nil,
  3516  			},
  3517  			args: args{
  3518  				index: 0,
  3519  			},
  3520  			want:    0,
  3521  			wanterr: true,
  3522  		},
  3523  		{
  3524  			name: "nil",
  3525  			fields: fields{
  3526  				e: nil,
  3527  			},
  3528  			args: args{
  3529  				index: 1,
  3530  			},
  3531  			want:    0,
  3532  			wanterr: true,
  3533  		},
  3534  		{
  3535  			name: "nil",
  3536  			fields: fields{
  3537  				e: nil,
  3538  			},
  3539  			args: args{
  3540  				index: -1,
  3541  			},
  3542  			want:    0,
  3543  			wanterr: true,
  3544  		},
  3545  		{
  3546  			name: "",
  3547  			fields: fields{
  3548  				e: []int{1, 2, 3},
  3549  			},
  3550  			args: args{
  3551  				index: 0,
  3552  			},
  3553  			want:    1,
  3554  			wanterr: false,
  3555  		},
  3556  		{
  3557  			name: "",
  3558  			fields: fields{
  3559  				e: []int{1, 2, 3},
  3560  			},
  3561  			args: args{
  3562  				index: 1,
  3563  			},
  3564  			want:    2,
  3565  			wanterr: false,
  3566  		},
  3567  		{
  3568  			name: "",
  3569  			fields: fields{
  3570  				e: []int{1, 2, 3},
  3571  			},
  3572  			args: args{
  3573  				index: 2,
  3574  			},
  3575  			want:    3,
  3576  			wanterr: false,
  3577  		},
  3578  		{
  3579  			name: "",
  3580  			fields: fields{
  3581  				e: []int{1, 2, 3},
  3582  			},
  3583  			args: args{
  3584  				index: 3,
  3585  			},
  3586  			want:    0,
  3587  			wanterr: true,
  3588  		},
  3589  	}
  3590  	for _, tt := range tests {
  3591  		t.Run(tt.name, func(t *testing.T) {
  3592  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  3593  			got, err := x.GetByIndexE(tt.args.index)
  3594  			assert.Equal(t, tt.wanterr, err != nil)
  3595  			assert.Equalf(t, tt.want, got, "GetByIndexE(%v)", tt.args.index)
  3596  		})
  3597  	}
  3598  }
  3599  
  3600  func TestUnsafeAnyBSlice_GetByIndexOrDefault(t *testing.T) {
  3601  	type fields struct {
  3602  		e []int
  3603  	}
  3604  	type args struct {
  3605  		index    int
  3606  		defaultE int
  3607  	}
  3608  	tests := []struct {
  3609  		name   string
  3610  		fields fields
  3611  		args   args
  3612  		want   int
  3613  	}{
  3614  		{
  3615  			name: "nil",
  3616  			fields: fields{
  3617  				e: nil,
  3618  			},
  3619  			args: args{
  3620  				index:    0,
  3621  				defaultE: 1,
  3622  			},
  3623  			want: 1,
  3624  		},
  3625  		{
  3626  			name: "nil",
  3627  			fields: fields{
  3628  				e: []int{},
  3629  			},
  3630  			args: args{
  3631  				index:    0,
  3632  				defaultE: 1,
  3633  			},
  3634  			want: 1,
  3635  		},
  3636  		{
  3637  			name: "nil",
  3638  			fields: fields{
  3639  				e: []int{1, 2, 3},
  3640  			},
  3641  			args: args{
  3642  				index:    0,
  3643  				defaultE: 2,
  3644  			},
  3645  			want: 1,
  3646  		},
  3647  	}
  3648  	for _, tt := range tests {
  3649  		t.Run(tt.name, func(t *testing.T) {
  3650  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  3651  			assert.Equalf(t, tt.want, x.GetByIndexOrDefault(tt.args.index, tt.args.defaultE), "GetByIndexOrDefault(%v, %v)", tt.args.index, tt.args.defaultE)
  3652  		})
  3653  	}
  3654  }
  3655  
  3656  func TestUnsafeAnyBSlice_GetByRange(t *testing.T) {
  3657  	type fields struct {
  3658  		e []int
  3659  	}
  3660  	type args struct {
  3661  		start int
  3662  		end   int
  3663  	}
  3664  	tests := []struct {
  3665  		name   string
  3666  		fields fields
  3667  		args   args
  3668  		want   []int
  3669  	}{
  3670  		{
  3671  			name: "nil",
  3672  			fields: fields{
  3673  				e: nil,
  3674  			},
  3675  			args: args{
  3676  				start: 0,
  3677  				end:   0,
  3678  			},
  3679  			want: nil,
  3680  		},
  3681  		{
  3682  			name: "",
  3683  			fields: fields{
  3684  				e: []int{},
  3685  			},
  3686  			args: args{
  3687  				start: 0,
  3688  				end:   0,
  3689  			},
  3690  			want: []int{},
  3691  		},
  3692  		{
  3693  			name: "",
  3694  			fields: fields{
  3695  				e: []int{1, 2, 3},
  3696  			},
  3697  			args: args{
  3698  				start: 0,
  3699  				end:   0,
  3700  			},
  3701  			want: []int{},
  3702  		},
  3703  		{
  3704  			name: "",
  3705  			fields: fields{
  3706  				e: []int{1, 2, 3},
  3707  			},
  3708  			args: args{
  3709  				start: 0,
  3710  				end:   3,
  3711  			},
  3712  			want: []int{1, 2, 3},
  3713  		},
  3714  		{
  3715  			name: "",
  3716  			fields: fields{
  3717  				e: []int{1, 2, 3},
  3718  			},
  3719  			args: args{
  3720  				start: 0,
  3721  				end:   4,
  3722  			},
  3723  			want: nil,
  3724  		},
  3725  	}
  3726  	for _, tt := range tests {
  3727  		t.Run(tt.name, func(t *testing.T) {
  3728  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  3729  			assert.Equalf(t, tt.want, x.GetByRange(tt.args.start, tt.args.end), "GetByRange(%v, %v)", tt.args.start, tt.args.end)
  3730  		})
  3731  	}
  3732  }
  3733  
  3734  func TestUnsafeAnyBSlice_GetByRangeE(t *testing.T) {
  3735  	type fields struct {
  3736  		e []int
  3737  	}
  3738  	type args struct {
  3739  		start int
  3740  		end   int
  3741  	}
  3742  	tests := []struct {
  3743  		name    string
  3744  		fields  fields
  3745  		args    args
  3746  		want    []int
  3747  		wanterr bool
  3748  	}{
  3749  		{
  3750  			name: "nil",
  3751  			fields: fields{
  3752  				e: nil,
  3753  			},
  3754  			args: args{
  3755  				start: 0,
  3756  				end:   0,
  3757  			},
  3758  			want:    nil,
  3759  			wanterr: false,
  3760  		},
  3761  		{
  3762  			name: "",
  3763  			fields: fields{
  3764  				e: []int{},
  3765  			},
  3766  			args: args{
  3767  				start: 0,
  3768  				end:   0,
  3769  			},
  3770  			want:    []int{},
  3771  			wanterr: false,
  3772  		},
  3773  		{
  3774  			name: "",
  3775  			fields: fields{
  3776  				e: []int{1, 2, 3},
  3777  			},
  3778  			args: args{
  3779  				start: 0,
  3780  				end:   0,
  3781  			},
  3782  			want:    []int{},
  3783  			wanterr: false,
  3784  		},
  3785  		{
  3786  			name: "",
  3787  			fields: fields{
  3788  				e: []int{1, 2, 3},
  3789  			},
  3790  			args: args{
  3791  				start: 0,
  3792  				end:   3,
  3793  			},
  3794  			want:    []int{1, 2, 3},
  3795  			wanterr: false,
  3796  		},
  3797  		{
  3798  			name: "",
  3799  			fields: fields{
  3800  				e: []int{1, 2, 3},
  3801  			},
  3802  			args: args{
  3803  				start: 0,
  3804  				end:   4,
  3805  			},
  3806  			want:    nil,
  3807  			wanterr: true,
  3808  		},
  3809  	}
  3810  	for _, tt := range tests {
  3811  		t.Run(tt.name, func(t *testing.T) {
  3812  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  3813  			got, err := x.GetByRangeE(tt.args.start, tt.args.end)
  3814  			assert.Equal(t, tt.wanterr, err != nil)
  3815  			assert.Equalf(t, tt.want, got, "GetByRangeE(%v, %v)", tt.args.start, tt.args.end)
  3816  		})
  3817  	}
  3818  }
  3819  
  3820  func TestUnsafeAnyBSlice_SetByIndex(t *testing.T) {
  3821  	type fields struct {
  3822  		e []int
  3823  	}
  3824  	type args struct {
  3825  		index int
  3826  		e     int
  3827  	}
  3828  	tests := []struct {
  3829  		name    string
  3830  		fields  fields
  3831  		args    args
  3832  		wanterr bool
  3833  	}{
  3834  		{
  3835  			name: "",
  3836  			fields: fields{
  3837  				e: nil,
  3838  			},
  3839  			args: args{
  3840  				index: 0,
  3841  				e:     1,
  3842  			},
  3843  			wanterr: true,
  3844  		},
  3845  		{
  3846  			name: "",
  3847  			fields: fields{
  3848  				e: []int{},
  3849  			},
  3850  			args: args{
  3851  				index: 0,
  3852  				e:     1,
  3853  			},
  3854  			wanterr: true,
  3855  		},
  3856  		{
  3857  			name: "",
  3858  			fields: fields{
  3859  				e: []int{1, 2, 3},
  3860  			},
  3861  			args: args{
  3862  				index: 0,
  3863  				e:     5,
  3864  			},
  3865  			wanterr: false,
  3866  		},
  3867  		{
  3868  			name: "",
  3869  			fields: fields{
  3870  				e: []int{1, 2, 3},
  3871  			},
  3872  			args: args{
  3873  				index: -1,
  3874  				e:     5,
  3875  			},
  3876  			wanterr: true,
  3877  		},
  3878  		{
  3879  			name: "",
  3880  			fields: fields{
  3881  				e: []int{1, 2, 3},
  3882  			},
  3883  			args: args{
  3884  				index: 1,
  3885  				e:     5,
  3886  			},
  3887  			wanterr: false,
  3888  		},
  3889  		{
  3890  			name: "",
  3891  			fields: fields{
  3892  				e: []int{1, 2, 3},
  3893  			},
  3894  			args: args{
  3895  				index: 2,
  3896  				e:     5,
  3897  			},
  3898  			wanterr: false,
  3899  		},
  3900  		{
  3901  			name: "",
  3902  			fields: fields{
  3903  				e: []int{1, 2, 3},
  3904  			},
  3905  			args: args{
  3906  				index: 3,
  3907  				e:     5,
  3908  			},
  3909  			wanterr: true,
  3910  		},
  3911  	}
  3912  	for _, tt := range tests {
  3913  		t.Run(tt.name, func(t *testing.T) {
  3914  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  3915  			x.SetByIndex(tt.args.index, tt.args.e)
  3916  			if !tt.wanterr {
  3917  				assert.Equalf(t, tt.args.e, x.GetByIndex(tt.args.index), "SetByIndex(%v, %v)", tt.args.index, tt.args.e)
  3918  			}
  3919  		})
  3920  	}
  3921  }
  3922  
  3923  func TestUnsafeAnyBSlice_SetByIndexE(t *testing.T) {
  3924  	type fields struct {
  3925  		e []int
  3926  	}
  3927  	type args struct {
  3928  		index int
  3929  		e     int
  3930  	}
  3931  	tests := []struct {
  3932  		name    string
  3933  		fields  fields
  3934  		args    args
  3935  		wanterr bool
  3936  	}{
  3937  		{
  3938  			name: "",
  3939  			fields: fields{
  3940  				e: nil,
  3941  			},
  3942  			args: args{
  3943  				index: 0,
  3944  				e:     1,
  3945  			},
  3946  			wanterr: true,
  3947  		},
  3948  		{
  3949  			name: "",
  3950  			fields: fields{
  3951  				e: []int{},
  3952  			},
  3953  			args: args{
  3954  				index: 0,
  3955  				e:     1,
  3956  			},
  3957  			wanterr: true,
  3958  		},
  3959  		{
  3960  			name: "",
  3961  			fields: fields{
  3962  				e: []int{1, 2, 3},
  3963  			},
  3964  			args: args{
  3965  				index: 0,
  3966  				e:     5,
  3967  			},
  3968  			wanterr: false,
  3969  		},
  3970  		{
  3971  			name: "",
  3972  			fields: fields{
  3973  				e: []int{1, 2, 3},
  3974  			},
  3975  			args: args{
  3976  				index: -1,
  3977  				e:     5,
  3978  			},
  3979  			wanterr: true,
  3980  		},
  3981  		{
  3982  			name: "",
  3983  			fields: fields{
  3984  				e: []int{1, 2, 3},
  3985  			},
  3986  			args: args{
  3987  				index: 1,
  3988  				e:     5,
  3989  			},
  3990  			wanterr: false,
  3991  		},
  3992  		{
  3993  			name: "",
  3994  			fields: fields{
  3995  				e: []int{1, 2, 3},
  3996  			},
  3997  			args: args{
  3998  				index: 2,
  3999  				e:     5,
  4000  			},
  4001  			wanterr: false,
  4002  		},
  4003  		{
  4004  			name: "",
  4005  			fields: fields{
  4006  				e: []int{1, 2, 3},
  4007  			},
  4008  			args: args{
  4009  				index: 3,
  4010  				e:     5,
  4011  			},
  4012  			wanterr: true,
  4013  		},
  4014  		{
  4015  			name: "",
  4016  			fields: fields{
  4017  				e: []int{1, 2, 3},
  4018  			},
  4019  			args: args{
  4020  				index: -1,
  4021  				e:     5,
  4022  			},
  4023  			wanterr: true,
  4024  		},
  4025  	}
  4026  	for _, tt := range tests {
  4027  		t.Run(tt.name, func(t *testing.T) {
  4028  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  4029  			err := x.SetByIndexE(tt.args.index, tt.args.e)
  4030  			assert.Equal(t, tt.wanterr, err != nil)
  4031  			if !tt.wanterr {
  4032  				assert.Equalf(t, tt.args.e, x.GetByIndex(tt.args.index), "SetByIndexE(%v, %v)", tt.args.index, tt.args.e)
  4033  			}
  4034  		})
  4035  	}
  4036  }
  4037  
  4038  func TestUnsafeAnyBSlice_SetByRange(t *testing.T) {
  4039  	type fields struct {
  4040  		e []int
  4041  	}
  4042  	type args struct {
  4043  		index int
  4044  		es    []int
  4045  	}
  4046  	tests := []struct {
  4047  		name    string
  4048  		fields  fields
  4049  		args    args
  4050  		want    []int
  4051  		wanterr bool
  4052  	}{
  4053  		{
  4054  			name: "",
  4055  			fields: fields{
  4056  				e: nil,
  4057  			},
  4058  			args: args{
  4059  				index: 0,
  4060  				es:    nil,
  4061  			},
  4062  			want:    nil,
  4063  			wanterr: false,
  4064  		},
  4065  		{
  4066  			name: "",
  4067  			fields: fields{
  4068  				e: nil,
  4069  			},
  4070  			args: args{
  4071  				index: 0,
  4072  				es:    []int{1, 2, 3},
  4073  			},
  4074  			want:    []int{1, 2, 3},
  4075  			wanterr: false,
  4076  		},
  4077  		{
  4078  			name: "",
  4079  			fields: fields{
  4080  				e: nil,
  4081  			},
  4082  			args: args{
  4083  				index: 2,
  4084  				es:    []int{1, 2, 3},
  4085  			},
  4086  			want:    []int{1, 2, 3},
  4087  			wanterr: false,
  4088  		},
  4089  		{
  4090  			name: "",
  4091  			fields: fields{
  4092  				e: []int{},
  4093  			},
  4094  			args: args{
  4095  				index: 2,
  4096  				es:    []int{1, 2, 3},
  4097  			},
  4098  			want:    []int{1, 2, 3},
  4099  			wanterr: false,
  4100  		},
  4101  		{
  4102  			name: "",
  4103  			fields: fields{
  4104  				e: []int{1, 2},
  4105  			},
  4106  			args: args{
  4107  				index: 2,
  4108  				es:    []int{3, 4, 5},
  4109  			},
  4110  			want:    []int{1, 2, 3, 4, 5},
  4111  			wanterr: false,
  4112  		},
  4113  		{
  4114  			name: "",
  4115  			fields: fields{
  4116  				e: []int{1, 2},
  4117  			},
  4118  			args: args{
  4119  				index: -1,
  4120  				es:    []int{3, 4, 5},
  4121  			},
  4122  			want:    []int{},
  4123  			wanterr: true,
  4124  		},
  4125  	}
  4126  	for _, tt := range tests {
  4127  		t.Run(tt.name, func(t *testing.T) {
  4128  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  4129  			err := x.SetByRangeE(tt.args.index, tt.args.es)
  4130  			assert.Equal(t, tt.wanterr, err != nil)
  4131  			if !tt.wanterr {
  4132  				assert.Equalf(t, tt.want, x.ToMetaSlice(), "SetByRange()")
  4133  			}
  4134  		})
  4135  	}
  4136  }
  4137  
  4138  func TestUnsafeAnyBSlice_SetByRangeE(t *testing.T) {
  4139  	type fields struct {
  4140  		e []int
  4141  	}
  4142  	type args struct {
  4143  		index int
  4144  		es    []int
  4145  	}
  4146  	tests := []struct {
  4147  		name    string
  4148  		fields  fields
  4149  		args    args
  4150  		want    []int
  4151  		wanterr bool
  4152  	}{
  4153  		{
  4154  			name: "",
  4155  			fields: fields{
  4156  				e: nil,
  4157  			},
  4158  			args: args{
  4159  				index: 0,
  4160  				es:    nil,
  4161  			},
  4162  			want:    nil,
  4163  			wanterr: false,
  4164  		},
  4165  		{
  4166  			name: "",
  4167  			fields: fields{
  4168  				e: nil,
  4169  			},
  4170  			args: args{
  4171  				index: 0,
  4172  				es:    []int{1, 2, 3},
  4173  			},
  4174  			want:    []int{1, 2, 3},
  4175  			wanterr: false,
  4176  		},
  4177  		{
  4178  			name: "",
  4179  			fields: fields{
  4180  				e: nil,
  4181  			},
  4182  			args: args{
  4183  				index: 2,
  4184  				es:    []int{1, 2, 3},
  4185  			},
  4186  			want:    []int{1, 2, 3},
  4187  			wanterr: false,
  4188  		},
  4189  		{
  4190  			name: "",
  4191  			fields: fields{
  4192  				e: []int{},
  4193  			},
  4194  			args: args{
  4195  				index: 2,
  4196  				es:    []int{1, 2, 3},
  4197  			},
  4198  			want:    []int{1, 2, 3},
  4199  			wanterr: false,
  4200  		},
  4201  		{
  4202  			name: "",
  4203  			fields: fields{
  4204  				e: []int{1, 2},
  4205  			},
  4206  			args: args{
  4207  				index: 2,
  4208  				es:    []int{3, 4, 5},
  4209  			},
  4210  			want:    []int{1, 2, 3, 4, 5},
  4211  			wanterr: false,
  4212  		},
  4213  		{
  4214  			name: "",
  4215  			fields: fields{
  4216  				e: []int{1, 2},
  4217  			},
  4218  			args: args{
  4219  				index: -1,
  4220  				es:    []int{3, 4, 5},
  4221  			},
  4222  			want:    []int{},
  4223  			wanterr: true,
  4224  		},
  4225  	}
  4226  	for _, tt := range tests {
  4227  		t.Run(tt.name, func(t *testing.T) {
  4228  			x := NewUnsafeAnyBSliceBySlice(tt.fields.e)
  4229  			err := x.SetByRangeE(tt.args.index, tt.args.es)
  4230  			assert.Equal(t, tt.wanterr, err != nil)
  4231  			if !tt.wanterr {
  4232  				assert.Equalf(t, tt.want, x.ToMetaSlice(), "SetByRangeE()")
  4233  			}
  4234  		})
  4235  	}
  4236  }
  4237  
  4238  func TestSafeAnyBSlice_EqualFunc(t *testing.T) {
  4239  	type fields struct {
  4240  		e []int
  4241  	}
  4242  	type args struct {
  4243  		es []int
  4244  		f  func(int, int) bool
  4245  	}
  4246  	tests := []struct {
  4247  		name   string
  4248  		fields fields
  4249  		args   args
  4250  		want   bool
  4251  	}{
  4252  		{
  4253  			name: "nil",
  4254  			fields: fields{
  4255  				e: nil,
  4256  			},
  4257  			args: args{
  4258  				es: nil,
  4259  				f:  nil,
  4260  			},
  4261  			want: true,
  4262  		},
  4263  		{
  4264  			name: "nil",
  4265  			fields: fields{
  4266  				e: []int{},
  4267  			},
  4268  			args: args{
  4269  				es: nil,
  4270  				f:  nil,
  4271  			},
  4272  			want: true,
  4273  		},
  4274  		{
  4275  			name: "nil",
  4276  			fields: fields{
  4277  				e: nil,
  4278  			},
  4279  			args: args{
  4280  				es: []int{},
  4281  				f:  nil,
  4282  			},
  4283  			want: true,
  4284  		},
  4285  		{
  4286  			name: "",
  4287  			fields: fields{
  4288  				e: []int{1, 2, 3},
  4289  			},
  4290  			args: args{
  4291  				es: []int{1, 2, 3},
  4292  				f:  nil,
  4293  			},
  4294  			want: true,
  4295  		},
  4296  		{
  4297  			name: "",
  4298  			fields: fields{
  4299  				e: []int{1, 1, 1},
  4300  			},
  4301  			args: args{
  4302  				es: []int{2, 2, 2},
  4303  				f: func(i int, i2 int) bool {
  4304  					return true
  4305  				},
  4306  			},
  4307  			want: true,
  4308  		},
  4309  		{
  4310  			name: "",
  4311  			fields: fields{
  4312  				e: []int{1, 1, 1},
  4313  			},
  4314  			args: args{
  4315  				es: []int{2, 2, 2},
  4316  				f: func(i int, i2 int) bool {
  4317  					return i == i2
  4318  				},
  4319  			},
  4320  			want: false,
  4321  		},
  4322  	}
  4323  	for _, tt := range tests {
  4324  		t.Run(tt.name, func(t *testing.T) {
  4325  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  4326  			if got := x.EqualFunc(tt.args.es, tt.args.f); got != tt.want {
  4327  				t.Errorf("EqualFunc() = %v, want %v", got, tt.want)
  4328  			}
  4329  		})
  4330  	}
  4331  }
  4332  
  4333  func TestSafeAnyBSlice_CompareFunc(t *testing.T) {
  4334  	type fields struct {
  4335  		e []int
  4336  	}
  4337  	type args struct {
  4338  		es []int
  4339  	}
  4340  	tests := []struct {
  4341  		name   string
  4342  		fields fields
  4343  		args   args
  4344  		want   int
  4345  	}{
  4346  		{
  4347  			name: "nil",
  4348  			fields: fields{
  4349  				e: nil,
  4350  			},
  4351  			args: args{
  4352  				es: nil,
  4353  			},
  4354  			want: 0,
  4355  		},
  4356  		{
  4357  			name: "",
  4358  			fields: fields{
  4359  				e: []int{},
  4360  			},
  4361  			args: args{
  4362  				es: nil,
  4363  			},
  4364  			want: 0,
  4365  		},
  4366  		{
  4367  			name: "",
  4368  			fields: fields{
  4369  				e: nil,
  4370  			},
  4371  			args: args{
  4372  				es: []int{},
  4373  			},
  4374  			want: 0,
  4375  		},
  4376  		{
  4377  			name: "",
  4378  			fields: fields{
  4379  				e: []int{1},
  4380  			},
  4381  			args: args{
  4382  				es: []int{},
  4383  			},
  4384  			want: 1,
  4385  		},
  4386  		{
  4387  			name: "",
  4388  			fields: fields{
  4389  				e: []int{},
  4390  			},
  4391  			args: args{
  4392  				es: []int{1},
  4393  			},
  4394  			want: -1,
  4395  		},
  4396  		{
  4397  			name: "",
  4398  			fields: fields{
  4399  				e: []int{2, 2},
  4400  			},
  4401  			args: args{
  4402  				es: []int{2, 1, 1},
  4403  			},
  4404  			want: 1,
  4405  		},
  4406  		{
  4407  			name: "",
  4408  			fields: fields{
  4409  				e: []int{2, 1, 1},
  4410  			},
  4411  			args: args{
  4412  				es: []int{2, 2},
  4413  			},
  4414  			want: -1,
  4415  		},
  4416  	}
  4417  	for _, tt := range tests {
  4418  		t.Run(tt.name, func(t *testing.T) {
  4419  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  4420  			if got := x.CompareFunc(tt.args.es, bcomparator.IntComparator()); got != tt.want {
  4421  				t.Errorf("CompareFunc() = %v, want %v", got, tt.want)
  4422  			}
  4423  		})
  4424  	}
  4425  }
  4426  
  4427  func TestSafeAnyBSlice_IndexFunc(t *testing.T) {
  4428  	type fields struct {
  4429  		e []int
  4430  	}
  4431  	type args struct {
  4432  		f func(int2 int) bool
  4433  	}
  4434  	tests := []struct {
  4435  		name   string
  4436  		fields fields
  4437  		args   args
  4438  		want   int
  4439  	}{
  4440  		{
  4441  			name: "nil",
  4442  			fields: fields{
  4443  				e: nil,
  4444  			},
  4445  			args: args{
  4446  				f: func(int2 int) bool {
  4447  					return true
  4448  				},
  4449  			},
  4450  			want: -1,
  4451  		},
  4452  		{
  4453  			name: "",
  4454  			fields: fields{
  4455  				e: []int{},
  4456  			},
  4457  			args: args{
  4458  				f: func(int2 int) bool {
  4459  					return true
  4460  				},
  4461  			},
  4462  			want: -1,
  4463  		},
  4464  		{
  4465  			name: "",
  4466  			fields: fields{
  4467  				e: []int{1, 2, 3},
  4468  			},
  4469  			args: args{
  4470  				f: func(int2 int) bool {
  4471  					return false
  4472  				},
  4473  			},
  4474  			want: -1,
  4475  		},
  4476  		{
  4477  			name: "",
  4478  			fields: fields{
  4479  				e: []int{1, 2, 3},
  4480  			},
  4481  			args: args{
  4482  				f: func(i int) bool {
  4483  					return i == -1
  4484  				},
  4485  			},
  4486  			want: -1,
  4487  		},
  4488  		{
  4489  			name: "",
  4490  			fields: fields{
  4491  				e: []int{1, 2, 3},
  4492  			},
  4493  			args: args{
  4494  				f: func(i int) bool {
  4495  					return i == 1
  4496  				},
  4497  			},
  4498  			want: 0,
  4499  		},
  4500  		{
  4501  			name: "",
  4502  			fields: fields{
  4503  				e: []int{1, 2, 3},
  4504  			},
  4505  			args: args{
  4506  				f: func(i int) bool {
  4507  					return i == 2
  4508  				},
  4509  			},
  4510  			want: 1,
  4511  		},
  4512  		{
  4513  			name: "",
  4514  			fields: fields{
  4515  				e: []int{1, 2, 3},
  4516  			},
  4517  			args: args{
  4518  				f: func(i int) bool {
  4519  					return i == 3
  4520  				},
  4521  			},
  4522  			want: 2,
  4523  		},
  4524  		{
  4525  			name: "",
  4526  			fields: fields{
  4527  				e: []int{1, 2, 3},
  4528  			},
  4529  			args: args{
  4530  				f: func(i int) bool {
  4531  					return i == 4
  4532  				},
  4533  			},
  4534  			want: -1,
  4535  		},
  4536  	}
  4537  	for _, tt := range tests {
  4538  		t.Run(tt.name, func(t *testing.T) {
  4539  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  4540  			if got := x.IndexFunc(tt.args.f); got != tt.want {
  4541  				t.Errorf("IndexFunc() = %v, want %v", got, tt.want)
  4542  			}
  4543  		})
  4544  	}
  4545  }
  4546  
  4547  func TestSafeAnyBSlice_Insert(t *testing.T) {
  4548  	type fields struct {
  4549  		e []int
  4550  	}
  4551  	type args struct {
  4552  		i int
  4553  		e []int
  4554  	}
  4555  	tests := []struct {
  4556  		name   string
  4557  		fields fields
  4558  		args   args
  4559  		want   []int
  4560  	}{
  4561  		{
  4562  			name: "nil",
  4563  			fields: fields{
  4564  				e: nil,
  4565  			},
  4566  			args: args{
  4567  				i: 0,
  4568  				e: nil,
  4569  			},
  4570  			want: nil,
  4571  		},
  4572  		{
  4573  			name: "nil",
  4574  			fields: fields{
  4575  				e: nil,
  4576  			},
  4577  			args: args{
  4578  				i: 0,
  4579  				e: []int{4, 5},
  4580  			},
  4581  			want: []int{4, 5},
  4582  		},
  4583  		{
  4584  			name: "nil",
  4585  			fields: fields{
  4586  				e: nil,
  4587  			},
  4588  			args: args{
  4589  				i: 1,
  4590  				e: []int{4, 5},
  4591  			},
  4592  			want: nil,
  4593  		},
  4594  		{
  4595  			name: "",
  4596  			fields: fields{
  4597  				e: []int{1, 2, 3},
  4598  			},
  4599  			args: args{
  4600  				i: 0,
  4601  				e: []int{4, 5},
  4602  			},
  4603  			want: []int{4, 5, 1, 2, 3},
  4604  		},
  4605  		{
  4606  			name: "",
  4607  			fields: fields{
  4608  				e: []int{1, 2, 3},
  4609  			},
  4610  			args: args{
  4611  				i: 1,
  4612  				e: []int{4, 5},
  4613  			},
  4614  			want: []int{1, 4, 5, 2, 3},
  4615  		},
  4616  		{
  4617  			name: "",
  4618  			fields: fields{
  4619  				e: []int{1, 2, 3},
  4620  			},
  4621  			args: args{
  4622  				i: 2,
  4623  				e: []int{4, 5},
  4624  			},
  4625  			want: []int{1, 2, 4, 5, 3},
  4626  		},
  4627  		{
  4628  			name: "",
  4629  			fields: fields{
  4630  				e: []int{1, 2, 3},
  4631  			},
  4632  			args: args{
  4633  				i: 3,
  4634  				e: []int{4, 5},
  4635  			},
  4636  			want: []int{1, 2, 3, 4, 5},
  4637  		},
  4638  		{
  4639  			name: "",
  4640  			fields: fields{
  4641  				e: []int{1, 2, 3},
  4642  			},
  4643  			args: args{
  4644  				i: 4,
  4645  				e: []int{4, 5},
  4646  			},
  4647  			want: []int{1, 2, 3},
  4648  		},
  4649  	}
  4650  	for _, tt := range tests {
  4651  		t.Run(tt.name, func(t *testing.T) {
  4652  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  4653  			x.Insert(tt.args.i, tt.args.e...)
  4654  			assert.Equal(t, tt.want, x.ToMetaSlice())
  4655  		})
  4656  	}
  4657  }
  4658  
  4659  func TestSafeAnyBSlice_InsertE(t *testing.T) {
  4660  	type fields struct {
  4661  		e []int
  4662  	}
  4663  	type args struct {
  4664  		i int
  4665  		e []int
  4666  	}
  4667  	tests := []struct {
  4668  		name    string
  4669  		fields  fields
  4670  		args    args
  4671  		want    []int
  4672  		wanterr bool
  4673  	}{
  4674  		{
  4675  			name: "nil",
  4676  			fields: fields{
  4677  				e: nil,
  4678  			},
  4679  			args: args{
  4680  				i: 0,
  4681  				e: nil,
  4682  			},
  4683  			want:    nil,
  4684  			wanterr: false,
  4685  		},
  4686  		{
  4687  			name: "nil",
  4688  			fields: fields{
  4689  				e: nil,
  4690  			},
  4691  			args: args{
  4692  				i: 0,
  4693  				e: []int{4, 5},
  4694  			},
  4695  			want:    []int{4, 5},
  4696  			wanterr: false,
  4697  		},
  4698  		{
  4699  			name: "nil",
  4700  			fields: fields{
  4701  				e: nil,
  4702  			},
  4703  			args: args{
  4704  				i: 1,
  4705  				e: []int{4, 5},
  4706  			},
  4707  			want:    nil,
  4708  			wanterr: true,
  4709  		},
  4710  		{
  4711  			name: "",
  4712  			fields: fields{
  4713  				e: []int{1, 2, 3},
  4714  			},
  4715  			args: args{
  4716  				i: 0,
  4717  				e: []int{4, 5},
  4718  			},
  4719  			want:    []int{4, 5, 1, 2, 3},
  4720  			wanterr: false,
  4721  		},
  4722  		{
  4723  			name: "",
  4724  			fields: fields{
  4725  				e: []int{1, 2, 3},
  4726  			},
  4727  			args: args{
  4728  				i: 1,
  4729  				e: []int{4, 5},
  4730  			},
  4731  			want:    []int{1, 4, 5, 2, 3},
  4732  			wanterr: false,
  4733  		},
  4734  		{
  4735  			name: "",
  4736  			fields: fields{
  4737  				e: []int{1, 2, 3},
  4738  			},
  4739  			args: args{
  4740  				i: 2,
  4741  				e: []int{4, 5},
  4742  			},
  4743  			want:    []int{1, 2, 4, 5, 3},
  4744  			wanterr: false,
  4745  		},
  4746  		{
  4747  			name: "",
  4748  			fields: fields{
  4749  				e: []int{1, 2, 3},
  4750  			},
  4751  			args: args{
  4752  				i: 3,
  4753  				e: []int{4, 5},
  4754  			},
  4755  			want:    []int{1, 2, 3, 4, 5},
  4756  			wanterr: false,
  4757  		},
  4758  		{
  4759  			name: "",
  4760  			fields: fields{
  4761  				e: []int{1, 2, 3},
  4762  			},
  4763  			args: args{
  4764  				i: 4,
  4765  				e: []int{4, 5},
  4766  			},
  4767  			want:    []int{1, 2, 3},
  4768  			wanterr: true,
  4769  		},
  4770  	}
  4771  	for _, tt := range tests {
  4772  		t.Run(tt.name, func(t *testing.T) {
  4773  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  4774  			err := x.InsertE(tt.args.i, tt.args.e...)
  4775  			assert.Equal(t, tt.wanterr, err != nil)
  4776  			assert.Equal(t, tt.want, x.ToMetaSlice())
  4777  		})
  4778  	}
  4779  }
  4780  
  4781  func TestSafeAnyBSlice_Delete(t *testing.T) {
  4782  	type fields struct {
  4783  		e []int
  4784  	}
  4785  	type args struct {
  4786  		i int
  4787  		j int
  4788  	}
  4789  	tests := []struct {
  4790  		name   string
  4791  		fields fields
  4792  		args   args
  4793  		want   []int
  4794  	}{
  4795  		{
  4796  			name: "nil",
  4797  			fields: fields{
  4798  				e: nil,
  4799  			},
  4800  			args: args{
  4801  				i: 0,
  4802  				j: 0,
  4803  			},
  4804  			want: nil,
  4805  		},
  4806  		{
  4807  			name: "",
  4808  			fields: fields{
  4809  				e: []int{},
  4810  			},
  4811  			args: args{
  4812  				i: 0,
  4813  				j: 0,
  4814  			},
  4815  			want: []int{},
  4816  		},
  4817  		{
  4818  			name: "",
  4819  			fields: fields{
  4820  				e: []int{0, 1, 2, 3, 4, 5},
  4821  			},
  4822  			args: args{
  4823  				i: -1,
  4824  				j: -1,
  4825  			},
  4826  			want: []int{0, 1, 2, 3, 4, 5},
  4827  		},
  4828  		{
  4829  			name: "",
  4830  			fields: fields{
  4831  				e: []int{0, 1, 2, 3, 4, 5},
  4832  			},
  4833  			args: args{
  4834  				i: 6,
  4835  				j: 6,
  4836  			},
  4837  			want: []int{0, 1, 2, 3, 4, 5},
  4838  		},
  4839  		{
  4840  			name: "",
  4841  			fields: fields{
  4842  				e: []int{0, 1, 2, 3, 4, 5},
  4843  			},
  4844  			args: args{
  4845  				i: 0,
  4846  				j: 6,
  4847  			},
  4848  			want: []int{},
  4849  		},
  4850  		{
  4851  			name: "",
  4852  			fields: fields{
  4853  				e: []int{0, 1, 2, 3, 4, 5},
  4854  			},
  4855  			args: args{
  4856  				i: 1,
  4857  				j: 1,
  4858  			},
  4859  			want: []int{0, 1, 2, 3, 4, 5},
  4860  		},
  4861  		{
  4862  			name: "",
  4863  			fields: fields{
  4864  				e: []int{0, 1, 2, 3, 4, 5},
  4865  			},
  4866  			args: args{
  4867  				i: 1,
  4868  				j: 2,
  4869  			},
  4870  			want: []int{0, 2, 3, 4, 5},
  4871  		},
  4872  		{
  4873  			name: "",
  4874  			fields: fields{
  4875  				e: []int{0, 1, 2, 3, 4, 5},
  4876  			},
  4877  			args: args{
  4878  				i: 2,
  4879  				j: 3,
  4880  			},
  4881  			want: []int{0, 1, 3, 4, 5},
  4882  		},
  4883  		{
  4884  			name: "",
  4885  			fields: fields{
  4886  				e: []int{0, 1, 2, 3, 4, 5},
  4887  			},
  4888  			args: args{
  4889  				i: 3,
  4890  				j: 6,
  4891  			},
  4892  			want: []int{0, 1, 2},
  4893  		},
  4894  	}
  4895  	for _, tt := range tests {
  4896  		t.Run(tt.name, func(t *testing.T) {
  4897  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  4898  			x.Delete(tt.args.i, tt.args.j)
  4899  			assert.Equal(t, tt.want, x.ToMetaSlice())
  4900  		})
  4901  	}
  4902  }
  4903  
  4904  func TestSafeAnyBSlice_DeleteE(t *testing.T) {
  4905  	type fields struct {
  4906  		e []int
  4907  	}
  4908  	type args struct {
  4909  		i int
  4910  		j int
  4911  	}
  4912  	tests := []struct {
  4913  		name    string
  4914  		fields  fields
  4915  		args    args
  4916  		want    []int
  4917  		wanterr bool
  4918  	}{
  4919  		{
  4920  			name: "nil",
  4921  			fields: fields{
  4922  				e: nil,
  4923  			},
  4924  			args: args{
  4925  				i: 0,
  4926  				j: 0,
  4927  			},
  4928  			want:    nil,
  4929  			wanterr: false,
  4930  		},
  4931  		{
  4932  			name: "",
  4933  			fields: fields{
  4934  				e: []int{},
  4935  			},
  4936  			args: args{
  4937  				i: 0,
  4938  				j: 0,
  4939  			},
  4940  			want:    []int{},
  4941  			wanterr: false,
  4942  		},
  4943  		{
  4944  			name: "",
  4945  			fields: fields{
  4946  				e: []int{0, 1, 2, 3, 4, 5},
  4947  			},
  4948  			args: args{
  4949  				i: -1,
  4950  				j: -1,
  4951  			},
  4952  			want:    []int{0, 1, 2, 3, 4, 5},
  4953  			wanterr: true,
  4954  		},
  4955  		{
  4956  			name: "",
  4957  			fields: fields{
  4958  				e: []int{0, 1, 2, 3, 4, 5},
  4959  			},
  4960  			args: args{
  4961  				i: 6,
  4962  				j: 6,
  4963  			},
  4964  			want:    []int{0, 1, 2, 3, 4, 5},
  4965  			wanterr: false,
  4966  		},
  4967  		{
  4968  			name: "",
  4969  			fields: fields{
  4970  				e: []int{0, 1, 2, 3, 4, 5},
  4971  			},
  4972  			args: args{
  4973  				i: 0,
  4974  				j: 6,
  4975  			},
  4976  			want:    []int{},
  4977  			wanterr: false,
  4978  		},
  4979  		{
  4980  			name: "",
  4981  			fields: fields{
  4982  				e: []int{0, 1, 2, 3, 4, 5},
  4983  			},
  4984  			args: args{
  4985  				i: 1,
  4986  				j: 1,
  4987  			},
  4988  			want:    []int{0, 1, 2, 3, 4, 5},
  4989  			wanterr: false,
  4990  		},
  4991  		{
  4992  			name: "",
  4993  			fields: fields{
  4994  				e: []int{0, 1, 2, 3, 4, 5},
  4995  			},
  4996  			args: args{
  4997  				i: 1,
  4998  				j: 2,
  4999  			},
  5000  			want:    []int{0, 2, 3, 4, 5},
  5001  			wanterr: false,
  5002  		},
  5003  		{
  5004  			name: "",
  5005  			fields: fields{
  5006  				e: []int{0, 1, 2, 3, 4, 5},
  5007  			},
  5008  			args: args{
  5009  				i: 2,
  5010  				j: 3,
  5011  			},
  5012  			want:    []int{0, 1, 3, 4, 5},
  5013  			wanterr: false,
  5014  		},
  5015  		{
  5016  			name: "",
  5017  			fields: fields{
  5018  				e: []int{0, 1, 2, 3, 4, 5},
  5019  			},
  5020  			args: args{
  5021  				i: 3,
  5022  				j: 6,
  5023  			},
  5024  			want:    []int{0, 1, 2},
  5025  			wanterr: false,
  5026  		},
  5027  	}
  5028  	for _, tt := range tests {
  5029  		t.Run(tt.name, func(t *testing.T) {
  5030  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  5031  			err := x.DeleteE(tt.args.i, tt.args.j)
  5032  			assert.Equal(t, tt.wanterr, err != nil)
  5033  			assert.Equal(t, tt.want, x.ToMetaSlice())
  5034  		})
  5035  	}
  5036  }
  5037  
  5038  func TestSafeAnyBSlice_DeleteToSlice(t *testing.T) {
  5039  	type fields struct {
  5040  		e []int
  5041  	}
  5042  	type args struct {
  5043  		i int
  5044  		j int
  5045  	}
  5046  	tests := []struct {
  5047  		name   string
  5048  		fields fields
  5049  		args   args
  5050  		want   []int
  5051  	}{
  5052  		{
  5053  			name: "nil",
  5054  			fields: fields{
  5055  				e: nil,
  5056  			},
  5057  			args: args{
  5058  				i: 0,
  5059  				j: 0,
  5060  			},
  5061  			want: nil,
  5062  		},
  5063  		{
  5064  			name: "",
  5065  			fields: fields{
  5066  				e: []int{},
  5067  			},
  5068  			args: args{
  5069  				i: 0,
  5070  				j: 0,
  5071  			},
  5072  			want: nil,
  5073  		},
  5074  		{
  5075  			name: "",
  5076  			fields: fields{
  5077  				e: []int{0, 1, 2, 3, 4, 5},
  5078  			},
  5079  			args: args{
  5080  				i: -1,
  5081  				j: -1,
  5082  			},
  5083  			want: nil,
  5084  		},
  5085  		{
  5086  			name: "",
  5087  			fields: fields{
  5088  				e: []int{0, 1, 2, 3, 4, 5},
  5089  			},
  5090  			args: args{
  5091  				i: 6,
  5092  				j: 6,
  5093  			},
  5094  			want: []int{0, 1, 2, 3, 4, 5},
  5095  		},
  5096  		{
  5097  			name: "",
  5098  			fields: fields{
  5099  				e: []int{0, 1, 2, 3, 4, 5},
  5100  			},
  5101  			args: args{
  5102  				i: 0,
  5103  				j: 6,
  5104  			},
  5105  			want: []int{},
  5106  		},
  5107  		{
  5108  			name: "",
  5109  			fields: fields{
  5110  				e: []int{0, 1, 2, 3, 4, 5},
  5111  			},
  5112  			args: args{
  5113  				i: 1,
  5114  				j: 1,
  5115  			},
  5116  			want: []int{0, 1, 2, 3, 4, 5},
  5117  		},
  5118  		{
  5119  			name: "",
  5120  			fields: fields{
  5121  				e: []int{0, 1, 2, 3, 4, 5},
  5122  			},
  5123  			args: args{
  5124  				i: 1,
  5125  				j: 2,
  5126  			},
  5127  			want: []int{0, 2, 3, 4, 5},
  5128  		},
  5129  		{
  5130  			name: "",
  5131  			fields: fields{
  5132  				e: []int{0, 1, 2, 3, 4, 5},
  5133  			},
  5134  			args: args{
  5135  				i: 2,
  5136  				j: 3,
  5137  			},
  5138  			want: []int{0, 1, 3, 4, 5},
  5139  		},
  5140  		{
  5141  			name: "",
  5142  			fields: fields{
  5143  				e: []int{0, 1, 2, 3, 4, 5},
  5144  			},
  5145  			args: args{
  5146  				i: 3,
  5147  				j: 6,
  5148  			},
  5149  			want: []int{0, 1, 2},
  5150  		},
  5151  	}
  5152  	for _, tt := range tests {
  5153  		t.Run(tt.name, func(t *testing.T) {
  5154  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  5155  			assert.Equalf(t, tt.want, x.DeleteToSlice(tt.args.i, tt.args.j), "DeleteToSlice(%v, %v)", tt.args.i, tt.args.j)
  5156  		})
  5157  	}
  5158  }
  5159  
  5160  func TestSafeAnyBSlice_DeleteToSliceE(t *testing.T) {
  5161  	type fields struct {
  5162  		e []int
  5163  	}
  5164  	type args struct {
  5165  		i int
  5166  		j int
  5167  	}
  5168  	tests := []struct {
  5169  		name    string
  5170  		fields  fields
  5171  		args    args
  5172  		want    []int
  5173  		wanterr bool
  5174  	}{
  5175  		{
  5176  			name: "nil",
  5177  			fields: fields{
  5178  				e: nil,
  5179  			},
  5180  			args: args{
  5181  				i: 0,
  5182  				j: 0,
  5183  			},
  5184  			want:    nil,
  5185  			wanterr: false,
  5186  		},
  5187  		{
  5188  			name: "",
  5189  			fields: fields{
  5190  				e: []int{},
  5191  			},
  5192  			args: args{
  5193  				i: 0,
  5194  				j: 0,
  5195  			},
  5196  			want:    nil,
  5197  			wanterr: false,
  5198  		},
  5199  		{
  5200  			name: "",
  5201  			fields: fields{
  5202  				e: []int{0, 1, 2, 3, 4, 5},
  5203  			},
  5204  			args: args{
  5205  				i: -1,
  5206  				j: -1,
  5207  			},
  5208  			want:    nil,
  5209  			wanterr: true,
  5210  		},
  5211  		{
  5212  			name: "",
  5213  			fields: fields{
  5214  				e: []int{0, 1, 2, 3, 4, 5},
  5215  			},
  5216  			args: args{
  5217  				i: 6,
  5218  				j: 6,
  5219  			},
  5220  			want:    []int{0, 1, 2, 3, 4, 5},
  5221  			wanterr: false,
  5222  		},
  5223  		{
  5224  			name: "",
  5225  			fields: fields{
  5226  				e: []int{0, 1, 2, 3, 4, 5},
  5227  			},
  5228  			args: args{
  5229  				i: 0,
  5230  				j: 6,
  5231  			},
  5232  			want:    []int{},
  5233  			wanterr: false,
  5234  		},
  5235  		{
  5236  			name: "",
  5237  			fields: fields{
  5238  				e: []int{0, 1, 2, 3, 4, 5},
  5239  			},
  5240  			args: args{
  5241  				i: 1,
  5242  				j: 1,
  5243  			},
  5244  			want:    []int{0, 1, 2, 3, 4, 5},
  5245  			wanterr: false,
  5246  		},
  5247  		{
  5248  			name: "",
  5249  			fields: fields{
  5250  				e: []int{0, 1, 2, 3, 4, 5},
  5251  			},
  5252  			args: args{
  5253  				i: 1,
  5254  				j: 2,
  5255  			},
  5256  			want:    []int{0, 2, 3, 4, 5},
  5257  			wanterr: false,
  5258  		},
  5259  		{
  5260  			name: "",
  5261  			fields: fields{
  5262  				e: []int{0, 1, 2, 3, 4, 5},
  5263  			},
  5264  			args: args{
  5265  				i: 2,
  5266  				j: 3,
  5267  			},
  5268  			want:    []int{0, 1, 3, 4, 5},
  5269  			wanterr: false,
  5270  		},
  5271  		{
  5272  			name: "",
  5273  			fields: fields{
  5274  				e: []int{0, 1, 2, 3, 4, 5},
  5275  			},
  5276  			args: args{
  5277  				i: 3,
  5278  				j: 6,
  5279  			},
  5280  			want:    []int{0, 1, 2},
  5281  			wanterr: false,
  5282  		},
  5283  	}
  5284  	for _, tt := range tests {
  5285  		t.Run(tt.name, func(t *testing.T) {
  5286  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  5287  			v, err := x.DeleteToSliceE(tt.args.i, tt.args.j)
  5288  			assert.Equal(t, tt.wanterr, err != nil)
  5289  			assert.Equal(t, tt.want, v)
  5290  		})
  5291  	}
  5292  }
  5293  
  5294  func TestSafeAnyBSlice_DeleteToBSlice(t *testing.T) {
  5295  	type fields struct {
  5296  		e []int
  5297  	}
  5298  	type args struct {
  5299  		i int
  5300  		j int
  5301  	}
  5302  	tests := []struct {
  5303  		name   string
  5304  		fields fields
  5305  		args   args
  5306  		want   []int
  5307  	}{
  5308  		{
  5309  			name: "nil",
  5310  			fields: fields{
  5311  				e: nil,
  5312  			},
  5313  			args: args{
  5314  				i: 0,
  5315  				j: 0,
  5316  			},
  5317  			want: []int{},
  5318  		},
  5319  		{
  5320  			name: "",
  5321  			fields: fields{
  5322  				e: []int{},
  5323  			},
  5324  			args: args{
  5325  				i: 0,
  5326  				j: 0,
  5327  			},
  5328  			want: []int{},
  5329  		},
  5330  		{
  5331  			name: "",
  5332  			fields: fields{
  5333  				e: []int{0, 1, 2, 3, 4, 5},
  5334  			},
  5335  			args: args{
  5336  				i: -1,
  5337  				j: -1,
  5338  			},
  5339  			want: []int{},
  5340  		},
  5341  		{
  5342  			name: "",
  5343  			fields: fields{
  5344  				e: []int{0, 1, 2, 3, 4, 5},
  5345  			},
  5346  			args: args{
  5347  				i: 6,
  5348  				j: 6,
  5349  			},
  5350  			want: []int{0, 1, 2, 3, 4, 5},
  5351  		},
  5352  		{
  5353  			name: "",
  5354  			fields: fields{
  5355  				e: []int{0, 1, 2, 3, 4, 5},
  5356  			},
  5357  			args: args{
  5358  				i: 0,
  5359  				j: 6,
  5360  			},
  5361  			want: []int{},
  5362  		},
  5363  		{
  5364  			name: "",
  5365  			fields: fields{
  5366  				e: []int{0, 1, 2, 3, 4, 5},
  5367  			},
  5368  			args: args{
  5369  				i: 1,
  5370  				j: 1,
  5371  			},
  5372  			want: []int{0, 1, 2, 3, 4, 5},
  5373  		},
  5374  		{
  5375  			name: "",
  5376  			fields: fields{
  5377  				e: []int{0, 1, 2, 3, 4, 5},
  5378  			},
  5379  			args: args{
  5380  				i: 1,
  5381  				j: 2,
  5382  			},
  5383  			want: []int{0, 2, 3, 4, 5},
  5384  		},
  5385  		{
  5386  			name: "",
  5387  			fields: fields{
  5388  				e: []int{0, 1, 2, 3, 4, 5},
  5389  			},
  5390  			args: args{
  5391  				i: 2,
  5392  				j: 3,
  5393  			},
  5394  			want: []int{0, 1, 3, 4, 5},
  5395  		},
  5396  		{
  5397  			name: "",
  5398  			fields: fields{
  5399  				e: []int{0, 1, 2, 3, 4, 5},
  5400  			},
  5401  			args: args{
  5402  				i: 3,
  5403  				j: 6,
  5404  			},
  5405  			want: []int{0, 1, 2},
  5406  		},
  5407  	}
  5408  	for _, tt := range tests {
  5409  		t.Run(tt.name, func(t *testing.T) {
  5410  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  5411  			assert.Equalf(t, tt.want, x.DeleteToBSlice(tt.args.i, tt.args.j).ToMetaSlice(), "DeleteToSlice(%v, %v)", tt.args.i, tt.args.j)
  5412  		})
  5413  	}
  5414  }
  5415  
  5416  func TestSafeAnyBSlice_DeleteToBSliceE(t *testing.T) {
  5417  	type fields struct {
  5418  		e []int
  5419  	}
  5420  	type args struct {
  5421  		i int
  5422  		j int
  5423  	}
  5424  	tests := []struct {
  5425  		name    string
  5426  		fields  fields
  5427  		args    args
  5428  		want    []int
  5429  		wanterr bool
  5430  	}{
  5431  		{
  5432  			name: "nil",
  5433  			fields: fields{
  5434  				e: nil,
  5435  			},
  5436  			args: args{
  5437  				i: 0,
  5438  				j: 0,
  5439  			},
  5440  			want:    []int{},
  5441  			wanterr: false,
  5442  		},
  5443  		{
  5444  			name: "",
  5445  			fields: fields{
  5446  				e: []int{},
  5447  			},
  5448  			args: args{
  5449  				i: 0,
  5450  				j: 0,
  5451  			},
  5452  			want:    []int{},
  5453  			wanterr: false,
  5454  		},
  5455  		{
  5456  			name: "",
  5457  			fields: fields{
  5458  				e: []int{0, 1, 2, 3, 4, 5},
  5459  			},
  5460  			args: args{
  5461  				i: -1,
  5462  				j: -1,
  5463  			},
  5464  			want:    []int{},
  5465  			wanterr: true,
  5466  		},
  5467  		{
  5468  			name: "",
  5469  			fields: fields{
  5470  				e: []int{0, 1, 2, 3, 4, 5},
  5471  			},
  5472  			args: args{
  5473  				i: 6,
  5474  				j: 6,
  5475  			},
  5476  			want:    []int{0, 1, 2, 3, 4, 5},
  5477  			wanterr: false,
  5478  		},
  5479  		{
  5480  			name: "",
  5481  			fields: fields{
  5482  				e: []int{0, 1, 2, 3, 4, 5},
  5483  			},
  5484  			args: args{
  5485  				i: 0,
  5486  				j: 6,
  5487  			},
  5488  			want:    []int{},
  5489  			wanterr: false,
  5490  		},
  5491  		{
  5492  			name: "",
  5493  			fields: fields{
  5494  				e: []int{0, 1, 2, 3, 4, 5},
  5495  			},
  5496  			args: args{
  5497  				i: 1,
  5498  				j: 1,
  5499  			},
  5500  			want:    []int{0, 1, 2, 3, 4, 5},
  5501  			wanterr: false,
  5502  		},
  5503  		{
  5504  			name: "",
  5505  			fields: fields{
  5506  				e: []int{0, 1, 2, 3, 4, 5},
  5507  			},
  5508  			args: args{
  5509  				i: 1,
  5510  				j: 2,
  5511  			},
  5512  			want:    []int{0, 2, 3, 4, 5},
  5513  			wanterr: false,
  5514  		},
  5515  		{
  5516  			name: "",
  5517  			fields: fields{
  5518  				e: []int{0, 1, 2, 3, 4, 5},
  5519  			},
  5520  			args: args{
  5521  				i: 2,
  5522  				j: 3,
  5523  			},
  5524  			want:    []int{0, 1, 3, 4, 5},
  5525  			wanterr: false,
  5526  		},
  5527  		{
  5528  			name: "",
  5529  			fields: fields{
  5530  				e: []int{0, 1, 2, 3, 4, 5},
  5531  			},
  5532  			args: args{
  5533  				i: 3,
  5534  				j: 6,
  5535  			},
  5536  			want:    []int{0, 1, 2},
  5537  			wanterr: false,
  5538  		},
  5539  	}
  5540  	for _, tt := range tests {
  5541  		t.Run(tt.name, func(t *testing.T) {
  5542  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  5543  			v, err := x.DeleteToBSliceE(tt.args.i, tt.args.j)
  5544  			assert.Equal(t, tt.wanterr, err != nil)
  5545  			assert.Equal(t, tt.want, v.ToMetaSlice())
  5546  		})
  5547  	}
  5548  }
  5549  
  5550  func TestSafeAnyBSlice_Replace(t *testing.T) {
  5551  	type fields struct {
  5552  		e []int
  5553  	}
  5554  	type args struct {
  5555  		i int
  5556  		j int
  5557  		e []int
  5558  	}
  5559  	tests := []struct {
  5560  		name   string
  5561  		fields fields
  5562  		args   args
  5563  		want   []int
  5564  	}{
  5565  		{
  5566  			name: "nil",
  5567  			fields: fields{
  5568  				e: nil,
  5569  			},
  5570  			args: args{
  5571  				i: 0,
  5572  				j: 0,
  5573  				e: nil,
  5574  			},
  5575  			want: nil,
  5576  		},
  5577  		{
  5578  			name: "",
  5579  			fields: fields{
  5580  				e: nil,
  5581  			},
  5582  			args: args{
  5583  				i: 0,
  5584  				j: 0,
  5585  				e: []int{4, 5},
  5586  			},
  5587  			want: []int{4, 5},
  5588  		},
  5589  		{
  5590  			name: "",
  5591  			fields: fields{
  5592  				e: nil,
  5593  			},
  5594  			args: args{
  5595  				i: 0,
  5596  				j: 1,
  5597  				e: []int{4, 5},
  5598  			},
  5599  			want: nil,
  5600  		},
  5601  		{
  5602  			name: "",
  5603  			fields: fields{
  5604  				e: []int{},
  5605  			},
  5606  			args: args{
  5607  				i: 0,
  5608  				j: 1,
  5609  				e: []int{4, 5},
  5610  			},
  5611  			want: []int{},
  5612  		},
  5613  		{
  5614  			name: "",
  5615  			fields: fields{
  5616  				e: []int{0, 1, 2, 3},
  5617  			},
  5618  			args: args{
  5619  				i: 0,
  5620  				j: 0,
  5621  				e: []int{4, 5},
  5622  			},
  5623  			want: []int{4, 5, 0, 1, 2, 3},
  5624  		},
  5625  		{
  5626  			name: "",
  5627  			fields: fields{
  5628  				e: []int{0, 1, 2, 3},
  5629  			},
  5630  			args: args{
  5631  				i: 0,
  5632  				j: 4,
  5633  				e: []int{4, 5},
  5634  			},
  5635  			want: []int{4, 5},
  5636  		},
  5637  		{
  5638  			name: "",
  5639  			fields: fields{
  5640  				e: []int{0, 1, 2, 3},
  5641  			},
  5642  			args: args{
  5643  				i: 0,
  5644  				j: 5,
  5645  				e: []int{4, 5},
  5646  			},
  5647  			want: []int{0, 1, 2, 3},
  5648  		},
  5649  		{
  5650  			name: "",
  5651  			fields: fields{
  5652  				e: []int{0, 1, 2, 3},
  5653  			},
  5654  			args: args{
  5655  				i: 4,
  5656  				j: 1,
  5657  				e: []int{4, 5},
  5658  			},
  5659  			want: []int{0, 1, 2, 3},
  5660  		},
  5661  		{
  5662  			name: "",
  5663  			fields: fields{
  5664  				e: []int{0, 1, 2, 3},
  5665  			},
  5666  			args: args{
  5667  				i: 4,
  5668  				j: 4,
  5669  				e: []int{4, 5},
  5670  			},
  5671  			want: []int{0, 1, 2, 3, 4, 5},
  5672  		},
  5673  		{
  5674  			name: "",
  5675  			fields: fields{
  5676  				e: []int{0, 1, 2, 3},
  5677  			},
  5678  			args: args{
  5679  				i: 1,
  5680  				j: 3,
  5681  				e: []int{4, 5},
  5682  			},
  5683  			want: []int{0, 4, 5, 3},
  5684  		},
  5685  	}
  5686  	for _, tt := range tests {
  5687  		t.Run(tt.name, func(t *testing.T) {
  5688  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  5689  			x.Replace(tt.args.i, tt.args.j, tt.args.e...)
  5690  			assert.Equal(t, tt.want, x.ToMetaSlice())
  5691  		})
  5692  	}
  5693  }
  5694  
  5695  func TestSafeAnyBSlice_ReplaceE(t *testing.T) {
  5696  	type fields struct {
  5697  		e []int
  5698  	}
  5699  	type args struct {
  5700  		i int
  5701  		j int
  5702  		e []int
  5703  	}
  5704  	tests := []struct {
  5705  		name    string
  5706  		fields  fields
  5707  		args    args
  5708  		want    []int
  5709  		wanterr bool
  5710  	}{
  5711  		{
  5712  			name: "nil",
  5713  			fields: fields{
  5714  				e: nil,
  5715  			},
  5716  			args: args{
  5717  				i: 0,
  5718  				j: 0,
  5719  				e: nil,
  5720  			},
  5721  			want:    nil,
  5722  			wanterr: false,
  5723  		},
  5724  		{
  5725  			name: "",
  5726  			fields: fields{
  5727  				e: nil,
  5728  			},
  5729  			args: args{
  5730  				i: 0,
  5731  				j: 0,
  5732  				e: []int{4, 5},
  5733  			},
  5734  			want:    []int{4, 5},
  5735  			wanterr: false,
  5736  		},
  5737  		{
  5738  			name: "",
  5739  			fields: fields{
  5740  				e: nil,
  5741  			},
  5742  			args: args{
  5743  				i: 0,
  5744  				j: 1,
  5745  				e: []int{4, 5},
  5746  			},
  5747  			want:    nil,
  5748  			wanterr: true,
  5749  		},
  5750  		{
  5751  			name: "",
  5752  			fields: fields{
  5753  				e: []int{},
  5754  			},
  5755  			args: args{
  5756  				i: 0,
  5757  				j: 1,
  5758  				e: []int{4, 5},
  5759  			},
  5760  			want:    []int{},
  5761  			wanterr: true,
  5762  		},
  5763  		{
  5764  			name: "",
  5765  			fields: fields{
  5766  				e: []int{0, 1, 2, 3},
  5767  			},
  5768  			args: args{
  5769  				i: 0,
  5770  				j: 0,
  5771  				e: []int{4, 5},
  5772  			},
  5773  			want:    []int{4, 5, 0, 1, 2, 3},
  5774  			wanterr: false,
  5775  		},
  5776  		{
  5777  			name: "",
  5778  			fields: fields{
  5779  				e: []int{0, 1, 2, 3},
  5780  			},
  5781  			args: args{
  5782  				i: 0,
  5783  				j: 4,
  5784  				e: []int{4, 5},
  5785  			},
  5786  			want:    []int{4, 5},
  5787  			wanterr: false,
  5788  		},
  5789  		{
  5790  			name: "",
  5791  			fields: fields{
  5792  				e: []int{0, 1, 2, 3},
  5793  			},
  5794  			args: args{
  5795  				i: 0,
  5796  				j: 5,
  5797  				e: []int{4, 5},
  5798  			},
  5799  			want:    []int{0, 1, 2, 3},
  5800  			wanterr: true,
  5801  		},
  5802  		{
  5803  			name: "",
  5804  			fields: fields{
  5805  				e: []int{0, 1, 2, 3},
  5806  			},
  5807  			args: args{
  5808  				i: 4,
  5809  				j: 1,
  5810  				e: []int{4, 5},
  5811  			},
  5812  			want:    []int{0, 1, 2, 3},
  5813  			wanterr: true,
  5814  		},
  5815  		{
  5816  			name: "",
  5817  			fields: fields{
  5818  				e: []int{0, 1, 2, 3},
  5819  			},
  5820  			args: args{
  5821  				i: 4,
  5822  				j: 4,
  5823  				e: []int{4, 5},
  5824  			},
  5825  			want:    []int{0, 1, 2, 3, 4, 5},
  5826  			wanterr: false,
  5827  		},
  5828  		{
  5829  			name: "",
  5830  			fields: fields{
  5831  				e: []int{0, 1, 2, 3},
  5832  			},
  5833  			args: args{
  5834  				i: 1,
  5835  				j: 3,
  5836  				e: []int{4, 5},
  5837  			},
  5838  			want:    []int{0, 4, 5, 3},
  5839  			wanterr: false,
  5840  		},
  5841  	}
  5842  	for _, tt := range tests {
  5843  		t.Run(tt.name, func(t *testing.T) {
  5844  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  5845  			err := x.ReplaceE(tt.args.i, tt.args.j, tt.args.e...)
  5846  			assert.Equal(t, tt.wanterr, err != nil)
  5847  			assert.Equal(t, tt.want, x.ToMetaSlice())
  5848  		})
  5849  	}
  5850  }
  5851  
  5852  func TestSafeAnyBSlice_CloneToSlice(t *testing.T) {
  5853  	type fields struct {
  5854  		e []int
  5855  	}
  5856  	tests := []struct {
  5857  		name   string
  5858  		fields fields
  5859  		want   []int
  5860  	}{
  5861  		{
  5862  			name: "nil",
  5863  			fields: fields{
  5864  				e: nil,
  5865  			},
  5866  			want: nil,
  5867  		},
  5868  		{
  5869  			name: "",
  5870  			fields: fields{
  5871  				e: []int{},
  5872  			},
  5873  			want: []int{},
  5874  		},
  5875  		{
  5876  			name: "",
  5877  			fields: fields{
  5878  				e: []int{1, 2, 3},
  5879  			},
  5880  			want: []int{1, 2, 3},
  5881  		},
  5882  	}
  5883  	for _, tt := range tests {
  5884  		t.Run(tt.name, func(t *testing.T) {
  5885  			x := NewSafeComparableBSliceBySlice(tt.fields.e)
  5886  			assert.Equalf(t, tt.want, x.CloneToSlice(), "CloneToSlice()")
  5887  		})
  5888  	}
  5889  }
  5890  
  5891  func TestSafeAnyBSlice_CloneToBSlice(t *testing.T) {
  5892  	type fields struct {
  5893  		e []int
  5894  	}
  5895  	tests := []struct {
  5896  		name   string
  5897  		fields fields
  5898  		want   []int
  5899  	}{
  5900  		{
  5901  			name: "nil",
  5902  			fields: fields{
  5903  				e: nil,
  5904  			},
  5905  			want: nil,
  5906  		},
  5907  		{
  5908  			name: "",
  5909  			fields: fields{
  5910  				e: []int{},
  5911  			},
  5912  			want: []int{},
  5913  		},
  5914  		{
  5915  			name: "",
  5916  			fields: fields{
  5917  				e: []int{1, 2, 3},
  5918  			},
  5919  			want: []int{1, 2, 3},
  5920  		},
  5921  	}
  5922  	for _, tt := range tests {
  5923  		t.Run(tt.name, func(t *testing.T) {
  5924  			x := NewSafeComparableBSliceBySlice(tt.fields.e)
  5925  			assert.Equalf(t, tt.want, x.CloneToBSlice().ToMetaSlice(), "CloneToSlice()")
  5926  		})
  5927  	}
  5928  }
  5929  
  5930  func TestSafeAnyBSlice_CompactFunc(t *testing.T) {
  5931  	type fields struct {
  5932  		e []int
  5933  	}
  5934  	type args struct {
  5935  		f func(int, int) bool
  5936  	}
  5937  	tests := []struct {
  5938  		name   string
  5939  		fields fields
  5940  		args   args
  5941  		want   []int
  5942  	}{
  5943  		{
  5944  			name: "nil",
  5945  			fields: fields{
  5946  				e: nil,
  5947  			},
  5948  			args: args{
  5949  				func(i int, i2 int) bool {
  5950  					return i == i2
  5951  				},
  5952  			},
  5953  			want: nil,
  5954  		},
  5955  		{
  5956  			name: "",
  5957  			fields: fields{
  5958  				e: []int{},
  5959  			},
  5960  			args: args{
  5961  				func(i int, i2 int) bool {
  5962  					return i == i2
  5963  				},
  5964  			},
  5965  			want: []int{},
  5966  		},
  5967  		{
  5968  			name: "",
  5969  			fields: fields{
  5970  				e: []int{1, 1, 2, 2, 3, 3, 3},
  5971  			},
  5972  			args: args{
  5973  				func(i int, i2 int) bool {
  5974  					return i == i2
  5975  				},
  5976  			},
  5977  			want: []int{1, 2, 3},
  5978  		},
  5979  		{
  5980  			name: "",
  5981  			fields: fields{
  5982  				e: []int{1, 2, 3, 3, 2, 1},
  5983  			},
  5984  			args: args{
  5985  				func(i int, i2 int) bool {
  5986  					return i == i2
  5987  				},
  5988  			},
  5989  			want: []int{1, 2, 3, 2, 1},
  5990  		},
  5991  	}
  5992  	for _, tt := range tests {
  5993  		t.Run(tt.name, func(t *testing.T) {
  5994  			x := NewSafeComparableBSliceBySlice(tt.fields.e)
  5995  			x.CompactFunc(tt.args.f)
  5996  			assert.Equal(t, tt.want, x.ToMetaSlice())
  5997  		})
  5998  	}
  5999  }
  6000  
  6001  func TestSafeAnyBSlice_Grow(t *testing.T) {
  6002  	type fields struct {
  6003  		e []int
  6004  	}
  6005  	type args struct {
  6006  		i int
  6007  	}
  6008  	tests := []struct {
  6009  		name   string
  6010  		fields fields
  6011  		args   args
  6012  		want   int
  6013  	}{
  6014  		{
  6015  			name: "nil",
  6016  			fields: fields{
  6017  				e: nil,
  6018  			},
  6019  			args: args{
  6020  				i: 0,
  6021  			},
  6022  			want: 0,
  6023  		},
  6024  		{
  6025  			name: "",
  6026  			fields: fields{
  6027  				e: []int{},
  6028  			},
  6029  			args: args{
  6030  				i: 0,
  6031  			},
  6032  			want: 0,
  6033  		},
  6034  		{
  6035  			name: "",
  6036  			fields: fields{
  6037  				e: []int{},
  6038  			},
  6039  			args: args{
  6040  				i: 10,
  6041  			},
  6042  			want: 10,
  6043  		},
  6044  		{
  6045  			name: "",
  6046  			fields: fields{
  6047  				e: nil,
  6048  			},
  6049  			args: args{
  6050  				i: 10,
  6051  			},
  6052  			want: 10,
  6053  		},
  6054  		{
  6055  			name: "",
  6056  			fields: fields{
  6057  				e: make([]int, 10),
  6058  			},
  6059  			args: args{
  6060  				i: 10,
  6061  			},
  6062  			want: 20,
  6063  		},
  6064  	}
  6065  	for _, tt := range tests {
  6066  		t.Run(tt.name, func(t *testing.T) {
  6067  			x := NewSafeComparableBSliceBySlice(tt.fields.e)
  6068  			x.Grow(tt.args.i)
  6069  			assert.Equal(t, tt.want, cap(x.ToMetaSlice()))
  6070  		})
  6071  	}
  6072  }
  6073  
  6074  func TestSafeAnyBSlice_Clip(t *testing.T) {
  6075  	type fields struct {
  6076  		e []int
  6077  	}
  6078  	tests := []struct {
  6079  		name   string
  6080  		fields fields
  6081  		want   int
  6082  	}{
  6083  		{
  6084  			name: "",
  6085  			fields: fields{
  6086  				e: nil,
  6087  			},
  6088  			want: 0,
  6089  		},
  6090  		{
  6091  			name: "",
  6092  			fields: fields{
  6093  				e: []int{},
  6094  			},
  6095  			want: 0,
  6096  		},
  6097  		{
  6098  			name: "",
  6099  			fields: fields{
  6100  				e: make([]int, 10, 20),
  6101  			},
  6102  			want: 10,
  6103  		},
  6104  	}
  6105  	for _, tt := range tests {
  6106  		t.Run(tt.name, func(t *testing.T) {
  6107  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  6108  			x.Clip()
  6109  		})
  6110  	}
  6111  }
  6112  
  6113  func TestSafeAnyBSlice_SortFunc(t *testing.T) {
  6114  	type fields struct {
  6115  		e []int
  6116  	}
  6117  
  6118  	tests := []struct {
  6119  		name   string
  6120  		fields fields
  6121  		want   []int
  6122  	}{
  6123  		{
  6124  			name: "nil",
  6125  			fields: fields{
  6126  				e: nil,
  6127  			},
  6128  			want: nil,
  6129  		},
  6130  		{
  6131  			name: "",
  6132  			fields: fields{
  6133  				e: []int{},
  6134  			},
  6135  			want: []int{},
  6136  		},
  6137  		{
  6138  			name: "",
  6139  			fields: fields{
  6140  				e: []int{1, 2, 3},
  6141  			},
  6142  			want: []int{1, 2, 3},
  6143  		},
  6144  		{
  6145  			name: "",
  6146  			fields: fields{
  6147  				e: []int{2, 1, 3},
  6148  			},
  6149  			want: []int{1, 2, 3},
  6150  		},
  6151  	}
  6152  	for _, tt := range tests {
  6153  		t.Run(tt.name, func(t *testing.T) {
  6154  			x := NewSafeComparableBSliceBySlice(tt.fields.e)
  6155  			x.SortFunc(func(i int, j int) bool {
  6156  				return i < j
  6157  			})
  6158  			assert.Equal(t, tt.want, x.ToMetaSlice())
  6159  		})
  6160  	}
  6161  }
  6162  
  6163  func TestSafeAnyBSlice_SortFuncToSlice(t *testing.T) {
  6164  	type fields struct {
  6165  		e []int
  6166  	}
  6167  
  6168  	tests := []struct {
  6169  		name   string
  6170  		fields fields
  6171  		want   []int
  6172  	}{
  6173  		{
  6174  			name: "nil",
  6175  			fields: fields{
  6176  				e: nil,
  6177  			},
  6178  			want: []int{},
  6179  		},
  6180  		{
  6181  			name: "",
  6182  			fields: fields{
  6183  				e: []int{},
  6184  			},
  6185  			want: []int{},
  6186  		},
  6187  		{
  6188  			name: "",
  6189  			fields: fields{
  6190  				e: []int{1, 2, 3},
  6191  			},
  6192  			want: []int{1, 2, 3},
  6193  		},
  6194  		{
  6195  			name: "",
  6196  			fields: fields{
  6197  				e: []int{2, 1, 3},
  6198  			},
  6199  			want: []int{1, 2, 3},
  6200  		},
  6201  	}
  6202  	for _, tt := range tests {
  6203  		t.Run(tt.name, func(t *testing.T) {
  6204  			x := NewSafeComparableBSliceBySlice(tt.fields.e)
  6205  			v := x.SortFuncToSlice(func(i int, j int) bool {
  6206  				return i < j
  6207  			})
  6208  			assert.Equal(t, tt.want, v)
  6209  		})
  6210  	}
  6211  }
  6212  
  6213  func TestSafeAnyBSlice_SortFuncToBSlice(t *testing.T) {
  6214  	type fields struct {
  6215  		e []int
  6216  	}
  6217  
  6218  	tests := []struct {
  6219  		name   string
  6220  		fields fields
  6221  		want   []int
  6222  	}{
  6223  		{
  6224  			name: "nil",
  6225  			fields: fields{
  6226  				e: nil,
  6227  			},
  6228  			want: []int{},
  6229  		},
  6230  		{
  6231  			name: "",
  6232  			fields: fields{
  6233  				e: []int{},
  6234  			},
  6235  			want: []int{},
  6236  		},
  6237  		{
  6238  			name: "",
  6239  			fields: fields{
  6240  				e: []int{1, 2, 3},
  6241  			},
  6242  			want: []int{1, 2, 3},
  6243  		},
  6244  		{
  6245  			name: "",
  6246  			fields: fields{
  6247  				e: []int{2, 1, 3},
  6248  			},
  6249  			want: []int{1, 2, 3},
  6250  		},
  6251  	}
  6252  	for _, tt := range tests {
  6253  		t.Run(tt.name, func(t *testing.T) {
  6254  			x := NewSafeComparableBSliceBySlice(tt.fields.e)
  6255  			v := x.SortFuncToBSlice(func(i int, j int) bool {
  6256  				return i < j
  6257  			})
  6258  			assert.Equal(t, tt.want, v.ToMetaSlice())
  6259  		})
  6260  	}
  6261  }
  6262  
  6263  func TestSafeAnyBSlice_SortStableFunc(t *testing.T) {
  6264  	type fields struct {
  6265  		e []int
  6266  	}
  6267  
  6268  	tests := []struct {
  6269  		name   string
  6270  		fields fields
  6271  		want   []int
  6272  	}{
  6273  		{
  6274  			name: "nil",
  6275  			fields: fields{
  6276  				e: nil,
  6277  			},
  6278  			want: nil,
  6279  		},
  6280  		{
  6281  			name: "",
  6282  			fields: fields{
  6283  				e: []int{},
  6284  			},
  6285  			want: []int{},
  6286  		},
  6287  		{
  6288  			name: "",
  6289  			fields: fields{
  6290  				e: []int{1, 2, 3},
  6291  			},
  6292  			want: []int{1, 2, 3},
  6293  		},
  6294  		{
  6295  			name: "",
  6296  			fields: fields{
  6297  				e: []int{2, 1, 3},
  6298  			},
  6299  			want: []int{1, 2, 3},
  6300  		},
  6301  	}
  6302  	for _, tt := range tests {
  6303  		t.Run(tt.name, func(t *testing.T) {
  6304  			x := NewSafeComparableBSliceBySlice(tt.fields.e)
  6305  			x.SortStableFunc(func(i int, j int) bool {
  6306  				return i < j
  6307  			})
  6308  			assert.Equal(t, tt.want, x.ToMetaSlice())
  6309  		})
  6310  	}
  6311  }
  6312  
  6313  func TestSafeAnyBSlice_SortStableFuncToSlice(t *testing.T) {
  6314  	type fields struct {
  6315  		e []int
  6316  	}
  6317  
  6318  	tests := []struct {
  6319  		name   string
  6320  		fields fields
  6321  		want   []int
  6322  	}{
  6323  		{
  6324  			name: "nil",
  6325  			fields: fields{
  6326  				e: nil,
  6327  			},
  6328  			want: []int{},
  6329  		},
  6330  		{
  6331  			name: "",
  6332  			fields: fields{
  6333  				e: []int{},
  6334  			},
  6335  			want: []int{},
  6336  		},
  6337  		{
  6338  			name: "",
  6339  			fields: fields{
  6340  				e: []int{1, 2, 3},
  6341  			},
  6342  			want: []int{1, 2, 3},
  6343  		},
  6344  		{
  6345  			name: "",
  6346  			fields: fields{
  6347  				e: []int{2, 1, 3},
  6348  			},
  6349  			want: []int{1, 2, 3},
  6350  		},
  6351  	}
  6352  	for _, tt := range tests {
  6353  		t.Run(tt.name, func(t *testing.T) {
  6354  			x := NewSafeComparableBSliceBySlice(tt.fields.e)
  6355  			v := x.SortStableFuncToSlice(func(i int, j int) bool {
  6356  				return i < j
  6357  			})
  6358  			assert.Equal(t, tt.want, v)
  6359  		})
  6360  	}
  6361  }
  6362  
  6363  func TestSafeAnyBSlice_SortStableFuncToBSlice(t *testing.T) {
  6364  	type fields struct {
  6365  		e []int
  6366  	}
  6367  
  6368  	tests := []struct {
  6369  		name   string
  6370  		fields fields
  6371  		want   []int
  6372  	}{
  6373  		{
  6374  			name: "nil",
  6375  			fields: fields{
  6376  				e: nil,
  6377  			},
  6378  			want: []int{},
  6379  		},
  6380  		{
  6381  			name: "",
  6382  			fields: fields{
  6383  				e: []int{},
  6384  			},
  6385  			want: []int{},
  6386  		},
  6387  		{
  6388  			name: "",
  6389  			fields: fields{
  6390  				e: []int{1, 2, 3},
  6391  			},
  6392  			want: []int{1, 2, 3},
  6393  		},
  6394  		{
  6395  			name: "",
  6396  			fields: fields{
  6397  				e: []int{2, 1, 3},
  6398  			},
  6399  			want: []int{1, 2, 3},
  6400  		},
  6401  	}
  6402  	for _, tt := range tests {
  6403  		t.Run(tt.name, func(t *testing.T) {
  6404  			x := NewSafeComparableBSliceBySlice(tt.fields.e)
  6405  			v := x.SortStableFuncToBSlice(func(i int, j int) bool {
  6406  				return i < j
  6407  			})
  6408  			assert.Equal(t, tt.want, v.ToMetaSlice())
  6409  		})
  6410  	}
  6411  }
  6412  
  6413  func TestSafeAnyBSlice_IsSortedFunc(t *testing.T) {
  6414  	type fields struct {
  6415  		e []int
  6416  	}
  6417  	tests := []struct {
  6418  		name   string
  6419  		fields fields
  6420  		want   bool
  6421  	}{
  6422  		{
  6423  			name: "",
  6424  			fields: fields{
  6425  				e: nil,
  6426  			},
  6427  			want: true,
  6428  		},
  6429  		{
  6430  			name: "",
  6431  			fields: fields{
  6432  				e: []int{},
  6433  			},
  6434  			want: true,
  6435  		},
  6436  		{
  6437  			name: "",
  6438  			fields: fields{
  6439  				e: []int{1, 1, 1},
  6440  			},
  6441  			want: true,
  6442  		},
  6443  		{
  6444  			name: "",
  6445  			fields: fields{
  6446  				e: []int{1, 2, 3},
  6447  			},
  6448  			want: true,
  6449  		},
  6450  		{
  6451  			name: "",
  6452  			fields: fields{
  6453  				e: []int{2, 1, 3},
  6454  			},
  6455  			want: false,
  6456  		},
  6457  		{
  6458  			name: "",
  6459  			fields: fields{
  6460  				e: []int{3, 2, 1},
  6461  			},
  6462  			want: false,
  6463  		},
  6464  	}
  6465  	for _, tt := range tests {
  6466  		t.Run(tt.name, func(t *testing.T) {
  6467  			x := NewSafeComparableBSliceBySlice(tt.fields.e)
  6468  			assert.Equalf(t, tt.want, x.IsSortedFunc(func(i, j int) bool {
  6469  				return i < j
  6470  			}), "IsSortedFunc()")
  6471  		})
  6472  	}
  6473  }
  6474  
  6475  func TestSafeAnyBSlice_BinarySearchFunc(t *testing.T) {
  6476  	type fields struct {
  6477  		e []int
  6478  	}
  6479  	type args struct {
  6480  		e int
  6481  	}
  6482  	tests := []struct {
  6483  		name   string
  6484  		fields fields
  6485  		args   args
  6486  		want   int
  6487  		want1  bool
  6488  	}{
  6489  		{
  6490  			name: "nil",
  6491  			fields: fields{
  6492  				e: nil,
  6493  			},
  6494  			args: args{
  6495  				e: 0,
  6496  			},
  6497  			want:  0,
  6498  			want1: false,
  6499  		},
  6500  		{
  6501  			name: "",
  6502  			fields: fields{
  6503  				e: []int{},
  6504  			},
  6505  			args: args{
  6506  				e: 0,
  6507  			},
  6508  			want:  0,
  6509  			want1: false,
  6510  		},
  6511  		{
  6512  			name: "",
  6513  			fields: fields{
  6514  				e: []int{1, 3, 5},
  6515  			},
  6516  			args: args{
  6517  				e: 0,
  6518  			},
  6519  			want:  0,
  6520  			want1: false,
  6521  		},
  6522  		{
  6523  			name: "",
  6524  			fields: fields{
  6525  				e: []int{1, 3, 5},
  6526  			},
  6527  			args: args{
  6528  				e: 1,
  6529  			},
  6530  			want:  0,
  6531  			want1: true,
  6532  		},
  6533  		{
  6534  			name: "",
  6535  			fields: fields{
  6536  				e: []int{1, 3, 5},
  6537  			},
  6538  			args: args{
  6539  				e: 2,
  6540  			},
  6541  			want:  1,
  6542  			want1: false,
  6543  		},
  6544  		{
  6545  			name: "",
  6546  			fields: fields{
  6547  				e: []int{1, 3, 5},
  6548  			},
  6549  			args: args{
  6550  				e: 3,
  6551  			},
  6552  			want:  1,
  6553  			want1: true,
  6554  		},
  6555  		{
  6556  			name: "",
  6557  			fields: fields{
  6558  				e: []int{1, 3, 5},
  6559  			},
  6560  			args: args{
  6561  				e: 4,
  6562  			},
  6563  			want:  2,
  6564  			want1: false,
  6565  		},
  6566  		{
  6567  			name: "",
  6568  			fields: fields{
  6569  				e: []int{1, 3, 5},
  6570  			},
  6571  			args: args{
  6572  				e: 5,
  6573  			},
  6574  			want:  2,
  6575  			want1: true,
  6576  		},
  6577  		{
  6578  			name: "",
  6579  			fields: fields{
  6580  				e: []int{1, 3, 5},
  6581  			},
  6582  			args: args{
  6583  				e: 6,
  6584  			},
  6585  			want:  3,
  6586  			want1: false,
  6587  		},
  6588  		{
  6589  			name: "",
  6590  			fields: fields{
  6591  				e: []int{1, 3, 5, 7},
  6592  			},
  6593  			args: args{
  6594  				e: 0,
  6595  			},
  6596  			want:  0,
  6597  			want1: false,
  6598  		},
  6599  		{
  6600  			name: "",
  6601  			fields: fields{
  6602  				e: []int{1, 3, 5, 7},
  6603  			},
  6604  			args: args{
  6605  				e: 1,
  6606  			},
  6607  			want:  0,
  6608  			want1: true,
  6609  		},
  6610  		{
  6611  			name: "",
  6612  			fields: fields{
  6613  				e: []int{1, 3, 5, 7},
  6614  			},
  6615  			args: args{
  6616  				e: 2,
  6617  			},
  6618  			want:  1,
  6619  			want1: false,
  6620  		},
  6621  		{
  6622  			name: "",
  6623  			fields: fields{
  6624  				e: []int{1, 3, 5, 7},
  6625  			},
  6626  			args: args{
  6627  				e: 3,
  6628  			},
  6629  			want:  1,
  6630  			want1: true,
  6631  		},
  6632  		{
  6633  			name: "",
  6634  			fields: fields{
  6635  				e: []int{1, 3, 5, 7},
  6636  			},
  6637  			args: args{
  6638  				e: 4,
  6639  			},
  6640  			want:  2,
  6641  			want1: false,
  6642  		},
  6643  		{
  6644  			name: "",
  6645  			fields: fields{
  6646  				e: []int{1, 3, 5, 7},
  6647  			},
  6648  			args: args{
  6649  				e: 5,
  6650  			},
  6651  			want:  2,
  6652  			want1: true,
  6653  		},
  6654  		{
  6655  			name: "",
  6656  			fields: fields{
  6657  				e: []int{1, 3, 5, 7},
  6658  			},
  6659  			args: args{
  6660  				e: 6,
  6661  			},
  6662  			want:  3,
  6663  			want1: false,
  6664  		},
  6665  		{
  6666  			name: "",
  6667  			fields: fields{
  6668  				e: []int{1, 3, 5, 7},
  6669  			},
  6670  			args: args{
  6671  				e: 7,
  6672  			},
  6673  			want:  3,
  6674  			want1: true,
  6675  		},
  6676  		{
  6677  			name: "",
  6678  			fields: fields{
  6679  				e: []int{1, 3, 5, 7},
  6680  			},
  6681  			args: args{
  6682  				e: 8,
  6683  			},
  6684  			want:  4,
  6685  			want1: false,
  6686  		},
  6687  	}
  6688  	for _, tt := range tests {
  6689  		t.Run(tt.name, func(t *testing.T) {
  6690  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  6691  			got, got1 := x.BinarySearchFunc(tt.args.e, bcomparator.IntComparator())
  6692  			assert.Equalf(t, tt.want, got, "BinarySearchFunc(%v, %v)", tt.args.e, bcomparator.IntComparator())
  6693  			assert.Equalf(t, tt.want1, got1, "BinarySearchFunc(%v, %v)", tt.args.e, bcomparator.IntComparator())
  6694  		})
  6695  	}
  6696  }
  6697  
  6698  func TestSafeAnyBSlice_Filter(t *testing.T) {
  6699  	type fields struct {
  6700  		e []int
  6701  	}
  6702  	type args struct {
  6703  		f func(int2 int) bool
  6704  	}
  6705  	tests := []struct {
  6706  		name   string
  6707  		fields fields
  6708  		args   args
  6709  		want   []int
  6710  	}{
  6711  		{
  6712  			name: "nil",
  6713  			fields: fields{
  6714  				e: nil,
  6715  			},
  6716  			args: args{
  6717  				f: func(int2 int) bool {
  6718  					return true
  6719  				},
  6720  			},
  6721  			want: nil,
  6722  		},
  6723  		{
  6724  			name: "",
  6725  			fields: fields{
  6726  				e: []int{0, 1, 2, 3, 4},
  6727  			},
  6728  			args: args{
  6729  				f: func(int2 int) bool {
  6730  					return true
  6731  				},
  6732  			},
  6733  			want: []int{0, 1, 2, 3, 4},
  6734  		},
  6735  		{
  6736  			name: "",
  6737  			fields: fields{
  6738  				e: []int{0, 1, 2, 3, 4},
  6739  			},
  6740  			args: args{
  6741  				f: func(i int) bool {
  6742  					return i%2 == 0
  6743  				},
  6744  			},
  6745  			want: []int{0, 2, 4},
  6746  		},
  6747  		{
  6748  			name: "",
  6749  			fields: fields{
  6750  				e: []int{0, 1, 2, 3, 4},
  6751  			},
  6752  			args: args{
  6753  				f: func(i int) bool {
  6754  					return i%2 != 0
  6755  				},
  6756  			},
  6757  			want: []int{1, 3},
  6758  		},
  6759  		{
  6760  			name: "",
  6761  			fields: fields{
  6762  				e: []int{0, 1, 2, 3, 4},
  6763  			},
  6764  			args: args{
  6765  				f: func(i int) bool {
  6766  					return false
  6767  				},
  6768  			},
  6769  			want: nil,
  6770  		},
  6771  	}
  6772  	for _, tt := range tests {
  6773  		t.Run(tt.name, func(t *testing.T) {
  6774  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  6775  			x.Filter(tt.args.f)
  6776  			assert.Equalf(t, tt.want, x.ToMetaSlice(), "Filter(%v)", tt.args.f)
  6777  		})
  6778  	}
  6779  }
  6780  
  6781  func TestSafeAnyBSlice_FilterToSlice(t *testing.T) {
  6782  	type fields struct {
  6783  		e []int
  6784  	}
  6785  	type args struct {
  6786  		f func(int2 int) bool
  6787  	}
  6788  	tests := []struct {
  6789  		name   string
  6790  		fields fields
  6791  		args   args
  6792  		want   []int
  6793  	}{
  6794  		{
  6795  			name: "nil",
  6796  			fields: fields{
  6797  				e: nil,
  6798  			},
  6799  			args: args{
  6800  				f: func(int2 int) bool {
  6801  					return true
  6802  				},
  6803  			},
  6804  			want: nil,
  6805  		},
  6806  		{
  6807  			name: "",
  6808  			fields: fields{
  6809  				e: []int{0, 1, 2, 3, 4},
  6810  			},
  6811  			args: args{
  6812  				f: func(int2 int) bool {
  6813  					return true
  6814  				},
  6815  			},
  6816  			want: []int{0, 1, 2, 3, 4},
  6817  		},
  6818  		{
  6819  			name: "",
  6820  			fields: fields{
  6821  				e: []int{0, 1, 2, 3, 4},
  6822  			},
  6823  			args: args{
  6824  				f: func(i int) bool {
  6825  					return i%2 == 0
  6826  				},
  6827  			},
  6828  			want: []int{0, 2, 4},
  6829  		},
  6830  		{
  6831  			name: "",
  6832  			fields: fields{
  6833  				e: []int{0, 1, 2, 3, 4},
  6834  			},
  6835  			args: args{
  6836  				f: func(i int) bool {
  6837  					return i%2 != 0
  6838  				},
  6839  			},
  6840  			want: []int{1, 3},
  6841  		},
  6842  		{
  6843  			name: "",
  6844  			fields: fields{
  6845  				e: []int{0, 1, 2, 3, 4},
  6846  			},
  6847  			args: args{
  6848  				f: func(i int) bool {
  6849  					return false
  6850  				},
  6851  			},
  6852  			want: nil,
  6853  		},
  6854  	}
  6855  	for _, tt := range tests {
  6856  		t.Run(tt.name, func(t *testing.T) {
  6857  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  6858  			assert.Equalf(t, tt.want, x.FilterToSlice(tt.args.f), "FilterToSlice(%v)", tt.args.f)
  6859  		})
  6860  	}
  6861  }
  6862  
  6863  func TestSafeAnyBSlice_FilterToBSlice(t *testing.T) {
  6864  	type fields struct {
  6865  		e []int
  6866  	}
  6867  	type args struct {
  6868  		f func(int2 int) bool
  6869  	}
  6870  	tests := []struct {
  6871  		name   string
  6872  		fields fields
  6873  		args   args
  6874  		want   []int
  6875  	}{
  6876  		{
  6877  			name: "nil",
  6878  			fields: fields{
  6879  				e: nil,
  6880  			},
  6881  			args: args{
  6882  				f: func(int2 int) bool {
  6883  					return true
  6884  				},
  6885  			},
  6886  			want: nil,
  6887  		},
  6888  		{
  6889  			name: "",
  6890  			fields: fields{
  6891  				e: []int{0, 1, 2, 3, 4},
  6892  			},
  6893  			args: args{
  6894  				f: func(int2 int) bool {
  6895  					return true
  6896  				},
  6897  			},
  6898  			want: []int{0, 1, 2, 3, 4},
  6899  		},
  6900  		{
  6901  			name: "",
  6902  			fields: fields{
  6903  				e: []int{0, 1, 2, 3, 4},
  6904  			},
  6905  			args: args{
  6906  				f: func(i int) bool {
  6907  					return i%2 == 0
  6908  				},
  6909  			},
  6910  			want: []int{0, 2, 4},
  6911  		},
  6912  		{
  6913  			name: "",
  6914  			fields: fields{
  6915  				e: []int{0, 1, 2, 3, 4},
  6916  			},
  6917  			args: args{
  6918  				f: func(i int) bool {
  6919  					return i%2 != 0
  6920  				},
  6921  			},
  6922  			want: []int{1, 3},
  6923  		},
  6924  		{
  6925  			name: "",
  6926  			fields: fields{
  6927  				e: []int{0, 1, 2, 3, 4},
  6928  			},
  6929  			args: args{
  6930  				f: func(i int) bool {
  6931  					return false
  6932  				},
  6933  			},
  6934  			want: nil,
  6935  		},
  6936  	}
  6937  	for _, tt := range tests {
  6938  		t.Run(tt.name, func(t *testing.T) {
  6939  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  6940  			assert.Equalf(t, tt.want, x.FilterToBSlice(tt.args.f).ToMetaSlice(), "FilterToBSlice(%v)", tt.args.f)
  6941  		})
  6942  	}
  6943  }
  6944  
  6945  func TestSafeAnyBSlice_Reverse(t *testing.T) {
  6946  	type fields struct {
  6947  		e []int
  6948  	}
  6949  	tests := []struct {
  6950  		name   string
  6951  		fields fields
  6952  		want   []int
  6953  	}{
  6954  		{
  6955  			name: "nil",
  6956  			fields: fields{
  6957  				e: nil,
  6958  			},
  6959  			want: nil,
  6960  		},
  6961  		{
  6962  			name: "",
  6963  			fields: fields{
  6964  				e: []int{},
  6965  			},
  6966  			want: []int{},
  6967  		},
  6968  		{
  6969  			name: "",
  6970  			fields: fields{
  6971  				e: []int{1},
  6972  			},
  6973  			want: []int{1},
  6974  		},
  6975  		{
  6976  			name: "",
  6977  			fields: fields{
  6978  				e: []int{1, 2, 3},
  6979  			},
  6980  			want: []int{3, 2, 1},
  6981  		},
  6982  		{
  6983  			name: "",
  6984  			fields: fields{
  6985  				e: []int{1, 2, 3, 4},
  6986  			},
  6987  			want: []int{4, 3, 2, 1},
  6988  		},
  6989  	}
  6990  	for _, tt := range tests {
  6991  		t.Run(tt.name, func(t *testing.T) {
  6992  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  6993  			x.Reverse()
  6994  			assert.Equalf(t, tt.want, x.ToMetaSlice(), "Reverse()")
  6995  		})
  6996  	}
  6997  }
  6998  
  6999  func TestSafeAnyBSlice_ReverseToSlice(t *testing.T) {
  7000  	type fields struct {
  7001  		e []int
  7002  	}
  7003  	tests := []struct {
  7004  		name   string
  7005  		fields fields
  7006  		want   []int
  7007  	}{
  7008  		{
  7009  			name: "nil",
  7010  			fields: fields{
  7011  				e: nil,
  7012  			},
  7013  			want: []int{},
  7014  		},
  7015  		{
  7016  			name: "",
  7017  			fields: fields{
  7018  				e: []int{},
  7019  			},
  7020  			want: []int{},
  7021  		},
  7022  		{
  7023  			name: "",
  7024  			fields: fields{
  7025  				e: []int{1},
  7026  			},
  7027  			want: []int{1},
  7028  		},
  7029  		{
  7030  			name: "",
  7031  			fields: fields{
  7032  				e: []int{1, 2, 3},
  7033  			},
  7034  			want: []int{3, 2, 1},
  7035  		},
  7036  		{
  7037  			name: "",
  7038  			fields: fields{
  7039  				e: []int{1, 2, 3, 4},
  7040  			},
  7041  			want: []int{4, 3, 2, 1},
  7042  		},
  7043  	}
  7044  	for _, tt := range tests {
  7045  		t.Run(tt.name, func(t *testing.T) {
  7046  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  7047  			assert.Equalf(t, tt.want, x.ReverseToSlice(), "ReverseToSlice()")
  7048  		})
  7049  	}
  7050  }
  7051  
  7052  func TestSafeAnyBSlice_ReverseToBSlice(t *testing.T) {
  7053  	type fields struct {
  7054  		e []int
  7055  	}
  7056  	tests := []struct {
  7057  		name   string
  7058  		fields fields
  7059  		want   []int
  7060  	}{
  7061  		{
  7062  			name: "nil",
  7063  			fields: fields{
  7064  				e: nil,
  7065  			},
  7066  			want: []int{},
  7067  		},
  7068  		{
  7069  			name: "",
  7070  			fields: fields{
  7071  				e: []int{},
  7072  			},
  7073  			want: []int{},
  7074  		},
  7075  		{
  7076  			name: "",
  7077  			fields: fields{
  7078  				e: []int{1},
  7079  			},
  7080  			want: []int{1},
  7081  		},
  7082  		{
  7083  			name: "",
  7084  			fields: fields{
  7085  				e: []int{1, 2, 3},
  7086  			},
  7087  			want: []int{3, 2, 1},
  7088  		},
  7089  		{
  7090  			name: "",
  7091  			fields: fields{
  7092  				e: []int{1, 2, 3, 4},
  7093  			},
  7094  			want: []int{4, 3, 2, 1},
  7095  		},
  7096  	}
  7097  	for _, tt := range tests {
  7098  		t.Run(tt.name, func(t *testing.T) {
  7099  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  7100  			assert.Equalf(t, tt.want, x.ReverseToBSlice().ToMetaSlice(), "ReverseToBSlice()")
  7101  		})
  7102  	}
  7103  }
  7104  
  7105  func TestSafeAnyBSlice_Marshal(t *testing.T) {
  7106  	type fields struct {
  7107  		e []int
  7108  	}
  7109  	tests := []struct {
  7110  		name   string
  7111  		fields fields
  7112  		want   []byte
  7113  	}{
  7114  		{
  7115  			name: "nil",
  7116  			fields: fields{
  7117  				e: nil,
  7118  			},
  7119  			want: []byte("[]"),
  7120  		},
  7121  		{
  7122  			name: "",
  7123  			fields: fields{
  7124  				e: []int{},
  7125  			},
  7126  			want: []byte("[]"),
  7127  		},
  7128  		{
  7129  			name: "",
  7130  			fields: fields{
  7131  				e: []int{1, 2, 3},
  7132  			},
  7133  			want: []byte("[1,2,3]"),
  7134  		},
  7135  	}
  7136  	for _, tt := range tests {
  7137  		t.Run(tt.name, func(t *testing.T) {
  7138  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  7139  			got, err := x.Marshal()
  7140  			assert.Equal(t, false, err != nil)
  7141  			assert.Equalf(t, tt.want, got, "Marshal()")
  7142  		})
  7143  	}
  7144  }
  7145  
  7146  func TestSafeAnyBSlice_Unmarshal(t *testing.T) {
  7147  	type fields struct {
  7148  		e []int
  7149  	}
  7150  	type args struct {
  7151  		data []byte
  7152  	}
  7153  	tests := []struct {
  7154  		name   string
  7155  		fields fields
  7156  		args   args
  7157  		want   []int
  7158  	}{
  7159  		{
  7160  			name:   "",
  7161  			fields: fields{},
  7162  			args: args{
  7163  				data: []byte("[]"),
  7164  			},
  7165  			want: []int{},
  7166  		},
  7167  		{
  7168  			name:   "",
  7169  			fields: fields{},
  7170  			args: args{
  7171  				data: []byte("[1,2,3]"),
  7172  			},
  7173  			want: []int{1, 2, 3},
  7174  		},
  7175  	}
  7176  	for _, tt := range tests {
  7177  		t.Run(tt.name, func(t *testing.T) {
  7178  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  7179  			err := x.Unmarshal(tt.args.data)
  7180  			assert.Equal(t, false, err != nil)
  7181  			assert.Equal(t, tt.want, x.ToMetaSlice())
  7182  
  7183  		})
  7184  	}
  7185  }
  7186  
  7187  func TestSafeAnyBSlice_Len(t *testing.T) {
  7188  	type fields struct {
  7189  		e []int
  7190  	}
  7191  	tests := []struct {
  7192  		name   string
  7193  		fields fields
  7194  		want   int
  7195  	}{
  7196  		{
  7197  			name: "nil",
  7198  			fields: fields{
  7199  				e: nil,
  7200  			},
  7201  			want: 0,
  7202  		},
  7203  		{
  7204  			name: "nil",
  7205  			fields: fields{
  7206  				e: []int{},
  7207  			},
  7208  			want: 0,
  7209  		},
  7210  		{
  7211  			name: "nil",
  7212  			fields: fields{
  7213  				e: make([]int, 0, 10),
  7214  			},
  7215  			want: 0,
  7216  		},
  7217  		{
  7218  			name: "nil",
  7219  			fields: fields{
  7220  				e: make([]int, 10),
  7221  			},
  7222  			want: 10,
  7223  		},
  7224  		{
  7225  			name: "nil",
  7226  			fields: fields{
  7227  				e: make([]int, 10, 20),
  7228  			},
  7229  			want: 10,
  7230  		},
  7231  	}
  7232  	for _, tt := range tests {
  7233  		t.Run(tt.name, func(t *testing.T) {
  7234  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  7235  			assert.Equalf(t, tt.want, x.Len(), "Len()")
  7236  		})
  7237  	}
  7238  }
  7239  
  7240  func TestSafeAnyBSlice_Cap(t *testing.T) {
  7241  	type fields struct {
  7242  		e []int
  7243  	}
  7244  	tests := []struct {
  7245  		name   string
  7246  		fields fields
  7247  		want   int
  7248  	}{
  7249  		{
  7250  			name: "nil",
  7251  			fields: fields{
  7252  				e: nil,
  7253  			},
  7254  			want: 0,
  7255  		},
  7256  		{
  7257  			name: "nil",
  7258  			fields: fields{
  7259  				e: []int{},
  7260  			},
  7261  			want: 0,
  7262  		},
  7263  		{
  7264  			name: "nil",
  7265  			fields: fields{
  7266  				e: make([]int, 0, 10),
  7267  			},
  7268  			want: 10,
  7269  		},
  7270  		{
  7271  			name: "nil",
  7272  			fields: fields{
  7273  				e: make([]int, 10),
  7274  			},
  7275  			want: 10,
  7276  		},
  7277  		{
  7278  			name: "nil",
  7279  			fields: fields{
  7280  				e: make([]int, 10, 20),
  7281  			},
  7282  			want: 20,
  7283  		},
  7284  	}
  7285  	for _, tt := range tests {
  7286  		t.Run(tt.name, func(t *testing.T) {
  7287  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  7288  			assert.Equalf(t, tt.want, x.Cap(), "Cap()")
  7289  		})
  7290  	}
  7291  }
  7292  
  7293  func TestSafeAnyBSlice_ToInterfaceSlice(t *testing.T) {
  7294  	type fields struct {
  7295  		e []int
  7296  	}
  7297  	tests := []struct {
  7298  		name   string
  7299  		fields fields
  7300  		want   []interface{}
  7301  	}{
  7302  		{
  7303  			name: "nil",
  7304  			fields: fields{
  7305  				e: nil,
  7306  			},
  7307  			want: []interface{}{},
  7308  		},
  7309  		{
  7310  			name: "nil",
  7311  			fields: fields{
  7312  				e: []int{},
  7313  			},
  7314  			want: []interface{}{},
  7315  		},
  7316  		{
  7317  			name: "nil",
  7318  			fields: fields{
  7319  				e: []int{1, 2, 3},
  7320  			},
  7321  			want: []interface{}{1, 2, 3},
  7322  		},
  7323  	}
  7324  	for _, tt := range tests {
  7325  		t.Run(tt.name, func(t *testing.T) {
  7326  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  7327  			assert.Equalf(t, tt.want, x.ToInterfaceSlice(), "ToInterfaceSlice()")
  7328  		})
  7329  	}
  7330  }
  7331  
  7332  func TestSafeAnyBSlice_Append(t *testing.T) {
  7333  	type fields struct {
  7334  		e []int
  7335  	}
  7336  	type args struct {
  7337  		es []int
  7338  	}
  7339  	tests := []struct {
  7340  		name   string
  7341  		fields fields
  7342  		args   args
  7343  		want   []int
  7344  	}{
  7345  		{
  7346  			name:   "",
  7347  			fields: fields{},
  7348  			args: args{
  7349  				es: nil,
  7350  			},
  7351  			want: nil,
  7352  		},
  7353  		{
  7354  			name: "",
  7355  			fields: fields{
  7356  				e: []int{},
  7357  			},
  7358  			args: args{
  7359  				es: nil,
  7360  			},
  7361  			want: []int{},
  7362  		},
  7363  		{
  7364  			name: "",
  7365  			fields: fields{
  7366  				e: nil,
  7367  			},
  7368  			args: args{
  7369  				es: []int{},
  7370  			},
  7371  			want: nil,
  7372  		},
  7373  		{
  7374  			name: "",
  7375  			fields: fields{
  7376  				e: nil,
  7377  			},
  7378  			args: args{
  7379  				es: []int{1, 2, 3},
  7380  			},
  7381  			want: []int{1, 2, 3},
  7382  		},
  7383  		{
  7384  			name: "",
  7385  			fields: fields{
  7386  				e: []int{1, 2, 3},
  7387  			},
  7388  			args: args{
  7389  				es: []int{4, 5, 6},
  7390  			},
  7391  			want: []int{1, 2, 3, 4, 5, 6},
  7392  		},
  7393  	}
  7394  	for _, tt := range tests {
  7395  		t.Run(tt.name, func(t *testing.T) {
  7396  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  7397  			x.Append(tt.args.es...)
  7398  			assert.Equalf(t, tt.want, x.ToMetaSlice(), "Append()")
  7399  		})
  7400  	}
  7401  }
  7402  
  7403  func TestSafeAnyBSlice_AppendToSlice(t *testing.T) {
  7404  	type fields struct {
  7405  		e []int
  7406  	}
  7407  	type args struct {
  7408  		es []int
  7409  	}
  7410  	tests := []struct {
  7411  		name   string
  7412  		fields fields
  7413  		args   args
  7414  		want   []int
  7415  	}{
  7416  		{
  7417  			name:   "",
  7418  			fields: fields{},
  7419  			args: args{
  7420  				es: nil,
  7421  			},
  7422  			want: []int{},
  7423  		},
  7424  		{
  7425  			name: "",
  7426  			fields: fields{
  7427  				e: []int{},
  7428  			},
  7429  			args: args{
  7430  				es: nil,
  7431  			},
  7432  			want: []int{},
  7433  		},
  7434  		{
  7435  			name: "",
  7436  			fields: fields{
  7437  				e: nil,
  7438  			},
  7439  			args: args{
  7440  				es: nil,
  7441  			},
  7442  			want: []int{},
  7443  		},
  7444  		{
  7445  			name: "",
  7446  			fields: fields{
  7447  				e: nil,
  7448  			},
  7449  			args: args{
  7450  				es: []int{1, 2, 3},
  7451  			},
  7452  			want: []int{1, 2, 3},
  7453  		},
  7454  		{
  7455  			name: "",
  7456  			fields: fields{
  7457  				e: []int{1, 2, 3},
  7458  			},
  7459  			args: args{
  7460  				es: []int{4, 5, 6},
  7461  			},
  7462  			want: []int{1, 2, 3, 4, 5, 6},
  7463  		},
  7464  	}
  7465  	for _, tt := range tests {
  7466  		t.Run(tt.name, func(t *testing.T) {
  7467  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  7468  			assert.Equalf(t, tt.want, x.AppendToSlice(tt.args.es...), "AppendToSlice()")
  7469  		})
  7470  	}
  7471  }
  7472  
  7473  func TestSafeAnyBSlice_AppendToBSlice(t *testing.T) {
  7474  	type fields struct {
  7475  		e []int
  7476  	}
  7477  	type args struct {
  7478  		es []int
  7479  	}
  7480  	tests := []struct {
  7481  		name   string
  7482  		fields fields
  7483  		args   args
  7484  		want   []int
  7485  	}{
  7486  		{
  7487  			name:   "",
  7488  			fields: fields{},
  7489  			args: args{
  7490  				es: nil,
  7491  			},
  7492  			want: []int{},
  7493  		},
  7494  		{
  7495  			name: "",
  7496  			fields: fields{
  7497  				e: []int{},
  7498  			},
  7499  			args: args{
  7500  				es: nil,
  7501  			},
  7502  			want: []int{},
  7503  		},
  7504  		{
  7505  			name: "",
  7506  			fields: fields{
  7507  				e: nil,
  7508  			},
  7509  			args: args{
  7510  				es: nil,
  7511  			},
  7512  			want: []int{},
  7513  		},
  7514  		{
  7515  			name: "",
  7516  			fields: fields{
  7517  				e: nil,
  7518  			},
  7519  			args: args{
  7520  				es: []int{1, 2, 3},
  7521  			},
  7522  			want: []int{1, 2, 3},
  7523  		},
  7524  		{
  7525  			name: "",
  7526  			fields: fields{
  7527  				e: []int{1, 2, 3},
  7528  			},
  7529  			args: args{
  7530  				es: []int{4, 5, 6},
  7531  			},
  7532  			want: []int{1, 2, 3, 4, 5, 6},
  7533  		},
  7534  	}
  7535  	for _, tt := range tests {
  7536  		t.Run(tt.name, func(t *testing.T) {
  7537  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  7538  			assert.Equalf(t, tt.want, x.AppendToBSlice(tt.args.es...).ToMetaSlice(), "AppendToBSlice()")
  7539  		})
  7540  	}
  7541  }
  7542  
  7543  func TestSafeAnyBSlice_CopyToSlice(t *testing.T) {
  7544  	type fields struct {
  7545  		e []int
  7546  	}
  7547  	tests := []struct {
  7548  		name   string
  7549  		fields fields
  7550  		want   []int
  7551  	}{
  7552  		{
  7553  			name:   "",
  7554  			fields: fields{},
  7555  
  7556  			want: []int{},
  7557  		},
  7558  		{
  7559  			name: "",
  7560  			fields: fields{
  7561  				e: []int{},
  7562  			},
  7563  			want: []int{},
  7564  		},
  7565  		{
  7566  			name: "",
  7567  			fields: fields{
  7568  				e: nil,
  7569  			},
  7570  			want: []int{},
  7571  		},
  7572  		{
  7573  			name: "",
  7574  			fields: fields{
  7575  				e: nil,
  7576  			},
  7577  			want: []int{},
  7578  		},
  7579  		{
  7580  			name: "",
  7581  			fields: fields{
  7582  				e: []int{1, 2, 3},
  7583  			},
  7584  			want: []int{1, 2, 3},
  7585  		},
  7586  	}
  7587  	for _, tt := range tests {
  7588  		t.Run(tt.name, func(t *testing.T) {
  7589  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  7590  			assert.Equalf(t, tt.want, x.CopyToSlice(), "CopyToSlice()")
  7591  		})
  7592  	}
  7593  }
  7594  
  7595  func TestSafeAnyBSlice_CopyToBSlice(t *testing.T) {
  7596  	type fields struct {
  7597  		e []int
  7598  	}
  7599  	tests := []struct {
  7600  		name   string
  7601  		fields fields
  7602  		want   []int
  7603  	}{
  7604  		{
  7605  			name:   "",
  7606  			fields: fields{},
  7607  
  7608  			want: []int{},
  7609  		},
  7610  		{
  7611  			name: "",
  7612  			fields: fields{
  7613  				e: []int{},
  7614  			},
  7615  			want: []int{},
  7616  		},
  7617  		{
  7618  			name: "",
  7619  			fields: fields{
  7620  				e: nil,
  7621  			},
  7622  			want: []int{},
  7623  		},
  7624  		{
  7625  			name: "",
  7626  			fields: fields{
  7627  				e: nil,
  7628  			},
  7629  			want: []int{},
  7630  		},
  7631  		{
  7632  			name: "",
  7633  			fields: fields{
  7634  				e: []int{1, 2, 3},
  7635  			},
  7636  			want: []int{1, 2, 3},
  7637  		},
  7638  	}
  7639  	for _, tt := range tests {
  7640  		t.Run(tt.name, func(t *testing.T) {
  7641  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  7642  			assert.Equalf(t, tt.want, x.CopyToBSlice().ToMetaSlice(), "CopyToBSlice()")
  7643  		})
  7644  	}
  7645  }
  7646  
  7647  func TestSafeAnyBSlice_GetByIndex(t *testing.T) {
  7648  	type fields struct {
  7649  		e []int
  7650  	}
  7651  	type args struct {
  7652  		index int
  7653  	}
  7654  	tests := []struct {
  7655  		name   string
  7656  		fields fields
  7657  		args   args
  7658  		want   int
  7659  	}{
  7660  		{
  7661  			name: "nil",
  7662  			fields: fields{
  7663  				e: nil,
  7664  			},
  7665  			args: args{
  7666  				index: 0,
  7667  			},
  7668  			want: 0,
  7669  		},
  7670  		{
  7671  			name: "nil",
  7672  			fields: fields{
  7673  				e: nil,
  7674  			},
  7675  			args: args{
  7676  				index: 1,
  7677  			},
  7678  			want: 0,
  7679  		},
  7680  		{
  7681  			name: "nil",
  7682  			fields: fields{
  7683  				e: nil,
  7684  			},
  7685  			args: args{
  7686  				index: -1,
  7687  			},
  7688  			want: 0,
  7689  		},
  7690  		{
  7691  			name: "",
  7692  			fields: fields{
  7693  				e: []int{1, 2, 3},
  7694  			},
  7695  			args: args{
  7696  				index: 0,
  7697  			},
  7698  			want: 1,
  7699  		},
  7700  		{
  7701  			name: "",
  7702  			fields: fields{
  7703  				e: []int{1, 2, 3},
  7704  			},
  7705  			args: args{
  7706  				index: 1,
  7707  			},
  7708  			want: 2,
  7709  		},
  7710  		{
  7711  			name: "",
  7712  			fields: fields{
  7713  				e: []int{1, 2, 3},
  7714  			},
  7715  			args: args{
  7716  				index: 2,
  7717  			},
  7718  			want: 3,
  7719  		},
  7720  		{
  7721  			name: "",
  7722  			fields: fields{
  7723  				e: []int{1, 2, 3},
  7724  			},
  7725  			args: args{
  7726  				index: 3,
  7727  			},
  7728  			want: 0,
  7729  		},
  7730  	}
  7731  	for _, tt := range tests {
  7732  		t.Run(tt.name, func(t *testing.T) {
  7733  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  7734  			assert.Equalf(t, tt.want, x.GetByIndex(tt.args.index), "GetByIndex(%v)", tt.args.index)
  7735  		})
  7736  	}
  7737  }
  7738  
  7739  func TestSafeAnyBSlice_GetByIndexE(t *testing.T) {
  7740  	type fields struct {
  7741  		e []int
  7742  	}
  7743  	type args struct {
  7744  		index int
  7745  	}
  7746  	tests := []struct {
  7747  		name    string
  7748  		fields  fields
  7749  		args    args
  7750  		want    int
  7751  		wanterr bool
  7752  	}{
  7753  		{
  7754  			name: "nil",
  7755  			fields: fields{
  7756  				e: nil,
  7757  			},
  7758  			args: args{
  7759  				index: 0,
  7760  			},
  7761  			want:    0,
  7762  			wanterr: true,
  7763  		},
  7764  		{
  7765  			name: "nil",
  7766  			fields: fields{
  7767  				e: nil,
  7768  			},
  7769  			args: args{
  7770  				index: 1,
  7771  			},
  7772  			want:    0,
  7773  			wanterr: true,
  7774  		},
  7775  		{
  7776  			name: "nil",
  7777  			fields: fields{
  7778  				e: nil,
  7779  			},
  7780  			args: args{
  7781  				index: -1,
  7782  			},
  7783  			want:    0,
  7784  			wanterr: true,
  7785  		},
  7786  		{
  7787  			name: "",
  7788  			fields: fields{
  7789  				e: []int{1, 2, 3},
  7790  			},
  7791  			args: args{
  7792  				index: 0,
  7793  			},
  7794  			want:    1,
  7795  			wanterr: false,
  7796  		},
  7797  		{
  7798  			name: "",
  7799  			fields: fields{
  7800  				e: []int{1, 2, 3},
  7801  			},
  7802  			args: args{
  7803  				index: 1,
  7804  			},
  7805  			want:    2,
  7806  			wanterr: false,
  7807  		},
  7808  		{
  7809  			name: "",
  7810  			fields: fields{
  7811  				e: []int{1, 2, 3},
  7812  			},
  7813  			args: args{
  7814  				index: 2,
  7815  			},
  7816  			want:    3,
  7817  			wanterr: false,
  7818  		},
  7819  		{
  7820  			name: "",
  7821  			fields: fields{
  7822  				e: []int{1, 2, 3},
  7823  			},
  7824  			args: args{
  7825  				index: 3,
  7826  			},
  7827  			want:    0,
  7828  			wanterr: true,
  7829  		},
  7830  	}
  7831  	for _, tt := range tests {
  7832  		t.Run(tt.name, func(t *testing.T) {
  7833  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  7834  			got, err := x.GetByIndexE(tt.args.index)
  7835  			assert.Equal(t, tt.wanterr, err != nil)
  7836  			assert.Equalf(t, tt.want, got, "GetByIndexE(%v)", tt.args.index)
  7837  		})
  7838  	}
  7839  }
  7840  
  7841  func TestSafeAnyBSlice_GetByIndexOrDefault(t *testing.T) {
  7842  	type fields struct {
  7843  		e []int
  7844  	}
  7845  	type args struct {
  7846  		index    int
  7847  		defaultE int
  7848  	}
  7849  	tests := []struct {
  7850  		name   string
  7851  		fields fields
  7852  		args   args
  7853  		want   int
  7854  	}{
  7855  		{
  7856  			name: "nil",
  7857  			fields: fields{
  7858  				e: nil,
  7859  			},
  7860  			args: args{
  7861  				index:    0,
  7862  				defaultE: 1,
  7863  			},
  7864  			want: 1,
  7865  		},
  7866  		{
  7867  			name: "nil",
  7868  			fields: fields{
  7869  				e: []int{},
  7870  			},
  7871  			args: args{
  7872  				index:    0,
  7873  				defaultE: 1,
  7874  			},
  7875  			want: 1,
  7876  		},
  7877  		{
  7878  			name: "nil",
  7879  			fields: fields{
  7880  				e: []int{1, 2, 3},
  7881  			},
  7882  			args: args{
  7883  				index:    0,
  7884  				defaultE: 2,
  7885  			},
  7886  			want: 1,
  7887  		},
  7888  	}
  7889  	for _, tt := range tests {
  7890  		t.Run(tt.name, func(t *testing.T) {
  7891  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  7892  			assert.Equalf(t, tt.want, x.GetByIndexOrDefault(tt.args.index, tt.args.defaultE), "GetByIndexOrDefault(%v, %v)", tt.args.index, tt.args.defaultE)
  7893  		})
  7894  	}
  7895  }
  7896  
  7897  func TestSafeAnyBSlice_GetByRange(t *testing.T) {
  7898  	type fields struct {
  7899  		e []int
  7900  	}
  7901  	type args struct {
  7902  		start int
  7903  		end   int
  7904  	}
  7905  	tests := []struct {
  7906  		name   string
  7907  		fields fields
  7908  		args   args
  7909  		want   []int
  7910  	}{
  7911  		{
  7912  			name: "nil",
  7913  			fields: fields{
  7914  				e: nil,
  7915  			},
  7916  			args: args{
  7917  				start: 0,
  7918  				end:   0,
  7919  			},
  7920  			want: nil,
  7921  		},
  7922  		{
  7923  			name: "",
  7924  			fields: fields{
  7925  				e: []int{},
  7926  			},
  7927  			args: args{
  7928  				start: 0,
  7929  				end:   0,
  7930  			},
  7931  			want: []int{},
  7932  		},
  7933  		{
  7934  			name: "",
  7935  			fields: fields{
  7936  				e: []int{1, 2, 3},
  7937  			},
  7938  			args: args{
  7939  				start: 0,
  7940  				end:   0,
  7941  			},
  7942  			want: []int{},
  7943  		},
  7944  		{
  7945  			name: "",
  7946  			fields: fields{
  7947  				e: []int{1, 2, 3},
  7948  			},
  7949  			args: args{
  7950  				start: 0,
  7951  				end:   3,
  7952  			},
  7953  			want: []int{1, 2, 3},
  7954  		},
  7955  		{
  7956  			name: "",
  7957  			fields: fields{
  7958  				e: []int{1, 2, 3},
  7959  			},
  7960  			args: args{
  7961  				start: 0,
  7962  				end:   4,
  7963  			},
  7964  			want: nil,
  7965  		},
  7966  	}
  7967  	for _, tt := range tests {
  7968  		t.Run(tt.name, func(t *testing.T) {
  7969  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  7970  			assert.Equalf(t, tt.want, x.GetByRange(tt.args.start, tt.args.end), "GetByRange(%v, %v)", tt.args.start, tt.args.end)
  7971  		})
  7972  	}
  7973  }
  7974  
  7975  func TestSafeAnyBSlice_GetByRangeE(t *testing.T) {
  7976  	type fields struct {
  7977  		e []int
  7978  	}
  7979  	type args struct {
  7980  		start int
  7981  		end   int
  7982  	}
  7983  	tests := []struct {
  7984  		name    string
  7985  		fields  fields
  7986  		args    args
  7987  		want    []int
  7988  		wanterr bool
  7989  	}{
  7990  		{
  7991  			name: "nil",
  7992  			fields: fields{
  7993  				e: nil,
  7994  			},
  7995  			args: args{
  7996  				start: 0,
  7997  				end:   0,
  7998  			},
  7999  			want:    nil,
  8000  			wanterr: false,
  8001  		},
  8002  		{
  8003  			name: "",
  8004  			fields: fields{
  8005  				e: []int{},
  8006  			},
  8007  			args: args{
  8008  				start: 0,
  8009  				end:   0,
  8010  			},
  8011  			want:    []int{},
  8012  			wanterr: false,
  8013  		},
  8014  		{
  8015  			name: "",
  8016  			fields: fields{
  8017  				e: []int{1, 2, 3},
  8018  			},
  8019  			args: args{
  8020  				start: 0,
  8021  				end:   0,
  8022  			},
  8023  			want:    []int{},
  8024  			wanterr: false,
  8025  		},
  8026  		{
  8027  			name: "",
  8028  			fields: fields{
  8029  				e: []int{1, 2, 3},
  8030  			},
  8031  			args: args{
  8032  				start: 0,
  8033  				end:   3,
  8034  			},
  8035  			want:    []int{1, 2, 3},
  8036  			wanterr: false,
  8037  		},
  8038  		{
  8039  			name: "",
  8040  			fields: fields{
  8041  				e: []int{1, 2, 3},
  8042  			},
  8043  			args: args{
  8044  				start: 0,
  8045  				end:   4,
  8046  			},
  8047  			want:    nil,
  8048  			wanterr: true,
  8049  		},
  8050  	}
  8051  	for _, tt := range tests {
  8052  		t.Run(tt.name, func(t *testing.T) {
  8053  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  8054  			got, err := x.GetByRangeE(tt.args.start, tt.args.end)
  8055  			assert.Equal(t, tt.wanterr, err != nil)
  8056  			assert.Equalf(t, tt.want, got, "GetByRangeE(%v, %v)", tt.args.start, tt.args.end)
  8057  		})
  8058  	}
  8059  }
  8060  
  8061  func TestSafeAnyBSlice_SetByIndex(t *testing.T) {
  8062  	type fields struct {
  8063  		e []int
  8064  	}
  8065  	type args struct {
  8066  		index int
  8067  		e     int
  8068  	}
  8069  	tests := []struct {
  8070  		name    string
  8071  		fields  fields
  8072  		args    args
  8073  		wanterr bool
  8074  	}{
  8075  		{
  8076  			name: "",
  8077  			fields: fields{
  8078  				e: nil,
  8079  			},
  8080  			args: args{
  8081  				index: 0,
  8082  				e:     1,
  8083  			},
  8084  			wanterr: true,
  8085  		},
  8086  		{
  8087  			name: "",
  8088  			fields: fields{
  8089  				e: []int{},
  8090  			},
  8091  			args: args{
  8092  				index: 0,
  8093  				e:     1,
  8094  			},
  8095  			wanterr: true,
  8096  		},
  8097  		{
  8098  			name: "",
  8099  			fields: fields{
  8100  				e: []int{1, 2, 3},
  8101  			},
  8102  			args: args{
  8103  				index: 0,
  8104  				e:     5,
  8105  			},
  8106  			wanterr: false,
  8107  		},
  8108  		{
  8109  			name: "",
  8110  			fields: fields{
  8111  				e: []int{1, 2, 3},
  8112  			},
  8113  			args: args{
  8114  				index: -1,
  8115  				e:     5,
  8116  			},
  8117  			wanterr: true,
  8118  		},
  8119  		{
  8120  			name: "",
  8121  			fields: fields{
  8122  				e: []int{1, 2, 3},
  8123  			},
  8124  			args: args{
  8125  				index: 1,
  8126  				e:     5,
  8127  			},
  8128  			wanterr: false,
  8129  		},
  8130  		{
  8131  			name: "",
  8132  			fields: fields{
  8133  				e: []int{1, 2, 3},
  8134  			},
  8135  			args: args{
  8136  				index: 2,
  8137  				e:     5,
  8138  			},
  8139  			wanterr: false,
  8140  		},
  8141  		{
  8142  			name: "",
  8143  			fields: fields{
  8144  				e: []int{1, 2, 3},
  8145  			},
  8146  			args: args{
  8147  				index: 3,
  8148  				e:     5,
  8149  			},
  8150  			wanterr: true,
  8151  		},
  8152  	}
  8153  	for _, tt := range tests {
  8154  		t.Run(tt.name, func(t *testing.T) {
  8155  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  8156  			x.SetByIndex(tt.args.index, tt.args.e)
  8157  			if !tt.wanterr {
  8158  				assert.Equalf(t, tt.args.e, x.GetByIndex(tt.args.index), "SetByIndex(%v, %v)", tt.args.index, tt.args.e)
  8159  			}
  8160  		})
  8161  	}
  8162  }
  8163  
  8164  func TestSafeAnyBSlice_SetByIndexE(t *testing.T) {
  8165  	type fields struct {
  8166  		e []int
  8167  	}
  8168  	type args struct {
  8169  		index int
  8170  		e     int
  8171  	}
  8172  	tests := []struct {
  8173  		name    string
  8174  		fields  fields
  8175  		args    args
  8176  		wanterr bool
  8177  	}{
  8178  		{
  8179  			name: "",
  8180  			fields: fields{
  8181  				e: nil,
  8182  			},
  8183  			args: args{
  8184  				index: 0,
  8185  				e:     1,
  8186  			},
  8187  			wanterr: true,
  8188  		},
  8189  		{
  8190  			name: "",
  8191  			fields: fields{
  8192  				e: []int{},
  8193  			},
  8194  			args: args{
  8195  				index: 0,
  8196  				e:     1,
  8197  			},
  8198  			wanterr: true,
  8199  		},
  8200  		{
  8201  			name: "",
  8202  			fields: fields{
  8203  				e: []int{1, 2, 3},
  8204  			},
  8205  			args: args{
  8206  				index: 0,
  8207  				e:     5,
  8208  			},
  8209  			wanterr: false,
  8210  		},
  8211  		{
  8212  			name: "",
  8213  			fields: fields{
  8214  				e: []int{1, 2, 3},
  8215  			},
  8216  			args: args{
  8217  				index: -1,
  8218  				e:     5,
  8219  			},
  8220  			wanterr: true,
  8221  		},
  8222  		{
  8223  			name: "",
  8224  			fields: fields{
  8225  				e: []int{1, 2, 3},
  8226  			},
  8227  			args: args{
  8228  				index: 1,
  8229  				e:     5,
  8230  			},
  8231  			wanterr: false,
  8232  		},
  8233  		{
  8234  			name: "",
  8235  			fields: fields{
  8236  				e: []int{1, 2, 3},
  8237  			},
  8238  			args: args{
  8239  				index: 2,
  8240  				e:     5,
  8241  			},
  8242  			wanterr: false,
  8243  		},
  8244  		{
  8245  			name: "",
  8246  			fields: fields{
  8247  				e: []int{1, 2, 3},
  8248  			},
  8249  			args: args{
  8250  				index: 3,
  8251  				e:     5,
  8252  			},
  8253  			wanterr: true,
  8254  		},
  8255  		{
  8256  			name: "",
  8257  			fields: fields{
  8258  				e: []int{1, 2, 3},
  8259  			},
  8260  			args: args{
  8261  				index: -1,
  8262  				e:     5,
  8263  			},
  8264  			wanterr: true,
  8265  		},
  8266  	}
  8267  	for _, tt := range tests {
  8268  		t.Run(tt.name, func(t *testing.T) {
  8269  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  8270  			err := x.SetByIndexE(tt.args.index, tt.args.e)
  8271  			assert.Equal(t, tt.wanterr, err != nil)
  8272  			if !tt.wanterr {
  8273  				assert.Equalf(t, tt.args.e, x.GetByIndex(tt.args.index), "SetByIndexE(%v, %v)", tt.args.index, tt.args.e)
  8274  			}
  8275  		})
  8276  	}
  8277  }
  8278  
  8279  func TestSafeAnyBSlice_SetByRange(t *testing.T) {
  8280  	type fields struct {
  8281  		e []int
  8282  	}
  8283  	type args struct {
  8284  		index int
  8285  		es    []int
  8286  	}
  8287  	tests := []struct {
  8288  		name    string
  8289  		fields  fields
  8290  		args    args
  8291  		want    []int
  8292  		wanterr bool
  8293  	}{
  8294  		{
  8295  			name: "",
  8296  			fields: fields{
  8297  				e: nil,
  8298  			},
  8299  			args: args{
  8300  				index: 0,
  8301  				es:    nil,
  8302  			},
  8303  			want:    nil,
  8304  			wanterr: false,
  8305  		},
  8306  		{
  8307  			name: "",
  8308  			fields: fields{
  8309  				e: nil,
  8310  			},
  8311  			args: args{
  8312  				index: 0,
  8313  				es:    []int{1, 2, 3},
  8314  			},
  8315  			want:    []int{1, 2, 3},
  8316  			wanterr: false,
  8317  		},
  8318  		{
  8319  			name: "",
  8320  			fields: fields{
  8321  				e: nil,
  8322  			},
  8323  			args: args{
  8324  				index: 2,
  8325  				es:    []int{1, 2, 3},
  8326  			},
  8327  			want:    []int{1, 2, 3},
  8328  			wanterr: false,
  8329  		},
  8330  		{
  8331  			name: "",
  8332  			fields: fields{
  8333  				e: []int{},
  8334  			},
  8335  			args: args{
  8336  				index: 2,
  8337  				es:    []int{1, 2, 3},
  8338  			},
  8339  			want:    []int{1, 2, 3},
  8340  			wanterr: false,
  8341  		},
  8342  		{
  8343  			name: "",
  8344  			fields: fields{
  8345  				e: []int{1, 2},
  8346  			},
  8347  			args: args{
  8348  				index: 2,
  8349  				es:    []int{3, 4, 5},
  8350  			},
  8351  			want:    []int{1, 2, 3, 4, 5},
  8352  			wanterr: false,
  8353  		},
  8354  		{
  8355  			name: "",
  8356  			fields: fields{
  8357  				e: []int{1, 2},
  8358  			},
  8359  			args: args{
  8360  				index: -1,
  8361  				es:    []int{3, 4, 5},
  8362  			},
  8363  			want:    []int{},
  8364  			wanterr: true,
  8365  		},
  8366  	}
  8367  	for _, tt := range tests {
  8368  		t.Run(tt.name, func(t *testing.T) {
  8369  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  8370  			err := x.SetByRangeE(tt.args.index, tt.args.es)
  8371  			assert.Equal(t, tt.wanterr, err != nil)
  8372  			if !tt.wanterr {
  8373  				assert.Equalf(t, tt.want, x.ToMetaSlice(), "SetByRange()")
  8374  			}
  8375  		})
  8376  	}
  8377  }
  8378  
  8379  func TestSafeAnyBSlice_SetByRangeE(t *testing.T) {
  8380  	type fields struct {
  8381  		e []int
  8382  	}
  8383  	type args struct {
  8384  		index int
  8385  		es    []int
  8386  	}
  8387  	tests := []struct {
  8388  		name    string
  8389  		fields  fields
  8390  		args    args
  8391  		want    []int
  8392  		wanterr bool
  8393  	}{
  8394  		{
  8395  			name: "",
  8396  			fields: fields{
  8397  				e: nil,
  8398  			},
  8399  			args: args{
  8400  				index: 0,
  8401  				es:    nil,
  8402  			},
  8403  			want:    nil,
  8404  			wanterr: false,
  8405  		},
  8406  		{
  8407  			name: "",
  8408  			fields: fields{
  8409  				e: nil,
  8410  			},
  8411  			args: args{
  8412  				index: 0,
  8413  				es:    []int{1, 2, 3},
  8414  			},
  8415  			want:    []int{1, 2, 3},
  8416  			wanterr: false,
  8417  		},
  8418  		{
  8419  			name: "",
  8420  			fields: fields{
  8421  				e: nil,
  8422  			},
  8423  			args: args{
  8424  				index: 2,
  8425  				es:    []int{1, 2, 3},
  8426  			},
  8427  			want:    []int{1, 2, 3},
  8428  			wanterr: false,
  8429  		},
  8430  		{
  8431  			name: "",
  8432  			fields: fields{
  8433  				e: []int{},
  8434  			},
  8435  			args: args{
  8436  				index: 2,
  8437  				es:    []int{1, 2, 3},
  8438  			},
  8439  			want:    []int{1, 2, 3},
  8440  			wanterr: false,
  8441  		},
  8442  		{
  8443  			name: "",
  8444  			fields: fields{
  8445  				e: []int{1, 2},
  8446  			},
  8447  			args: args{
  8448  				index: 2,
  8449  				es:    []int{3, 4, 5},
  8450  			},
  8451  			want:    []int{1, 2, 3, 4, 5},
  8452  			wanterr: false,
  8453  		},
  8454  		{
  8455  			name: "",
  8456  			fields: fields{
  8457  				e: []int{1, 2},
  8458  			},
  8459  			args: args{
  8460  				index: -1,
  8461  				es:    []int{3, 4, 5},
  8462  			},
  8463  			want:    []int{},
  8464  			wanterr: true,
  8465  		},
  8466  	}
  8467  	for _, tt := range tests {
  8468  		t.Run(tt.name, func(t *testing.T) {
  8469  			x := NewSafeAnyBSliceBySlice(tt.fields.e)
  8470  			err := x.SetByRangeE(tt.args.index, tt.args.es)
  8471  			assert.Equal(t, tt.wanterr, err != nil)
  8472  			if !tt.wanterr {
  8473  				assert.Equalf(t, tt.want, x.ToMetaSlice(), "SetByRangeE()")
  8474  			}
  8475  		})
  8476  	}
  8477  }