os/ossrv/stdcpp/tsrc/Boost_test/variant/src/test6.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 //-----------------------------------------------------------------------------
     2 // boost-libs variant/test/test6.cpp header 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 <iostream>
    20 
    21 #include "jobs.h"
    22 #ifdef __SYMBIAN32__
    23 #include "std_log_result.h"
    24 #define LOG_FILENAME_LINE __FILE__, __LINE__
    25 #endif
    26 
    27 //Just Another Class
    28 struct jac
    29 {
    30    jac() { }
    31    jac(int ) { }
    32    jac(const char* ) { }
    33 };
    34 
    35 std::ostream& operator<<(std::ostream& out, const jac& )
    36 {
    37    out << "jac ";
    38    return out;
    39 }
    40 
    41 
    42 void run()
    43 {
    44    using boost::variant;
    45 
    46    variant<jac, int, double*, const double*> v1;   
    47    variant<int, char, double*, const double*, char*> v2;
    48 
    49    v1 = v2;
    50 
    51    verify(v1, spec<int>());
    52    verify(v2, spec<int>());
    53 
    54    verify_not(v1, spec<jac>());
    55    verify_not(v1, spec<double*>());
    56    verify_not(v1, spec<const double*>());
    57 
    58    verify_not(v2, spec<char>());
    59    verify_not(v2, spec<double*>());
    60    verify_not(v2, spec<const double*>());
    61    verify_not(v2, spec<char*>());
    62 
    63 
    64    variant<jac, const double*> v3;
    65    variant<int, unsigned char, double*> v4;
    66 
    67    v3 = v4;
    68    verify(v3, spec<jac>());
    69    verify(v4, spec<int>());
    70    verify_not(v4, spec<unsigned char>());
    71 }
    72 
    73 
    74 
    75 int test_main(int , char* [])
    76 {
    77 std_log(LOG_FILENAME_LINE,"[Test Case for test6]");
    78    run();
    79 #ifdef __SYMBIAN32__
    80    	testResultXml("test6");
    81 	close_log_file();
    82 #endif
    83    return 0;
    84 }
    85