From 54b81535af6c3bceed4672011ef221de7104bbd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 10 Oct 2016 11:47:23 +0200 Subject: [PATCH] Add BenchmarkGet --- viper_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/viper_test.go b/viper_test.go index 02d6eb1..c04b5f8 100644 --- a/viper_test.go +++ b/viper_test.go @@ -966,6 +966,18 @@ func BenchmarkGetBool(b *testing.B) { } } +func BenchmarkGet(b *testing.B) { + key := "BenchmarkGet" + v = New() + v.Set(key, true) + + for i := 0; i < b.N; i++ { + if !v.Get(key).(bool) { + b.Fatal("Get returned false") + } + } +} + // This is the "perfect result" for the above. func BenchmarkGetBoolFromMap(b *testing.B) { m := make(map[string]bool)