Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
neworderofjamie committed Aug 10, 2021
1 parent e169e27 commit 4a91262
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 16 deletions.
2 changes: 1 addition & 1 deletion tests/unit/currentSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ TEST(CurrentSource, InvalidName)
auto *pop = model.addNeuronPopulation<NeuronModels::Izhikevich>("Pop", 10, paramVals, varVals);

try {
model.addCurrentSource<CurrentSourceModels::DC>("6CS", "Pop", {1.0}, {});
model.addCurrentSource<CurrentSourceModels::DC>("CS-2", "Pop", {1.0}, {});
FAIL();
}
catch(const std::runtime_error &) {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/customUpdate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ TEST(CustomUpdates, InvalidName)
Sum::VarReferences sumVarReferences1(createVarRef(ng1, "V"), createVarRef(ng1, "U"));

try {
model.addCustomUpdate<Sum>("1Sum", "CustomUpdate",
model.addCustomUpdate<Sum>("Sum-1", "CustomUpdate",
{}, sumVarValues, sumVarReferences1);
FAIL();
}
Expand All @@ -617,7 +617,7 @@ TEST(CustomUpdates, InvalidUpdateGroupName)
Sum::VarReferences sumVarReferences1(createVarRef(ng1, "V"), createVarRef(ng1, "U"));

try {
model.addCustomUpdate<Sum>("Sum", "1CustomUpdate",
model.addCustomUpdate<Sum>("Sum", "CustomUpdate-1",
{}, sumVarValues, sumVarReferences1);
FAIL();
}
Expand Down
42 changes: 31 additions & 11 deletions tests/unit/gennUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,20 @@
//--------------------------------------------------------------------------
namespace
{
void validateVarPopNameDeathTest(const std::string &name)
void validatePopNameDeathTest(const std::string &name)
{
try {
Utils::validateVarPopName(name, "test");
Utils::validatePopName(name, "test");
FAIL();
}

catch(const std::runtime_error &) {
}
}
void validateVarNameDeathTest(const std::string &name)
{
try {
Utils::validateVarName(name, "test");
FAIL();
}

Expand All @@ -27,16 +37,26 @@ void validateVarPopNameDeathTest(const std::string &name)
//--------------------------------------------------------------------------
TEST(GeNNUtils, ValidateVarPopName)
{
Utils::validateVarPopName("test", "test");
Utils::validateVarPopName("Test", "test");
Utils::validateVarPopName("test123", "test");
Utils::validateVarPopName("test_123", "test");
Utils::validateVarPopName("_test_123", "test");
Utils::validateVarName("test", "test");
Utils::validateVarName("Test", "test");
Utils::validateVarName("test123", "test");
Utils::validateVarName("test_123", "test");
Utils::validateVarName("_test_123", "test");

Utils::validatePopName("test", "test");
Utils::validatePopName("Test", "test");
Utils::validatePopName("test123", "test");
Utils::validatePopName("test_123", "test");
Utils::validatePopName("_test_123", "test");
Utils::validatePopName("1test", "test");

validateVarPopNameDeathTest("");
validateVarPopNameDeathTest("1test");
validateVarPopNameDeathTest("test.test");
validateVarPopNameDeathTest("test-test");
validateVarNameDeathTest("");
validateVarNameDeathTest("1test");
validateVarNameDeathTest("test.test");
validateVarNameDeathTest("test-test");
validatePopNameDeathTest("");
validatePopNameDeathTest("test.test");
validatePopNameDeathTest("test-test");
}
//--------------------------------------------------------------------------
TEST(GeNNUtils, ValidateParamNames)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/neuronGroup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ TEST(NeuronGroup, InvalidName)
{
ModelSpec model;
try {
model.addNeuronPopulation<NeuronModels::SpikeSource>("0Neurons", 10, {}, {});
model.addNeuronPopulation<NeuronModels::SpikeSource>("Neurons-0", 10, {}, {});
FAIL();
}
catch(const std::runtime_error &) {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/synapseGroup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ TEST(SynapseGroup, InvalidName)
auto *post = model.addNeuronPopulation<NeuronModels::Izhikevich>("Post", 10, paramVals, varVals);
try {
model.addSynapsePopulation<WeightUpdateModels::StaticPulse, PostsynapticModels::DeltaCurr>(
"6Syn", SynapseMatrixType::DENSE_GLOBALG, NO_DELAY,
"Syn-6", SynapseMatrixType::DENSE_GLOBALG, NO_DELAY,
"Pre", "Post",
{}, {1.0},
{}, {});
Expand Down

0 comments on commit 4a91262

Please sign in to comment.