redis_test.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoexpCoinKey(t *testing.T) {
  8. var (
  9. mid = int64(0)
  10. day = int64(0)
  11. )
  12. convey.Convey("expCoinKey", t, func(ctx convey.C) {
  13. p1 := expCoinKey(mid, day)
  14. ctx.Convey("p1 should not be nil", func(ctx convey.C) {
  15. ctx.So(p1, convey.ShouldNotBeNil)
  16. })
  17. })
  18. }
  19. func TestDaoexpAddedKey(t *testing.T) {
  20. var (
  21. tp = ""
  22. mid = int64(0)
  23. day = int64(0)
  24. )
  25. convey.Convey("expAddedKey", t, func(ctx convey.C) {
  26. p1 := expAddedKey(tp, mid, day)
  27. ctx.Convey("p1 should not be nil", func(ctx convey.C) {
  28. ctx.So(p1, convey.ShouldNotBeNil)
  29. })
  30. })
  31. }
  32. func TestDaoStatCache(t *testing.T) {
  33. var (
  34. c = context.Background()
  35. mid = int64(0)
  36. day = int64(0)
  37. )
  38. convey.Convey("StatCache", t, func(ctx convey.C) {
  39. st, err := d.StatCache(c, mid, day)
  40. ctx.Convey("Error should be nil", func(ctx convey.C) {
  41. ctx.So(err, convey.ShouldBeNil)
  42. })
  43. ctx.Convey("st should not be nil", func(ctx convey.C) {
  44. ctx.So(st, convey.ShouldNotBeNil)
  45. })
  46. })
  47. }