From: Kees Monshouwer Date: Sun, 4 Jan 2015 14:30:32 +0000 (+0100) Subject: base64 encode/decode speedtest X-Git-Tag: rec-3.7.0-rc1~39^2~1^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=88227be07703c2b5b059372cd1589a96ed2d6078;p=pdns base64 encode/decode speedtest --- diff --git a/pdns/speedtest.cc b/pdns/speedtest.cc index 485be5cab..03ba9a275 100644 --- a/pdns/speedtest.cc +++ b/pdns/speedtest.cc @@ -7,6 +7,7 @@ #include "config.h" #ifndef RECURSOR #include "statbag.hh" +#include "base64.hh" StatBag S; #endif @@ -741,6 +742,36 @@ struct StrcasecmpTest }; +struct Base64EncodeTest +{ + string getName() const + { + return "Bas64Encode test"; + } + + void operator()() const + { + static string a("dq4KydZjmcoQQ45VYBP2EDR8FqKaMul0eSHBt7Xx5F7A4HFtabXEzDLD01bnSiGK"); + Base64Encode(a); + } +}; + + +struct B64DecodeTest +{ + string getName() const + { + return "B64Decode test"; + } + + void operator()() const + { + static string a("ZHE0S3lkWmptY29RUTQ1VllCUDJFRFI4RnFLYU11bDBlU0hCdDdYeDVGN0E0SEZ0YWJYRXpETEQwMWJuU2lHSw=="), b; + g_ret = B64Decode(a,b); + } +}; + + struct NOPTest { string getName() const @@ -765,6 +796,8 @@ try doRun(IEqualsTest()); doRun(MyIEqualsTest()); doRun(StrcasecmpTest()); + doRun(Base64EncodeTest()); + doRun(B64DecodeTest()); doRun(StackMallocTest());