1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #pragma once
- #include <cxxtest/TestSuite.h>
- #include "debug.hpp"
- #include "simloop.hpp"
- #include "vconnection.hpp"
- #include "layer.hpp"
- #include "layer/iaf_psc_exp.h"
- #include "layerfactory.hpp"
- #include "chunkfile.h"
- #include <sys/stat.h>
- #include <fstream>
- using namespace std;
- const double NUMERIC_LIMIT = 0.0001;
- class IAF_PSC_EXP_Test : public CxxTest::TestSuite
- {
- public:
- void testDummy()
- {
- TS_ASSERT_EQUALS(4,4);
- // allocate and initialize layer
- int InputNx=2;
- int InputNy=3;
- layer* MyLayer = createLayer(InputNx*InputNy, NMType_iaf_psc_exp, NPType_Excitatory);
- MyLayer->SetName("MyLayer");
- MyLayer->SetupPositions(InputNx, InputNy, true);
- float* ExInput = MyLayer->GetInputPointer(csimInputChannel_AMPA);
- std::fstream f("output.txt", ios_base::out);
- TS_ASSERT(ExInput);
- TS_ASSERT_DELTA(ExInput[0], 0.0, NUMERIC_LIMIT);
- iaf_psc_exp* MyNestLayer = dynamic_cast<iaf_psc_exp*>(MyLayer);
- TS_ASSERT(MyNestLayer);
- TS_ASSERT_DELTA(MyNestLayer->pS_[0].V_m_, 0., NUMERIC_LIMIT);
- for (int i=0; i<900;++i)
- {
- if (i == 20 || i==240) {
- ExInput[0] += 47.1;
- }
- if (i == 300) {
- ExInput[0] += 1247.1;
- }
- if (i == 400) {
- ExInput[0] += 4247.1;
- }
- MyLayer->proceede(i);
- f << MyNestLayer->pS_[0].V_m_ << "\n";
- }
- TS_ASSERT_DELTA(MyNestLayer->pS_[0].V_m_, 0.3, NUMERIC_LIMIT);
- f.close();
- }
- };
|