github.com/mdaxf/iac@v0.0.0-20240519030858-58a061660378/engine/function/funcs_test.go (about)

     1  package funcs
     2  
     3  import (
     4  	"reflect"
     5  	"testing"
     6  	"time"
     7  )
     8  
     9  func TestFuncs_HandleInputs(t *testing.T) {
    10  	tests := []struct {
    11  		name    string
    12  		f       *Funcs
    13  		want    []string
    14  		want1   []string
    15  		want2   map[string]interface{}
    16  		wantErr bool
    17  	}{
    18  		// TODO: Add test cases.
    19  	}
    20  	for _, tt := range tests {
    21  		t.Run(tt.name, func(t *testing.T) {
    22  			got, got1, got2, err := tt.f.HandleInputs()
    23  			if (err != nil) != tt.wantErr {
    24  				t.Errorf("Funcs.HandleInputs() error = %v, wantErr %v", err, tt.wantErr)
    25  				return
    26  			}
    27  			if !reflect.DeepEqual(got, tt.want) {
    28  				t.Errorf("Funcs.HandleInputs() got = %v, want %v", got, tt.want)
    29  			}
    30  			if !reflect.DeepEqual(got1, tt.want1) {
    31  				t.Errorf("Funcs.HandleInputs() got1 = %v, want %v", got1, tt.want1)
    32  			}
    33  			if !reflect.DeepEqual(got2, tt.want2) {
    34  				t.Errorf("Funcs.HandleInputs() got2 = %v, want %v", got2, tt.want2)
    35  			}
    36  		})
    37  	}
    38  }
    39  
    40  func TestFuncs_SetInputs(t *testing.T) {
    41  	tests := []struct {
    42  		name  string
    43  		f     *Funcs
    44  		want  []string
    45  		want1 []string
    46  		want2 map[string]interface{}
    47  	}{
    48  		// TODO: Add test cases.
    49  	}
    50  	for _, tt := range tests {
    51  		t.Run(tt.name, func(t *testing.T) {
    52  			got, got1, got2 := tt.f.SetInputs()
    53  			if !reflect.DeepEqual(got, tt.want) {
    54  				t.Errorf("Funcs.SetInputs() got = %v, want %v", got, tt.want)
    55  			}
    56  			if !reflect.DeepEqual(got1, tt.want1) {
    57  				t.Errorf("Funcs.SetInputs() got1 = %v, want %v", got1, tt.want1)
    58  			}
    59  			if !reflect.DeepEqual(got2, tt.want2) {
    60  				t.Errorf("Funcs.SetInputs() got2 = %v, want %v", got2, tt.want2)
    61  			}
    62  		})
    63  	}
    64  }
    65  
    66  func Test_isArray(t *testing.T) {
    67  	type args struct {
    68  		value interface{}
    69  	}
    70  	tests := []struct {
    71  		name string
    72  		args args
    73  		want bool
    74  	}{
    75  		// TODO: Add test cases.
    76  	}
    77  	for _, tt := range tests {
    78  		t.Run(tt.name, func(t *testing.T) {
    79  			if got := isArray(tt.args.value); got != tt.want {
    80  				t.Errorf("isArray() = %v, want %v", got, tt.want)
    81  			}
    82  		})
    83  	}
    84  }
    85  
    86  func TestFuncs_checkifRepeatExecution(t *testing.T) {
    87  	tests := []struct {
    88  		name    string
    89  		f       *Funcs
    90  		want    int
    91  		wantErr bool
    92  	}{
    93  		// TODO: Add test cases.
    94  	}
    95  	for _, tt := range tests {
    96  		t.Run(tt.name, func(t *testing.T) {
    97  			got, err := tt.f.checkifRepeatExecution()
    98  			if (err != nil) != tt.wantErr {
    99  				t.Errorf("Funcs.checkifRepeatExecution() error = %v, wantErr %v", err, tt.wantErr)
   100  				return
   101  			}
   102  			if got != tt.want {
   103  				t.Errorf("Funcs.checkifRepeatExecution() = %v, want %v", got, tt.want)
   104  			}
   105  		})
   106  	}
   107  }
   108  
   109  func TestFuncs_checkinputvalue(t *testing.T) {
   110  	type args struct {
   111  		Aliasname string
   112  		variables map[string]interface{}
   113  	}
   114  	tests := []struct {
   115  		name    string
   116  		f       *Funcs
   117  		args    args
   118  		want    string
   119  		wantErr bool
   120  	}{
   121  		// TODO: Add test cases.
   122  	}
   123  	for _, tt := range tests {
   124  		t.Run(tt.name, func(t *testing.T) {
   125  			got, err := tt.f.checkinputvalue(tt.args.Aliasname, tt.args.variables)
   126  			if (err != nil) != tt.wantErr {
   127  				t.Errorf("Funcs.checkinputvalue() error = %v, wantErr %v", err, tt.wantErr)
   128  				return
   129  			}
   130  			if got != tt.want {
   131  				t.Errorf("Funcs.checkinputvalue() = %v, want %v", got, tt.want)
   132  			}
   133  		})
   134  	}
   135  }
   136  
   137  func Test_customMarshal(t *testing.T) {
   138  	type args struct {
   139  		v interface{}
   140  	}
   141  	tests := []struct {
   142  		name string
   143  		args args
   144  		want string
   145  	}{
   146  		// TODO: Add test cases.
   147  	}
   148  	for _, tt := range tests {
   149  		t.Run(tt.name, func(t *testing.T) {
   150  			if got := customMarshal(tt.args.v); got != tt.want {
   151  				t.Errorf("customMarshal() = %v, want %v", got, tt.want)
   152  			}
   153  		})
   154  	}
   155  }
   156  
   157  func TestFuncs_ConverttoInt(t *testing.T) {
   158  	type args struct {
   159  		str string
   160  	}
   161  	tests := []struct {
   162  		name string
   163  		f    *Funcs
   164  		args args
   165  		want int
   166  	}{
   167  		// TODO: Add test cases.
   168  	}
   169  	for _, tt := range tests {
   170  		t.Run(tt.name, func(t *testing.T) {
   171  			if got := tt.f.ConverttoInt(tt.args.str); got != tt.want {
   172  				t.Errorf("Funcs.ConverttoInt() = %v, want %v", got, tt.want)
   173  			}
   174  		})
   175  	}
   176  }
   177  
   178  func TestFuncs_ConverttoFloat(t *testing.T) {
   179  	type args struct {
   180  		str string
   181  	}
   182  	tests := []struct {
   183  		name string
   184  		f    *Funcs
   185  		args args
   186  		want float64
   187  	}{
   188  		// TODO: Add test cases.
   189  	}
   190  	for _, tt := range tests {
   191  		t.Run(tt.name, func(t *testing.T) {
   192  			if got := tt.f.ConverttoFloat(tt.args.str); got != tt.want {
   193  				t.Errorf("Funcs.ConverttoFloat() = %v, want %v", got, tt.want)
   194  			}
   195  		})
   196  	}
   197  }
   198  
   199  func TestFuncs_ConverttoBool(t *testing.T) {
   200  	type args struct {
   201  		str string
   202  	}
   203  	tests := []struct {
   204  		name string
   205  		f    *Funcs
   206  		args args
   207  		want bool
   208  	}{
   209  		// TODO: Add test cases.
   210  	}
   211  	for _, tt := range tests {
   212  		t.Run(tt.name, func(t *testing.T) {
   213  			if got := tt.f.ConverttoBool(tt.args.str); got != tt.want {
   214  				t.Errorf("Funcs.ConverttoBool() = %v, want %v", got, tt.want)
   215  			}
   216  		})
   217  	}
   218  }
   219  
   220  func TestFuncs_ConverttoDateTime(t *testing.T) {
   221  	type args struct {
   222  		str string
   223  	}
   224  	tests := []struct {
   225  		name string
   226  		f    *Funcs
   227  		args args
   228  		want time.Time
   229  	}{
   230  		// TODO: Add test cases.
   231  	}
   232  	for _, tt := range tests {
   233  		t.Run(tt.name, func(t *testing.T) {
   234  			if got := tt.f.ConverttoDateTime(tt.args.str); !reflect.DeepEqual(got, tt.want) {
   235  				t.Errorf("Funcs.ConverttoDateTime() = %v, want %v", got, tt.want)
   236  			}
   237  		})
   238  	}
   239  }
   240  
   241  func TestFuncs_SetOutputs(t *testing.T) {
   242  	type args struct {
   243  		outputs map[string]interface{}
   244  	}
   245  	tests := []struct {
   246  		name string
   247  		f    *Funcs
   248  		args args
   249  	}{
   250  		// TODO: Add test cases.
   251  	}
   252  	for _, tt := range tests {
   253  		t.Run(tt.name, func(t *testing.T) {
   254  			tt.f.SetOutputs(tt.args.outputs)
   255  		})
   256  	}
   257  }
   258  
   259  func TestFuncs_SetfuncOutputs(t *testing.T) {
   260  	tests := []struct {
   261  		name string
   262  		f    *Funcs
   263  	}{
   264  		// TODO: Add test cases.
   265  	}
   266  	for _, tt := range tests {
   267  		t.Run(tt.name, func(t *testing.T) {
   268  			tt.f.SetfuncOutputs()
   269  		})
   270  	}
   271  }
   272  
   273  func TestFuncs_SetfuncSingleOutputs(t *testing.T) {
   274  	type args struct {
   275  		outputs map[string]interface{}
   276  	}
   277  	tests := []struct {
   278  		name string
   279  		f    *Funcs
   280  		args args
   281  	}{
   282  		// TODO: Add test cases.
   283  	}
   284  	for _, tt := range tests {
   285  		t.Run(tt.name, func(t *testing.T) {
   286  			tt.f.SetfuncSingleOutputs(tt.args.outputs)
   287  		})
   288  	}
   289  }
   290  
   291  func TestFuncs_ConvertfromBytes(t *testing.T) {
   292  	type args struct {
   293  		bytesbuffer []byte
   294  	}
   295  	tests := []struct {
   296  		name string
   297  		f    *Funcs
   298  		args args
   299  		want map[string]interface{}
   300  	}{
   301  		// TODO: Add test cases.
   302  	}
   303  	for _, tt := range tests {
   304  		t.Run(tt.name, func(t *testing.T) {
   305  			if got := tt.f.ConvertfromBytes(tt.args.bytesbuffer); !reflect.DeepEqual(got, tt.want) {
   306  				t.Errorf("Funcs.ConvertfromBytes() = %v, want %v", got, tt.want)
   307  			}
   308  		})
   309  	}
   310  }
   311  
   312  func TestFuncs_Execute(t *testing.T) {
   313  	tests := []struct {
   314  		name string
   315  		f    *Funcs
   316  	}{
   317  		// TODO: Add test cases.
   318  	}
   319  	for _, tt := range tests {
   320  		t.Run(tt.name, func(t *testing.T) {
   321  			tt.f.Execute()
   322  		})
   323  	}
   324  }
   325  
   326  func TestFuncs_CancelExecution(t *testing.T) {
   327  	type args struct {
   328  		errormessage string
   329  	}
   330  	tests := []struct {
   331  		name string
   332  		f    *Funcs
   333  		args args
   334  	}{
   335  		// TODO: Add test cases.
   336  	}
   337  	for _, tt := range tests {
   338  		t.Run(tt.name, func(t *testing.T) {
   339  			tt.f.CancelExecution(tt.args.errormessage)
   340  		})
   341  	}
   342  }