]> granicus.if.org Git - pdns/commitdiff
base64 encode/decode speedtest
authorKees Monshouwer <mind04@monshouwer.org>
Sun, 4 Jan 2015 14:30:32 +0000 (15:30 +0100)
committermind04 <mind04@monshouwer.org>
Tue, 6 Jan 2015 14:20:28 +0000 (15:20 +0100)
pdns/speedtest.cc

index 485be5cab1fe73ba16c2d4ed51d97ae6686596ad..03ba9a27592292dfc104155147e5cf0318d3e9f9 100644 (file)
@@ -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());