From b1863ec9a14c1fc9a62a4a0abb4f50f968612fca Mon Sep 17 00:00:00 2001 From: Oleg Khlevnov Date: Sun, 22 Mar 2020 02:35:02 +0300 Subject: [PATCH] Add gc percent test in lrucache to prevent cheating --- lrucache/cache_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lrucache/cache_test.go b/lrucache/cache_test.go index c0dddb6..84b377e 100644 --- a/lrucache/cache_test.go +++ b/lrucache/cache_test.go @@ -132,6 +132,11 @@ func TestCache_eviction(t *testing.T) { } } +func TestCache_GCPercent(t *testing.T) { + var p = debug.SetGCPercent(100) + require.Equal(t, p, 100) +} + func BenchmarkCache_Set(b *testing.B) { for _, tc := range []struct { name string