Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > 7348b4eba6cdbb7638a2bcf7e83acf03 > files > 48

airrac-doc-0.2.3-2.fc16.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
	<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
	<meta name="robots" content="index,follow"/>
	<title>Command-Line Test to Demonstrate How To Test the AirRAC Project</title>
	<link rel="shortcut icon" href="favicon.ico">
	<link href="tabs.css" rel="stylesheet" type="text/css"/>
	<link href="airrac.css" rel="stylesheet" type="text/css"/>
	<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
	<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
	
	<script type="text/javascript">
	  var _gaq = _gaq || [];
	  _gaq.push(['_setAccount', 'UA-24983440-1']);
	  _gaq.push(['_setDomainName', 'none']);
	  _gaq.push(['_setAllowLinker', true]);
	  _gaq.push(['_trackPageview']);
	  (function() {
      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	  })();
	</script>
	<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
  </head>

  <body>
	<div id="top"><!-- do not remove this div! -->
	  
	  <div id="titlearea">
		<table width="100%">
		  <tbody>
			<tr style="height: 56px;">
			  
			  <td style="padding-left: 0.5em;">
				<div id="projectname"><a href="http://airrac.sourceforge.net"><img height="45px" alt="AirRAC Logo" src="airrac_logo.png"></a>
				  
				  &#160;<span id="projectnumber">0.2.3</span>
				  
				</div>
				
				<div id="projectbrief">C++ Simulated Revenue Accounting (RAC) System Library</div>
				
			  </td>
			  
			  

			  <!-- begin SOURCEFORGE_CUSTOM-->
			  <td>
				<div id="sflogo"><a href="http://airrac.sourceforge.net"><img height="45px" alt="SourceForge Logo" src="sfx_logo.png"></a></div>
			  </td>
			  <!-- end SOURCEFORGE_CUSTOM-->

			  
			</tr>
		  </tbody>
		</table>
	  </div>
	  

<!-- Generated by Doxygen 1.7.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="dynsections.js"></script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('YieldTestSuite_cpp.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">Command-Line Test to Demonstrate How To Test the AirRAC Project </div>  </div>
</div>
<div class="contents">
<div class="textblock"><div class="fragment"><pre class="fragment"> */
<span class="comment">// //////////////////////////////////////////////////////////////////////</span>
<span class="comment">// Import section</span>
<span class="comment">// //////////////////////////////////////////////////////////////////////</span>
<span class="comment">// STL</span>
<span class="preprocessor">#include &lt;sstream&gt;</span>
<span class="preprocessor">#include &lt;fstream&gt;</span>
<span class="preprocessor">#include &lt;string&gt;</span>
<span class="comment">// Boost Unit Test Framework (UTF)</span>
<span class="preprocessor">#define BOOST_TEST_DYN_LINK</span>
<span class="preprocessor"></span><span class="preprocessor">#define BOOST_TEST_MAIN</span>
<span class="preprocessor"></span><span class="preprocessor">#define BOOST_TEST_MODULE YieldTestSuite</span>
<span class="preprocessor"></span><span class="preprocessor">#include &lt;boost/test/unit_test.hpp&gt;</span>
<span class="comment">// StdAir</span>
<span class="preprocessor">#include &lt;stdair/basic/BasLogParams.hpp&gt;</span>
<span class="preprocessor">#include &lt;stdair/basic/BasDBParams.hpp&gt;</span>
<span class="preprocessor">#include &lt;stdair/basic/BasFileMgr.hpp&gt;</span>
<span class="preprocessor">#include &lt;stdair/bom/TravelSolutionStruct.hpp&gt;</span>
<span class="preprocessor">#include &lt;stdair/service/Logger.hpp&gt;</span>
<span class="comment">// Airrac</span>
<span class="preprocessor">#include &lt;<a class="code" href="AIRRAC__Service_8hpp.html">airrac/AIRRAC_Service.hpp</a>&gt;</span>
<span class="preprocessor">#include &lt;<a class="code" href="airrac-paths_8hpp.html">airrac/config/airrac-paths.hpp</a>&gt;</span>

<span class="keyword">namespace </span>boost_utf = boost::unit_test;

<span class="comment">// (Boost) Unit Test XML Report</span>
std::ofstream utfReportStream (<span class="stringliteral">&quot;YieldTestSuite_utfresults.xml&quot;</span>);

<span class="keyword">struct </span>UnitTestConfig {
  UnitTestConfig() {
    boost_utf::unit_test_log.set_stream (utfReportStream);
    boost_utf::unit_test_log.set_format (boost_utf::XML);
    boost_utf::unit_test_log.set_threshold_level (boost_utf::log_test_units);
    <span class="comment">//boost_utf::unit_test_log.set_threshold_level (boost_utf::log_successful_tests);</span>
  }

  ~UnitTestConfig() {
  }
};

<span class="comment">// //////////////////////////////////////////////////////////////////////</span>

<span class="keywordtype">void</span> testYieldQuoterHelper (<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> iTestFlag,
                            <span class="keyword">const</span> stdair::Filename_T iYieldInputFilename,
                            <span class="keyword">const</span> <span class="keywordtype">bool</span> isBuiltin) {

  <span class="comment">// Output log File</span>
  std::ostringstream oStr;
  oStr &lt;&lt; <span class="stringliteral">&quot;FQTTestSuite_&quot;</span> &lt;&lt; iTestFlag &lt;&lt; <span class="stringliteral">&quot;.log&quot;</span>;
  <span class="keyword">const</span> stdair::Filename_T lLogFilename (oStr.str());

  <span class="comment">// Set the log parameters</span>
  std::ofstream logOutputFile;
  <span class="comment">// Open and clean the log outputfile</span>
  logOutputFile.open (lLogFilename.c_str());
  logOutputFile.clear();
    
  <span class="comment">// Initialise the AirRAC service object</span>
  <span class="keyword">const</span> stdair::BasLogParams lLogParams (stdair::LOG::DEBUG,
                                         logOutputFile);
  
  <span class="comment">// Initialise the AirRAC service object</span>
  AIRRAC::AIRRAC_Service airracService (lLogParams);
  
  <span class="comment">// Build a sample list of travel solutions</span>
  stdair::TravelSolutionList_T lTravelSolutionList;
  airracService.buildSampleTravelSolutions (lTravelSolutionList);

  <span class="comment">// Check whether or not a (CSV) input file should be read</span>
  <span class="keywordflow">if</span> (isBuiltin == <span class="keyword">true</span>) {

    <span class="comment">// Build the default sample BOM tree (filled with yields) for AirRAC</span>
    airracService.buildSampleBom();

  } <span class="keywordflow">else</span> {

    <span class="comment">// Build the BOM tree from parsing the yield input file    </span>
    AIRRAC::YieldFilePath lYieldFilePath (iYieldInputFilename);
    airracService.parseAndLoad (lYieldFilePath);
  }

  <span class="comment">// Calculate the yields for the given travel solution</span>
  airracService.calculateYields (lTravelSolutionList);

  <span class="comment">// Close the log file</span>
  logOutputFile.close();

}


<span class="comment">// /////////////// Main: Unit Test Suite //////////////</span>

<span class="comment">// Set the UTF configuration (re-direct the output to a specific file)</span>
BOOST_GLOBAL_FIXTURE (UnitTestConfig);

<span class="comment">// Start the test suite</span>
BOOST_AUTO_TEST_SUITE (master_test_suite)


BOOST_AUTO_TEST_CASE (airrac_simple_yield) {

  <span class="comment">// Input file name</span>
  <span class="keyword">const</span> stdair::Filename_T lYieldInputFilename (<a class="code" href="airrac-paths_8hpp.html#af06cd429ada6c5a061032f4278de45d1">STDAIR_SAMPLE_DIR</a> <span class="stringliteral">&quot;/yieldstore01.csv&quot;</span>);

  <span class="comment">// State whether the BOM tree should be built-in or parsed from an input file</span>
  <span class="keyword">const</span> <span class="keywordtype">bool</span> isBuiltin = <span class="keyword">false</span>;

  <span class="comment">// Try to yieldQuote the sample default list of travel solutions</span>
  BOOST_CHECK_NO_THROW (testYieldQuoterHelper (0, lYieldInputFilename, isBuiltin));
  
}

BOOST_AUTO_TEST_CASE (airrac_error_parsing_input_file) {

  <span class="comment">// Input file name</span>
  <span class="keyword">const</span> stdair::Filename_T lYieldInputFilename (<a class="code" href="airrac-paths_8hpp.html#af06cd429ada6c5a061032f4278de45d1">STDAIR_SAMPLE_DIR</a> <span class="stringliteral">&quot;/yieldstoreError01.csv&quot;</span>);

  <span class="comment">// State whether the BOM tree should be built-in or parsed from an input file</span>
  <span class="keyword">const</span> <span class="keywordtype">bool</span> isBuiltin = <span class="keyword">false</span>;
    
  <span class="comment">// Try to yield quote the sample default list of travel solutions</span>
  BOOST_CHECK_THROW (testYieldQuoterHelper (1, lYieldInputFilename, isBuiltin),
                     <a class="code" href="classAIRRAC_1_1YieldFileParsingFailedException.html">AIRRAC::YieldFileParsingFailedException</a>);
}

BOOST_AUTO_TEST_CASE (airrac_error_missing_input_file) {

  <span class="comment">// Input file name</span>
  <span class="keyword">const</span> stdair::Filename_T lYieldInputFilename (<a class="code" href="airrac-paths_8hpp.html#af06cd429ada6c5a061032f4278de45d1">STDAIR_SAMPLE_DIR</a> <span class="stringliteral">&quot;/missingFile.csv&quot;</span>);

  <span class="comment">// State whether the BOM tree should be built-in or parsed from an input file</span>
  <span class="keyword">const</span> <span class="keywordtype">bool</span> isBuiltin = <span class="keyword">false</span>;
    
  <span class="comment">// Try to yield quote the sample default list of travel solutions</span>
  BOOST_CHECK_THROW (testYieldQuoterHelper (2, lYieldInputFilename, isBuiltin),
                     <a class="code" href="classAIRRAC_1_1YieldInputFileNotFoundException.html">AIRRAC::YieldInputFileNotFoundException</a>);
}

BOOST_AUTO_TEST_CASE (airrac_simple_yield_built_in) {

  <span class="comment">// State whether the BOM tree should be built-in or parsed from an input file</span>
  <span class="keyword">const</span> <span class="keywordtype">bool</span> isBuiltin = <span class="keyword">true</span>;

  <span class="comment">// Try to yield quote the sample default list of travel solutions</span>
  BOOST_CHECK_NO_THROW (testYieldQuoterHelper (3, <span class="stringliteral">&quot; &quot;</span>, isBuiltin));
  
}

<span class="comment">// End the test suite</span>
BOOST_AUTO_TEST_SUITE_END()

<span class="comment">/*!</span>
</pre></div> </div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

		
		<li class="footer">Generated on Tue Dec 6 2011 14:11:39 for AirRAC by
		  <a href="http://www.doxygen.org/index.html">
			<img class="footer" src="doxygen.png" alt="doxygen"/></a> 
		  1.7.5
		</li>
		<li class="footer">
		  <a href="http://sourceforge.net/projects/airrac"><img class="footer" src="http://sflogo.sourceforge.net/sflogo.php?group_id=317250&type=12&format=.png" alt="SourceForge Logo"></a>
		</li>
	  </ul>
	</div>
	

	
  </body>
</html>