blob: 7550cdf11985325ac22a866a28ef121e10b6e566 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
}
|