summaryrefslogtreecommitdiff
path: root/selftest.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2013-07-27 15:09:51 -0400
committerAdam Ierymenko <adam.ierymenko@gmail.com>2013-07-27 15:09:51 -0400
commitfb975ead23bf1000ae12e758cd683d1609583e2c (patch)
treea4d64b9b3b595931f97c5f5eff5b1b24dfa44850 /selftest.cpp
parenta816f564261911c168be1140e7f01def4ddfc8a7 (diff)
downloadinfinitytier-fb975ead23bf1000ae12e758cd683d1609583e2c.tar.gz
infinitytier-fb975ead23bf1000ae12e758cd683d1609583e2c.zip
Add simple key=value dictionary, sorta like java.util.Properties.
Diffstat (limited to 'selftest.cpp')
-rw-r--r--selftest.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/selftest.cpp b/selftest.cpp
index 4377d837..edbdcaf1 100644
--- a/selftest.cpp
+++ b/selftest.cpp
@@ -45,6 +45,7 @@
#include "node/Peer.hpp"
#include "node/Condition.hpp"
#include "node/NodeConfig.hpp"
+#include "node/Dictionary.hpp"
using namespace ZeroTier;
@@ -298,6 +299,29 @@ static int testOther()
}
std::cout << "PASS" << std::endl;
+ std::cout << "[other] Testing Dictionary... "; std::cout.flush();
+ for(int k=0;k<10000;++k) {
+ Dictionary a,b;
+ int nk = rand() % 32;
+ for(int q=0;q<nk;++q) {
+ std::string k,v;
+ int kl = (rand() % 512);
+ int vl = (rand() % 512);
+ for(int i=0;i<kl;++i)
+ k.push_back((char)rand());
+ for(int i=0;i<vl;++i)
+ v.push_back((char)rand());
+ a[k] = v;
+ }
+ std::string aser = a.toString();
+ b.fromString(aser);
+ if (a != b) {
+ std::cout << "FAIL!" << std::endl;
+ return -1;
+ }
+ }
+ std::cout << "PASS" << std::endl;
+
return 0;
}