Akash Soni | d36d23b | 2023-08-18 12:51:40 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2022-present Open Networking Foundation |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this file except in compliance with the License. |
| 5 | * You may obtain a copy of the License at |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | */ |
| 15 | |
| 16 | package controller |
| 17 | |
| 18 | import ( |
| 19 | "testing" |
| 20 | |
| 21 | "github.com/stretchr/testify/assert" |
| 22 | ) |
| 23 | |
| 24 | func TestPadString(t *testing.T) { |
| 25 | type args struct { |
| 26 | value string |
| 27 | padSize int |
| 28 | } |
| 29 | tests := []struct { |
| 30 | name string |
| 31 | args args |
| 32 | }{ |
| 33 | { |
| 34 | name: "PadString", |
| 35 | args: args{ |
| 36 | value: "test_value", |
| 37 | padSize: 20, |
| 38 | }, |
| 39 | }, |
| 40 | } |
| 41 | for _, tt := range tests { |
| 42 | t.Run(tt.name, func(t *testing.T) { |
| 43 | got := PadString(tt.args.value, tt.args.padSize) |
| 44 | assert.NotNil(t, got) |
| 45 | }) |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | func TestGetXid(t *testing.T) { |
| 50 | tests := []struct { |
| 51 | name string |
| 52 | want uint32 |
| 53 | }{ |
| 54 | { |
| 55 | name: "GetXid", |
| 56 | want: uint32(2), |
| 57 | }, |
| 58 | } |
| 59 | for _, tt := range tests { |
| 60 | t.Run(tt.name, func(t *testing.T) { |
| 61 | if got := GetXid(); got != tt.want { |
| 62 | t.Errorf("GetXid() = %v, want %v", got, tt.want) |
| 63 | } |
| 64 | }) |
| 65 | } |
| 66 | } |