github.com/mdaxf/iac@v0.0.0-20240519030858-58a061660378/framework/berror/code_test.go (about)

     1  // the package is exported from github.com/beego/beego/v2/core/berror
     2  
     3  // Copyright 2023. All Rights Reserved.
     4  
     5  //
     6  
     7  // Licensed under the Apache License, Version 2.0 (the "License");
     8  
     9  // you may not use this file except in compliance with the License.
    10  
    11  // You may obtain a copy of the License at
    12  
    13  //
    14  
    15  //      http://www.apache.org/licenses/LICENSE-2.0
    16  
    17  //
    18  
    19  // Unless required by applicable law or agreed to in writing, software
    20  
    21  // distributed under the License is distributed on an "AS IS" BASIS,
    22  
    23  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    24  
    25  // See the License for the specific language governing permissions and
    26  
    27  // limitations under the License.
    28  
    29  package berror
    30  
    31  import (
    32  	"reflect"
    33  	"testing"
    34  )
    35  
    36  func TestDefineCode(t *testing.T) {
    37  	type args struct {
    38  		code   uint32
    39  		module string
    40  		name   string
    41  		desc   string
    42  	}
    43  	tests := []struct {
    44  		name string
    45  		args args
    46  		want Code
    47  	}{
    48  		// TODO: Add test cases.
    49  	}
    50  	for _, tt := range tests {
    51  		t.Run(tt.name, func(t *testing.T) {
    52  			if got := DefineCode(tt.args.code, tt.args.module, tt.args.name, tt.args.desc); !reflect.DeepEqual(got, tt.want) {
    53  				t.Errorf("DefineCode() = %v, want %v", got, tt.want)
    54  			}
    55  		})
    56  	}
    57  }
    58  
    59  func Test_codeRegistry_Get(t *testing.T) {
    60  	type args struct {
    61  		code uint32
    62  	}
    63  	tests := []struct {
    64  		name  string
    65  		cr    *codeRegistry
    66  		args  args
    67  		want  Code
    68  		want1 bool
    69  	}{
    70  		// TODO: Add test cases.
    71  	}
    72  	for _, tt := range tests {
    73  		t.Run(tt.name, func(t *testing.T) {
    74  			got, got1 := tt.cr.Get(tt.args.code)
    75  			if !reflect.DeepEqual(got, tt.want) {
    76  				t.Errorf("codeRegistry.Get() got = %v, want %v", got, tt.want)
    77  			}
    78  			if got1 != tt.want1 {
    79  				t.Errorf("codeRegistry.Get() got1 = %v, want %v", got1, tt.want1)
    80  			}
    81  		})
    82  	}
    83  }