You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
732 B
30 lines
732 B
package dao |
|
|
|
import ( |
|
"reflect" |
|
"testing" |
|
|
|
. "github.com/smartystreets/goconvey/convey" |
|
) |
|
|
|
func TestMergeArrWithOrder(t *testing.T) { |
|
Convey("mergeArrWithOrder", t, func() { |
|
a := []int64{1, 2, 3, 4} |
|
b := []int64{4, 5, 6, 7} |
|
c := mergeArrWithOrder(a, b, len(a)+len(b)) |
|
So(reflect.DeepEqual(c, []int64{1, 2, 3, 4, 5, 6, 7}), ShouldBeTrue) |
|
c = mergeArrWithOrder(a, b, 2) |
|
So(reflect.DeepEqual(c, []int64{1, 2, 3, 4}), ShouldBeTrue) |
|
c = mergeArrWithOrder(a, b, 6) |
|
So(reflect.DeepEqual(c, []int64{1, 2, 3, 4, 5, 6}), ShouldBeTrue) |
|
}) |
|
} |
|
|
|
func TestMergeArr(t *testing.T) { |
|
Convey("mergeArr", t, func() { |
|
a := []int64{1, 2, 3, 4} |
|
b := []int64{4, 5, 6, 7} |
|
c := mergeArr(a, b) |
|
So(len(c) == 7, ShouldBeTrue) |
|
}) |
|
}
|
|
|