| 224 | } |
| 225 | |
| 226 | void FullTests::createSoar() |
| 227 | { |
| 228 | CPPUNIT_ASSERT(m_pKernel == NULL); |
| 229 | |
| 230 | if (m_Options.test(REMOTE)) |
| 231 | { |
| 232 | int targetPid = spawnListener(); |
| 233 | m_pKernel = sml::Kernel::CreateRemoteConnection(true, 0, targetPid); |
| 234 | } |
| 235 | else |
| 236 | { |
| 237 | if (m_Options.test(USE_CLIENT_THREAD)) |
| 238 | { |
| 239 | bool optimized = m_Options.test(FULLY_OPTIMIZED); |
| 240 | m_pKernel = sml::Kernel::CreateKernelInCurrentThread(optimized, 0); |
| 241 | } |
| 242 | else |
| 243 | { |
| 244 | m_pKernel = sml::Kernel::CreateKernelInNewThread(0); |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | CPPUNIT_ASSERT(m_pKernel != NULL); |
| 249 | CPPUNIT_ASSERT_MESSAGE(m_pKernel->GetLastErrorDescription(), !m_pKernel->HadError()); |
| 250 | |
| 251 | if (m_Options.test(VERBOSE)) |
| 252 | { |
| 253 | std::cout << "Soar kernel version " << m_pKernel->GetSoarKernelVersion() << std::endl ; |
| 254 | } |
| 255 | if (m_Options.test(VERBOSE)) |
| 256 | { |
| 257 | std::cout << "SML version " << sml::sml_Names::kSMLVersionValue << std::endl ; |
| 258 | } |
| 259 | |
| 260 | CPPUNIT_ASSERT(std::string(m_pKernel->GetSoarKernelVersion()) == std::string(sml::sml_Names::kSoarVersionValue)); |
| 261 | |
| 262 | bool creationHandlerReceived(false); |
| 263 | int agentCreationCallback = m_pKernel->RegisterForAgentEvent(sml::smlEVENT_AFTER_AGENT_CREATED, Handlers::MyCreationHandler, &creationHandlerReceived) ; |
| 264 | |
| 265 | // Report the number of agents (always 0 unless this is a remote connection to a CLI or some such) |
| 266 | CPPUNIT_ASSERT(m_pKernel->GetNumberAgents() == 0); |
| 267 | |
| 268 | // NOTE: We don't delete the agent pointer. It's owned by the kernel |
| 269 | m_pAgent = m_pKernel->CreateAgent(kAgentName.c_str()) ; |
| 270 | CPPUNIT_ASSERT_MESSAGE(m_pKernel->GetLastErrorDescription(), !m_pKernel->HadError()); |
| 271 | CPPUNIT_ASSERT(m_pAgent != NULL); |
| 272 | CPPUNIT_ASSERT(creationHandlerReceived); |
| 273 | |
| 274 | CPPUNIT_ASSERT(m_pKernel->UnregisterForAgentEvent(agentCreationCallback)); |
| 275 | |
| 276 | // a number of tests below depend on running full decision cycles. |
| 277 | m_pAgent->ExecuteCommandLine("set-stop-phase --before --input") ; |
| 278 | CPPUNIT_ASSERT_MESSAGE("set-stop-phase --before --input", m_pAgent->GetLastCommandLineResult()); |
| 279 | |
| 280 | CPPUNIT_ASSERT(m_pKernel->GetNumberAgents() == 1); |
| 281 | |
| 282 | m_pKernel->SetAutoCommit(!m_Options.test(AUTO_COMMIT_DISABLED)) ; |
| 283 | } |
nothing calls this directly
no test coverage detected