row_key_test.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package dao
  2. import (
  3. "testing"
  4. "github.com/smartystreets/goconvey/convey"
  5. )
  6. func TestDaoreverseID(t *testing.T) {
  7. var (
  8. id = "123"
  9. l = int(3)
  10. )
  11. convey.Convey("reverseID", t, func(ctx convey.C) {
  12. p1 := reverseID(id, l)
  13. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  14. ctx.So(p1, convey.ShouldNotBeNil)
  15. })
  16. })
  17. }
  18. func TestDaocheckIDLen(t *testing.T) {
  19. var (
  20. id = "123"
  21. )
  22. convey.Convey("checkIDLen", t, func(ctx convey.C) {
  23. p1 := checkIDLen(id)
  24. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  25. ctx.So(p1, convey.ShouldNotBeNil)
  26. })
  27. })
  28. }
  29. func TestDaodiffTs(t *testing.T) {
  30. var (
  31. ts = int64(0)
  32. )
  33. convey.Convey("diffTs", t, func(ctx convey.C) {
  34. p1 := diffTs(ts)
  35. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  36. ctx.So(p1, convey.ShouldNotBeNil)
  37. })
  38. })
  39. }
  40. func TestDaodiffID(t *testing.T) {
  41. var (
  42. id = int64(0)
  43. )
  44. convey.Convey("diffID", t, func(ctx convey.C) {
  45. p1 := diffID(id)
  46. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  47. ctx.So(p1, convey.ShouldNotBeNil)
  48. })
  49. })
  50. }