COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
utest-python-scriptengine.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010-2013 von Karman Institute for Fluid Dynamics, Belgium
2 //
3 // This software is distributed under the terms of the
4 // GNU Lesser General Public License version 3 (LGPLv3).
5 // See doc/lgpl.txt and doc/gpl.txt for the license text.
6 
7 #define BOOST_TEST_DYN_LINK
8 #define BOOST_TEST_MODULE "Test module for cf3::Python::ScriptEngine"
9 
10 #include "python/ScriptEngine.hpp"
11 
12 #include <boost/test/unit_test.hpp>
13 
15 #include "common/Core.hpp"
16 
17 
18 using namespace cf3;
19 using namespace cf3::common;
20 
22 
23 BOOST_AUTO_TEST_SUITE( VariablesDescriptorSuite )
24 
25 
27 // Execute a script
28 BOOST_AUTO_TEST_CASE( ExecuteScript )
29 {
30  BOOST_CHECK(boost::unit_test::framework::master_test_suite().argc == 2);
31 
33 
35  boost::filesystem::fstream file(boost::unit_test::framework::master_test_suite().argv[1]);
36 
37  std::stringstream script_stream;
38  script_stream << file.rdbuf();
39 
40  engine->execute_script(script_stream.str());
41  BOOST_CHECK(is_not_null(root.get_child("group")));
42  BOOST_CHECK(is_not_null(root.get_child("group")->get_child("journal")));
43 }
44 
45 
47 
48 BOOST_AUTO_TEST_SUITE_END()
49 
50 
Manage a python interpreter.
Safe pointer to an object. This is the supported method for referring to components.
Definition: Handle.hpp:39
BOOST_AUTO_TEST_CASE(ExecuteScript)
int execute_script(std::string script, int code_fragment=-1)
Execute the script passed as a string, code fragment is used for traceability.
tuple root
Definition: coolfluid.py:24
Handle< Component > get_child(const std::string &name)
Definition: Component.cpp:441
Top-level namespace for coolfluid.
Definition: Action.cpp:18
common::Component & root() const
Gives the default root component.
Definition: Core.cpp:145
static Core & instance()
Definition: Core.cpp:37
Base class for defining CF components.
Definition: Component.hpp:82
Handle< Component > create_component(const std::string &name, const std::string &builder)
Build a (sub)component of this component using the extended type_name of the component.
Definition: Component.cpp:568
Most basic kernel library.
Definition: Action.cpp:19
bool is_not_null(T ptr)
predicate for comparison to nullptr
Definition: CF.hpp:147
Send comments to:
COOLFluiD Web Admin