dao_test.go 732 B

123456789101112131415161718192021222324252627282930
  1. package dao
  2. import (
  3. "reflect"
  4. "testing"
  5. . "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestMergeArrWithOrder(t *testing.T) {
  8. Convey("mergeArrWithOrder", t, func() {
  9. a := []int64{1, 2, 3, 4}
  10. b := []int64{4, 5, 6, 7}
  11. c := mergeArrWithOrder(a, b, len(a)+len(b))
  12. So(reflect.DeepEqual(c, []int64{1, 2, 3, 4, 5, 6, 7}), ShouldBeTrue)
  13. c = mergeArrWithOrder(a, b, 2)
  14. So(reflect.DeepEqual(c, []int64{1, 2, 3, 4}), ShouldBeTrue)
  15. c = mergeArrWithOrder(a, b, 6)
  16. So(reflect.DeepEqual(c, []int64{1, 2, 3, 4, 5, 6}), ShouldBeTrue)
  17. })
  18. }
  19. func TestMergeArr(t *testing.T) {
  20. Convey("mergeArr", t, func() {
  21. a := []int64{1, 2, 3, 4}
  22. b := []int64{4, 5, 6, 7}
  23. c := mergeArr(a, b)
  24. So(len(c) == 7, ShouldBeTrue)
  25. })
  26. }