From f9b5b35af692e7a3ce489ba7abb87be37fb2ef1b Mon Sep 17 00:00:00 2001
From: "Mirar (Pontus Hagland)" <pike@sort.mirar.org>
Date: Wed, 29 Jan 2003 09:44:40 +0100
Subject: [PATCH] And these tests insertation in mappings and multisets

Rev: lib/modules/Tools.pmod/Shoot.pmod/InsertMapping.pike:1.1
Rev: lib/modules/Tools.pmod/Shoot.pmod/InsertMultiset.pike:1.1
---
 .../Tools.pmod/Shoot.pmod/InsertMapping.pike  | 22 +++++++++++++++++++
 .../Tools.pmod/Shoot.pmod/InsertMultiset.pike | 22 +++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100644 lib/modules/Tools.pmod/Shoot.pmod/InsertMapping.pike
 create mode 100644 lib/modules/Tools.pmod/Shoot.pmod/InsertMultiset.pike

diff --git a/lib/modules/Tools.pmod/Shoot.pmod/InsertMapping.pike b/lib/modules/Tools.pmod/Shoot.pmod/InsertMapping.pike
new file mode 100644
index 0000000000..b172429c3b
--- /dev/null
+++ b/lib/modules/Tools.pmod/Shoot.pmod/InsertMapping.pike
@@ -0,0 +1,22 @@
+inherit Tools.Shoot.Test;
+
+constant name="Insert in mapping";
+
+int k = 5; /* variable to tune the time of the test */
+int m = 100000; /* the target size of the mapping */
+int n = m*k; // for reporting
+
+void perform()
+{
+   for (int i=0; i<k; i++)
+   {
+      mapping v=([]);
+      for (int j=0; j<m; j++)
+	 v[j]=42;
+   }
+}
+
+string present_n(int ntot,int nruns,float tseconds,float useconds,int memusage)
+{
+   return sprintf("%.0f/s",ntot/useconds);
+}
diff --git a/lib/modules/Tools.pmod/Shoot.pmod/InsertMultiset.pike b/lib/modules/Tools.pmod/Shoot.pmod/InsertMultiset.pike
new file mode 100644
index 0000000000..b9d4fbb295
--- /dev/null
+++ b/lib/modules/Tools.pmod/Shoot.pmod/InsertMultiset.pike
@@ -0,0 +1,22 @@
+inherit Tools.Shoot.Test;
+
+constant name="Insert in multiset";
+
+int k = 5; /* variable to tune the time of the test */
+int m = 100000; /* the target size of the multiset */
+int n = m*k; // for reporting
+
+void perform()
+{
+   for (int i=0; i<k; i++)
+   {
+      multiset v=(<>);
+      for (int j=0; j<m; j++)
+	 v[j]=42;
+   }
+}
+
+string present_n(int ntot,int nruns,float tseconds,float useconds,int memusage)
+{
+   return sprintf("%.0f/s",ntot/useconds);
+}
-- 
GitLab