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