summaryrefslogtreecommitdiff
path: root/core/test_index.cpp
diff options
context:
space:
mode:
authorJan Huwald <jh@sotun.de>2012-05-07 20:01:51 (GMT)
committerJan Huwald <jh@sotun.de>2012-05-07 20:01:51 (GMT)
commit420d2ef464d4a741028e132e662d5626806a41f5 (patch)
tree1aca6eb512e4ed0fb5f3c10c528cb998b6ffd695 /core/test_index.cpp
Initial commitHEADmaster
Diffstat (limited to 'core/test_index.cpp')
-rw-r--r--core/test_index.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/core/test_index.cpp b/core/test_index.cpp
new file mode 100644
index 0000000..7550cdf
--- /dev/null
+++ b/core/test_index.cpp
@@ -0,0 +1,41 @@
+#include <iostream>
+
+#include "index_global.hpp"
+#include "index_spike.hpp"
+
+using namespace std;
+
+int main() {
+ Index<GlobalMsg> g;
+ Index<Spike> s;
+
+ // add/check some global events
+ for (uint i=0; i<1000; i++) {
+ Index<GlobalMsg>::ptr_t r;
+ r = g.add(Time(i), Time(i), Ptr<Global>());
+ if (r != i) {
+ cerr << "discontinuous global event allocation (event: " << i << ", ptr: " << r << ")" << endl;
+ return -1;
+ }
+ }
+
+ // add some spike events
+ for (uint i=0; i<1000; i++) {
+ s.add(i, i, Ptr<Neuron>(i));
+ }
+
+ for (uint i=0; i<1000; i++) {
+ if (s.last(i) != i) {
+ cerr << "last(" << i << ") = " << s.last(i) << " != " << i << endl;
+ return -1;
+ }
+ if (s.last(10000, Ptr<Neuron>(i)) != i) {
+ cerr << "last(inf, " << i << ") = " << s.last(i) << " != " << i << endl;
+ return -1;
+ }
+ }
+
+ // and check if we found the corrent one
+
+ return 0; // success
+}
contact: Jan Huwald // Impressum