OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libstdc++-v3/] [testsuite/] [tr1/] [4_metaprogramming/] [type_properties/] [is_empty/] [is_empty.cc] - Blame information for rev 19

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 jlechner
// 2005-01-28  Paolo Carlini  <pcarlini@suse.de>
2
//
3
// Copyright (C) 2005 Free Software Foundation, Inc.
4
//
5
// This file is part of the GNU ISO C++ Library.  This library is free
6
// software; you can redistribute it and/or modify it under the
7
// terms of the GNU General Public License as published by the
8
// Free Software Foundation; either version 2, or (at your option)
9
// any later version.
10
//
11
// This library is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
// GNU General Public License for more details.
15
//
16
// You should have received a copy of the GNU General Public License along
17
// with this library; see the file COPYING.  If not, write to the Free
18
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19
// USA.
20
 
21
// 4.5.3 Type properties
22
 
23
#include <tr1/type_traits>
24
#include <testsuite_hooks.h>
25
#include <testsuite_tr1.h>
26
 
27
class EmptyClassOne
28
{ typedef int type; };
29
 
30
class EmptyClassTwo
31
{ static int data; };
32
 
33
class EmptyClassThree
34
{ int f(); };
35
 
36
class NonEmptyClassOne
37
{ int data; };
38
 
39
class NonEmptyClassTwo
40
{
41
  virtual int f();
42
  virtual ~NonEmptyClassTwo();
43
};
44
 
45
void test01()
46
{
47
  bool test __attribute__((unused)) = true;
48
  using std::tr1::is_empty;
49
  using namespace __gnu_test;
50
 
51
  // Positive tests.
52
  VERIFY( (test_category<is_empty, ClassType>(true)) );
53
  VERIFY( (test_category<is_empty, EmptyClassOne>(true)) );
54
  VERIFY( (test_category<is_empty, EmptyClassTwo>(true)) );
55
  VERIFY( (test_category<is_empty, EmptyClassThree>(true)) );
56
 
57
  // Negative tests.
58
  VERIFY( (test_category<is_empty, void>(false)) );
59
  VERIFY( (test_category<is_empty, float>(false)) );
60
  VERIFY( (test_category<is_empty, int[4]>(false)) );
61
  VERIFY( (test_category<is_empty, int*>(false)) );
62
  VERIFY( (test_category<is_empty, int&>(false)) );
63
  VERIFY( (test_category<is_empty, int (ClassType::*)>(false)) );
64
  VERIFY( (test_category<is_empty, EnumType>(false)) );
65
  VERIFY( (test_category<is_empty, int (int)>(false)) );
66
 
67
  VERIFY( (test_category<is_empty, AbstractClass>(false)) );
68
  VERIFY( (test_category<is_empty, NonEmptyClassOne>(false)) );
69
  VERIFY( (test_category<is_empty, NonEmptyClassTwo>(false)) );
70
}
71
 
72
int main()
73
{
74
  test01();
75
  return 0;
76
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.