1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/stdcpp/tsrc/Boost_test/array/src/array4.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,62 @@
1.4 +/* example for using class array<>
1.5 + * (C) Copyright Nicolai M. Josuttis 2001.
1.6 + * Distributed under the Boost Software License, Version 1.0. (See
1.7 + * accompanying file LICENSE_1_0.txt or copy at
1.8 + * http://www.boost.org/LICENSE_1_0.txt)
1.9 + */
1.10 +/*
1.11 + * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved.
1.12 +*/
1.13 +
1.14 +#include <algorithm>
1.15 +#include <functional>
1.16 +#include <string>
1.17 +#include <iostream>
1.18 +#include <boost/array.hpp>
1.19 +
1.20 +#ifdef __SYMBIAN32__
1.21 +#include "std_log_result.h"
1.22 +#define LOG_FILENAME_LINE __FILE__, __LINE__
1.23 +#endif
1.24 +int main()
1.25 +{
1.26 +std_log(LOG_FILENAME_LINE,"[Test Case for array4]");
1.27 + // array of arrays of seasons
1.28 + boost::array<boost::array<std::string,4>,2> seasons_i18n = {
1.29 + { { { "spring", "summer", "autumn", "winter", } },
1.30 + { { "Fruehling", "Sommer", "Herbst", "Winter" } }
1.31 + }
1.32 + };
1.33 +
1.34 + // for any array of seasons print seasons
1.35 + for (unsigned i=0; i<seasons_i18n.size(); ++i) {
1.36 + boost::array<std::string,4> seasons = seasons_i18n[i];
1.37 + for (unsigned j=0; j<seasons.size(); ++j) {
1.38 + std::cout << seasons[j] << " ";
1.39 + }
1.40 + std::cout << std::endl;
1.41 + }
1.42 +
1.43 + // print first element of first array
1.44 + std::cout << "first element of first array: "
1.45 + << seasons_i18n[0][0] << std::endl;
1.46 +
1.47 + // print last element of last array
1.48 + std::cout << "last element of last array: "
1.49 + << seasons_i18n[seasons_i18n.size()-1][seasons_i18n[0].size()-1]
1.50 + << std::endl;
1.51 + if(seasons_i18n[0][0]!= "spring" && seasons_i18n[seasons_i18n.size()-1][seasons_i18n[0].size()-1] != "Winter")
1.52 + {
1.53 + std_log(LOG_FILENAME_LINE,"Result : Failed");
1.54 + assert_failed = true;
1.55 + }
1.56 + else
1.57 + std_log(LOG_FILENAME_LINE,"Result : Passed");
1.58 +#ifdef __SYMBIAN32__
1.59 + testResultXml("array4");
1.60 + close_log_file();
1.61 +#endif
1.62 +
1.63 + return 0; // makes Visual-C++ compiler happy
1.64 +}
1.65 +