public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paolo Carlini <paolo.carlini@oracle.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: libstdc++ <libstdc++@gcc.gnu.org>
Subject: [v3] Add some type_traits tests
Date: Sun, 21 Feb 2010 11:08:00 -0000	[thread overview]
Message-ID: <4B8113F8.2050101@oracle.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 67 bytes --]

Hi,

tested x86_64-linux, committed.

Paolo.

////////////////////

[-- Attachment #2: CL_ttests --]
[-- Type: text/plain, Size: 568 bytes --]

2010-02-21  Paolo Carlini  <paolo.carlini@oracle.com>

	* testsuite/20_util/is_trivial/requirements/typedefs.cc: New.
	* testsuite/20_util/is_trivial/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/is_pod/value.cc: Likewise.
	* testsuite/20_util/is_pod/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_pod/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/is_standard_layout/requiremenents/
	typedefs.cc: Likewise.
	* testsuite/20_util/is_standard_layout/requiremenents/
	explicit_instantiation.cc: Likewise.

[-- Attachment #3: patch_ttests --]
[-- Type: text/plain, Size: 11465 bytes --]

Index: testsuite/20_util/is_trivial/requirements/typedefs.cc
===================================================================
--- testsuite/20_util/is_trivial/requirements/typedefs.cc	(revision 0)
+++ testsuite/20_util/is_trivial/requirements/typedefs.cc	(revision 0)
@@ -0,0 +1,36 @@
+// { dg-options "-std=gnu++0x" }
+// 2010-02-21  Paolo Carlini  <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include <type_traits>
+
+// { dg-do compile }
+
+void test01()
+{
+  // Check for required typedefs
+  typedef std::is_trivial<int>                test_type;
+  typedef test_type::value_type               value_type;
+  typedef test_type::type                     type;
+  typedef test_type::type::value_type         type_value_type;
+  typedef test_type::type::type               type_type;
+}
Index: testsuite/20_util/is_trivial/requirements/explicit_instantiation.cc
===================================================================
--- testsuite/20_util/is_trivial/requirements/explicit_instantiation.cc	(revision 0)
+++ testsuite/20_util/is_trivial/requirements/explicit_instantiation.cc	(revision 0)
@@ -0,0 +1,30 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// 2010-02-21  Paolo Carlini  <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include <type_traits>
+
+namespace std
+{
+  typedef short test_type;
+  template struct is_trivial<test_type>;
+}
Index: testsuite/20_util/is_pod/value.cc
===================================================================
--- testsuite/20_util/is_pod/value.cc	(revision 0)
+++ testsuite/20_util/is_pod/value.cc	(revision 0)
@@ -0,0 +1,54 @@
+// { dg-options "-std=gnu++0x" }
+// 2010-02-21  Paolo Carlini  <pcarlini@suse.de>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <type_traits>
+#include <testsuite_hooks.h>
+#include <testsuite_tr1.h>
+
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+  using std::is_pod;
+  using namespace __gnu_test;
+
+  VERIFY( (test_category<is_pod, int>(true)) );
+  VERIFY( (test_category<is_pod, float>(true)) );
+  VERIFY( (test_category<is_pod, EnumType>(true)) );
+  VERIFY( (test_category<is_pod, int*>(true)) );
+  VERIFY( (test_category<is_pod, int(*)(int)>(true)) );
+  VERIFY( (test_category<is_pod, int (ClassType::*)>(true)) );
+  VERIFY( (test_category<is_pod, int (ClassType::*) (int)>(true)) );
+  VERIFY( (test_category<is_pod, int[2]>(true)) );
+  VERIFY( (test_category<is_pod, float[][3]>(true)) );
+  VERIFY( (test_category<is_pod, EnumType[2][3][4]>(true)) );
+  VERIFY( (test_category<is_pod, int*[3]>(true)) );
+  VERIFY( (test_category<is_pod, int(*[][2])(int)>(true)) );
+  VERIFY( (test_category<is_pod, int (ClassType::*[2][3])>(true)) );
+  VERIFY( (test_category<is_pod, int (ClassType::*[][2][3]) (int)>(true)) );
+  VERIFY( (test_category<is_pod, ClassType>(true)) );
+
+  VERIFY( (test_category<is_pod, void>(false)) );
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
Index: testsuite/20_util/is_pod/requirements/typedefs.cc
===================================================================
--- testsuite/20_util/is_pod/requirements/typedefs.cc	(revision 0)
+++ testsuite/20_util/is_pod/requirements/typedefs.cc	(revision 0)
@@ -0,0 +1,36 @@
+// { dg-options "-std=gnu++0x" }
+// 2010-02-21  Paolo Carlini  <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include <type_traits>
+
+// { dg-do compile }
+
+void test01()
+{
+  // Check for required typedefs
+  typedef std::is_pod<int>                    test_type;
+  typedef test_type::value_type               value_type;
+  typedef test_type::type                     type;
+  typedef test_type::type::value_type         type_value_type;
+  typedef test_type::type::type               type_type;
+}
Index: testsuite/20_util/is_pod/requirements/explicit_instantiation.cc
===================================================================
--- testsuite/20_util/is_pod/requirements/explicit_instantiation.cc	(revision 0)
+++ testsuite/20_util/is_pod/requirements/explicit_instantiation.cc	(revision 0)
@@ -0,0 +1,30 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// 2010-02-21  Paolo Carlini  <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include <type_traits>
+
+namespace std
+{
+  typedef short test_type;
+  template struct is_pod<test_type>;
+}
Index: testsuite/20_util/is_standard_layout/requiremenents/typedefs.cc
===================================================================
--- testsuite/20_util/is_standard_layout/requiremenents/typedefs.cc	(revision 0)
+++ testsuite/20_util/is_standard_layout/requiremenents/typedefs.cc	(revision 0)
@@ -0,0 +1,36 @@
+// { dg-options "-std=gnu++0x" }
+// 2010-02-21  Paolo Carlini  <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include <type_traits>
+
+// { dg-do compile }
+
+void test01()
+{
+  // Check for required typedefs
+  typedef std::is_standard_layout<int>        test_type;
+  typedef test_type::value_type               value_type;
+  typedef test_type::type                     type;
+  typedef test_type::type::value_type         type_value_type;
+  typedef test_type::type::type               type_type;
+}
Index: testsuite/20_util/is_standard_layout/requiremenents/explicit_instantiation.cc
===================================================================
--- testsuite/20_util/is_standard_layout/requiremenents/explicit_instantiation.cc	(revision 0)
+++ testsuite/20_util/is_standard_layout/requiremenents/explicit_instantiation.cc	(revision 0)
@@ -0,0 +1,30 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// 2010-02-21  Paolo Carlini  <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include <type_traits>
+
+namespace std
+{
+  typedef short test_type;
+  template struct is_standard_layout<test_type>;
+}

             reply	other threads:[~2010-02-21 11:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-21 11:08 Paolo Carlini [this message]
2010-03-23 15:22 Paolo Carlini
2010-03-23 15:58 ` Paolo Carlini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B8113F8.2050101@oracle.com \
    --to=paolo.carlini@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).