stdcpp/tsrc/Boost_test/variant/src/test4.cpp
changeset 31 ce057bb09d0b
parent 0 e4d67989cc36
equal deleted inserted replaced
30:e20de85af2ee 31:ce057bb09d0b
       
     1 //-----------------------------------------------------------------------------
       
     2 // boost-libs variant/test/test4.cpp source file
       
     3 // See http://www.boost.org for updates, documentation, and revision history.
       
     4 //-----------------------------------------------------------------------------
       
     5 //
       
     6 // Copyright (c) 2003
       
     7 // Eric Friedman, Itay Maman
       
     8 //
       
     9 // Distributed under the Boost Software License, Version 1.0. (See
       
    10 // accompanying file LICENSE_1_0.txt or copy at
       
    11 // http://www.boost.org/LICENSE_1_0.txt)
       
    12 /*
       
    13  * © Portions copyright (c) 2006-2007 Nokia Corporation.  All rights reserved.
       
    14 */
       
    15 
       
    16 #include "boost/test/minimal.hpp"
       
    17 #include "boost/variant.hpp"
       
    18 
       
    19 #include "jobs.h"
       
    20 
       
    21 #include <string>
       
    22 #ifdef __SYMBIAN32__
       
    23 #include "std_log_result.h"
       
    24 #define LOG_FILENAME_LINE __FILE__, __LINE__
       
    25 #endif
       
    26 struct class_a;
       
    27 
       
    28 using boost::variant;
       
    29 
       
    30 typedef variant<std::string, class_a, float> var_type_1;
       
    31 typedef variant<std::string, class_a, short> var_type_2;
       
    32 
       
    33 #include "class_a.h"
       
    34 
       
    35 int test_main(int , char* [])
       
    36 {
       
    37    using namespace boost;
       
    38 std_log(LOG_FILENAME_LINE,"[Test Case for test4]");
       
    39    var_type_1 v1;
       
    40    var_type_2 v2;
       
    41 
       
    42    v1 = class_a();
       
    43    verify(v1, spec<class_a>(), "[V] class_a(5511)");
       
    44 
       
    45    verify(v2, spec<std::string>(), "[V] ");
       
    46 
       
    47    v2 = "abcde";
       
    48    verify(v2, spec<std::string>(), "[V] abcde");
       
    49 
       
    50    v2 = v1;
       
    51    verify(v2, spec<class_a>(), "[V] class_a(5511)");
       
    52 
       
    53    v2 = 5;
       
    54    v1 = v2;
       
    55 #ifdef __SYMBIAN32__
       
    56    	testResultXml("test4");
       
    57 	close_log_file();
       
    58 #endif
       
    59    return boost::exit_success;
       
    60 }