123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- package dao
- import (
- "context"
- "testing"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaokeyDM(t *testing.T) {
- convey.Convey("keyDM", t, func(ctx convey.C) {
- var (
- tp = int32(0)
- oid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- key := keyDM(tp, oid)
- ctx.Convey("Then key should not be nil.", func(ctx convey.C) {
- ctx.So(key, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyBroadcastLimit(t *testing.T) {
- convey.Convey("keyBroadcastLimit", t, func(ctx convey.C) {
- var (
- tp = int32(0)
- oid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- key := keyBroadcastLimit(tp, oid)
- ctx.Convey("Then key should not be nil.", func(ctx convey.C) {
- ctx.So(key, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoDMCache(t *testing.T) {
- convey.Convey("DMCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- res, err := testDao.DMCache(c, tp, oid)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoExpireDMCache(t *testing.T) {
- convey.Convey("ExpireDMCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- ok, err := testDao.ExpireDMCache(c, tp, oid)
- ctx.Convey("Then err should be nil.ok should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(ok, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoTrimDMCache(t *testing.T) {
- convey.Convey("TrimDMCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- count = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := testDao.TrimDMCache(c, tp, oid, count)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoIncrPubCnt(t *testing.T) {
- convey.Convey("IncrPubCnt", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- color = int64(0)
- mode = int32(0)
- fontsize = int32(0)
- ip = ""
- msg = ""
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := testDao.IncrPubCnt(c, mid, color, mode, fontsize, ip, msg)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoPubCnt(t *testing.T) {
- convey.Convey("PubCnt", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- color = int64(0)
- mode = int32(0)
- fontsize = int32(0)
- ip = ""
- msg = ""
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- count, err := testDao.PubCnt(c, mid, color, mode, fontsize, ip, msg)
- ctx.Convey("Then err should be nil.count should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(count, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoIncrCharPubCnt(t *testing.T) {
- convey.Convey("IncrCharPubCnt", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- oid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := testDao.IncrCharPubCnt(c, mid, oid)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoCharPubCnt(t *testing.T) {
- convey.Convey("CharPubCnt", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- oid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- count, err := testDao.CharPubCnt(c, mid, oid)
- ctx.Convey("Then err should be nil.count should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(count, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoDelCharPubCnt(t *testing.T) {
- convey.Convey("DelCharPubCnt", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- oid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := testDao.DelCharPubCnt(c, mid, oid)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoBroadcastLimit(t *testing.T) {
- convey.Convey("BroadcastLimit", t, func(ctx convey.C) {
- var (
- c = context.Background()
- oid = int64(0)
- tp = int32(0)
- count = int(0)
- interval = int(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- testDao.BroadcastLimit(c, oid, tp, count, interval)
- })
- })
- }
|