|
| 1 | +package module_test |
| 2 | + |
| 3 | +import ( |
| 4 | + "github.com/btnguyen2k/mymodule" |
| 5 | + "reflect" |
| 6 | + "testing" |
| 7 | +) |
| 8 | + |
| 9 | +// sample tests |
| 10 | + |
| 11 | +func TestClone_int(t *testing.T) { |
| 12 | + testName := "TestClone_int" |
| 13 | + input := []int{1, 2, 3} |
| 14 | + output := mymodule.Clone(input) |
| 15 | + if !reflect.DeepEqual(input, output) { |
| 16 | + t.Fatalf("%s failed: expected %v but received %v", testName, input, output) |
| 17 | + } |
| 18 | +} |
| 19 | + |
| 20 | +func TestClone_uint(t *testing.T) { |
| 21 | + testName := "TestClone_uint" |
| 22 | + input := []uint{4, 5, 6} |
| 23 | + output := mymodule.Clone(input) |
| 24 | + if !reflect.DeepEqual(input, output) { |
| 25 | + t.Fatalf("%s failed: expected %v but received %v", testName, input, output) |
| 26 | + } |
| 27 | +} |
| 28 | + |
| 29 | +func TestClone_float(t *testing.T) { |
| 30 | + testName := "TestClone_float" |
| 31 | + input := []float64{7.8, 8.9, 9.0} |
| 32 | + output := mymodule.Clone(input) |
| 33 | + if !reflect.DeepEqual(input, output) { |
| 34 | + t.Fatalf("%s failed: expected %v but received %v", testName, input, output) |
| 35 | + } |
| 36 | +} |
| 37 | + |
| 38 | +func TestClone_string(t *testing.T) { |
| 39 | + testName := "TestClone_string" |
| 40 | + input := []string{"string 1", "string 2", "string 3"} |
| 41 | + output := mymodule.Clone(input) |
| 42 | + if !reflect.DeepEqual(input, output) { |
| 43 | + t.Fatalf("%s failed: expected %v but received %v", testName, input, output) |
| 44 | + } |
| 45 | +} |
0 commit comments