standart.TestWrite   A
last analyzed

Complexity

Conditions 4

Size

Total Lines 22
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 17
dl 0
loc 22
rs 9.55
c 0
b 0
f 0
nop 1
1
////////////////////////////////////////////////////////////////////////////////
2
// Author:   Nikita Koryabkin
3
// Email:    [email protected]
4
// Telegram: https://t.me/Apologiz
5
////////////////////////////////////////////////////////////////////////////////
6
7
package standart
8
9
import (
10
	"io"
11
	"reflect"
12
	"testing"
13
)
14
15
func TestGet(t *testing.T) {
16
	tests := []struct {
17
		name string
18
		want io.Writer
19
	}{
20
		{
21
			want: &Strategy{},
22
		},
23
	}
24
	for _, tt := range tests {
25
		t.Run(tt.name, func(t *testing.T) {
26
			if got := Get(); reflect.TypeOf(got) != reflect.TypeOf(tt.want) {
27
				t.Errorf("Get() = %v, want %v", got, tt.want)
28
			}
29
		})
30
	}
31
}
32
33
func TestWrite(t *testing.T) {
34
	type args struct {
35
		p []byte
36
	}
37
	tests := []struct {
38
		name     string
39
		args     args
40
		strategy Strategy
41
		wantErr  bool
42
	}{
43
		{
44
			args: args{
45
				[]byte("Hello, Alog!"),
46
			},
47
			strategy: Strategy{},
48
			wantErr:  false,
49
		},
50
	}
51
	for _, tt := range tests {
52
		t.Run(tt.name, func(t *testing.T) {
53
			if _, err := tt.strategy.Write(tt.args.p); (err != nil) != tt.wantErr {
54
				t.Errorf("Write() error = %v, wantErr %v", err, tt.wantErr)
55
			}
56
		})
57
	}
58
}
59