======================================== Type Conversion Tests ========================================
(t *testing.T)
| 9 | // ======================================== |
| 10 | |
| 11 | func TestI2B(t *testing.T) { |
| 12 | type args struct { |
| 13 | i int |
| 14 | } |
| 15 | tests := []struct { |
| 16 | name string |
| 17 | args args |
| 18 | want bool |
| 19 | }{ |
| 20 | {"Positive number 1", args{i: 1}, true}, |
| 21 | {"Positive number 2", args{i: 2}, true}, |
| 22 | {"Zero value", args{i: 0}, false}, |
| 23 | {"Negative value", args{i: -1}, false}, |
| 24 | } |
| 25 | for _, tt := range tests { |
| 26 | t.Run(tt.name, func(t *testing.T) { |
| 27 | if got := I2B(tt.args.i); got != tt.want { |
| 28 | t.Errorf("I2B() = %v, want %v", got, tt.want) |
| 29 | } |
| 30 | }) |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | func TestI2S_Basic(t *testing.T) { |
| 35 | result := I2S(42) |