Newer
Older
//@author Ajit Jagtap
//@version Thu Jul 05 2018 06:11:54 GMT+0530 (IST)
package cachemdl
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// import (
// "testing"
// "time"
// "github.com/stretchr/testify/assert"
// )
// var ch GCCacheHelper
// func init() {
// ch = GCCacheHelper{}
// ch.Setup(500, time.Minute*50)
// }
// func TestCacheGCHelper_Setup(t *testing.T) {
// assert.NotPanics(t, func() { ch.Setup(500, time.Minute*50) }, "This Setup method should never panic")
// }
// func TestCacheGCHelper_Set(t *testing.T) {
// ch.Set("a", 1)
// val, _ := ch.Get("a")
// assert.Equal(t, val, 1, "This Cache get should return same value as set")
// }
// func TestCacheGCHelper_GetAll(t *testing.T) {
// ch.Set("a", 1)
// val := ch.GetAll()
// assert.NotZero(t, len(val), "Check if GetAll return more than zero values")
// cnt := ch.Count()
// assert.NotZero(t, cnt, "Check if Count method will give more than zero value")
// ch.Remove("a")
// ch.Purge()
// cnt = ch.Count()
// assert.Zero(t, cnt, "After Purge Count should be zero")
// }