MCPcopy Create free account
hub / github.com/SoarGroup/Soar / testMultiAgent

Method testMultiAgent

Tests/Prototype-UnitTesting/kernel/EpMemFunctionalTests.cpp:219–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217
218
219void EpMemFunctionalTests::testMultiAgent()
220{
221 std::vector<sml::Agent*> agents;
222
223 for (int i = 1;i <= 250;i++)
224 {
225 std::stringstream ss("Agent ");
226 ss << i;
227
228 sml::Agent* t = kernel->CreateAgent(ss.str().c_str());
229 std::string sourceName = getCategoryName() + "_testMultiAgent.soar";
230 std::string sourceUrl = SoarHelper::GetResource(sourceName);
231 assertNonZeroSize_msg("Could not find test file " + sourceName, sourceUrl);
232 agent->ExecuteCommandLine(("source " + sourceUrl).c_str());
233
234 agents.push_back(t);
235 }
236
237 kernel->RunAllAgents(3);
238
239 for (auto a : agents)
240 {
241 try
242 {
243 if (SoarHelper::getDecisionPhasesCount(a) != 3)
244 {
245 throw AssertException("Agent did not stop correctly! Ran too many cycles!", __FILE__, __LINE__);
246 }
247
248 std::string result = a->ExecuteCommandLine("epmem");
249
250 if (result.find("memory") == std::string::npos)
251 {
252 throw AssertException("Non Memory Driver!", __FILE__, __LINE__);
253 }
254 }
255 catch (AssertException& e)
256 {
257 kernel->DestroyAgent(a);
258 throw e;
259 }
260
261 kernel->DestroyAgent(a);
262 }
263}

Callers

nothing calls this directly

Calls 7

AssertExceptionClass · 0.85
CreateAgentMethod · 0.80
RunAllAgentsMethod · 0.80
DestroyAgentMethod · 0.80
ExecuteCommandLineMethod · 0.45
push_backMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected