github.com/geniusesgroup/libgo@v0.0.0-20220713101832-828057a9d3d4/time/utc/weekday_test.go (about)

     1  /* For license and copyright information please see LEGAL file in repository */
     2  
     3  package utc
     4  
     5  import (
     6  	"testing"
     7  )
     8  
     9  func TestWeekdays_Check(t *testing.T) {
    10  	type args struct {
    11  		weekdays Weekdays
    12  		day      Weekdays
    13  	}
    14  	tests := []struct {
    15  		name      string
    16  		args      args
    17  		wantExist bool
    18  	}{
    19  		{
    20  			name: "test1",
    21  			args: args{
    22  				weekdays: Weekdays_Saturday | Weekdays_Monday,
    23  				day:      Weekdays_Saturday,
    24  			},
    25  			wantExist: true,
    26  		}, {
    27  			name: "reverse not work",
    28  			args: args{
    29  				weekdays: Weekdays_Saturday | Weekdays_Monday,
    30  				day:      Weekdays_Friday,
    31  			},
    32  			wantExist: false,
    33  		},
    34  	}
    35  	for _, tt := range tests {
    36  		t.Run(tt.name, func(t *testing.T) {
    37  			var gotExist = tt.args.weekdays.Check(tt.args.day)
    38  			if gotExist != tt.wantExist {
    39  				t.Errorf("Weekdays_Check() = %v, want %v", gotExist, tt.wantExist)
    40  			}
    41  		})
    42  	}
    43  }