Commit 4027b015 by Siva Chandra Reddy Committed by Jonathan Wakely

xmethods.py: Add xmethods for std::array, std::deque, std::forward_list, std::list, std::vector.

2014-10-13  Siva Chandra Reddy  <sivachandra@google.com>

	* python/libstdcxx/v6/xmethods.py: Add xmethods for std::array,
	std::deque, std::forward_list, std::list, std::vector.
	* testsuite/libstdc++-xmethods/array.cc: New file.
	* testsuite/libstdc++-xmethods/deque.cc: Likewise.
	* testsuite/libstdc++-xmethods/forwardlist.cc: Likewise.
	* testsuite/libstdc++-xmethods/list.cc: Likewise.
	* testsuite/libstdc++-xmethods/vector.cc: Add tests.

From-SVN: r216145
parent 913f32a1
2014-10-13 Siva Chandra Reddy <sivachandra@google.com>
* python/libstdcxx/v6/xmethods.py: Add xmethods for std::array,
std::deque, std::forward_list, std::list, std::vector.
* testsuite/libstdc++-xmethods/array.cc: New file.
* testsuite/libstdc++-xmethods/deque.cc: Likewise.
* testsuite/libstdc++-xmethods/forwardlist.cc: Likewise.
* testsuite/libstdc++-xmethods/list.cc: Likewise.
* testsuite/libstdc++-xmethods/vector.cc: Add tests.
2014-10-13 Rüdiger Sonderfeld <ruediger@c-plusplus.de>
* include/std/memory (align): Define.
......
// { dg-do run }
// { dg-options "-std=gnu++11 -g -O0" }
// Copyright (C) 2014 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 <array>
int
main ()
{
std::array<int, 10> a;
std::array<int, 0> a1;
for (int i = 0; i < 10; i++)
a[i] = 100 + i;
// { dg-final { note-test a.size() 10 } }
// { dg-final { note-test a.empty() false } }
// { dg-final { note-test a1.empty() true } }
// { dg-final { note-test a1.size() 0 } }
// { dg-final { note-test a.front() 100 } }
// { dg-final { note-test a.back() 109 } }
// { dg-final { note-test a.at(5) 105 } }
// { dg-final { note-test a\[0\] 100 } }
// { dg-final { note-test a\[4\] 104 } }
// { dg-final { note-test a\[9\] 109 } }
return 0; // Mark SPOT
}
// { dg-final { gdb-test SPOT {} 1 } }
// { dg-do run }
// { dg-options "-g -O0" }
// Copyright (C) 2014 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 <deque>
const int max_deque_node_size = 512;
int
main ()
{
std::deque<int> q0, q1, q2, q3;
int int_size = sizeof (int);
// The xmethod logic is exercised differently for deques of different size.
// Let q1 be a deque requiring only 1 node. Let q2 be a deque filling up
// exactly 2 nodes. Let q3 be of size which would require 1 node and part
// of the second node.
int q1_size = max_deque_node_size / int_size / 2;
int q2_size = max_deque_node_size / int_size * 2;
int q3_size = max_deque_node_size / int_size * 3 / 2;
for (int i = 0; i < q1_size; i++)
q1.push_back (100 + i);
for (int i = 0; i < q2_size; i++)
q2.push_back (200 + i);
for (int i = 0; i < q3_size; i++)
q3.push_back (300 + i);
// { dg-final { note-test q0.empty() true } }
// { dg-final { note-test q1.empty() false } }
// { dg-final { note-test q0.size() 0 } }
// { dg-final { note-test q1.size()==q1_size true } }
// { dg-final { note-test q2.size()==q2_size true } }
// { dg-final { note-test q3.size()==q3_size true } }
// { dg-final { note-test q1.front() 100 } }
// { dg-final { note-test q2.front() 200 } }
// { dg-final { note-test q3.front() 300 } }
// { dg-final { note-test q1.back()==(100+q1_size-1) true } }
// { dg-final { note-test q2.back()==(200+q2_size-1) true } }
// { dg-final { note-test q3.back()==(300+q3_size-1) true } }
// { dg-final { note-test q3\[0\] 300 } }
// { dg-final { note-test q3\[q3_size/2\]==(300+q3_size/2) true } }
// { dg-final { note-test q3\[q3_size-1]==(300+q3_size-1) true } }
return 0; // Mark SPOT
}
// { dg-final { gdb-test SPOT {} 1 } }
// { dg-do run }
// { dg-options "-std=gnu++11 -g -O0" }
// Copyright (C) 2014 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 <forward_list>
int
main ()
{
std::forward_list<int> l0, l1;
l1.push_front (0);
l1.push_front (1);
l1.push_front (2);
l1.push_front (11011);
// { dg-final { note-test l0.empty() true } }
// { dg-final { note-test l1.empty() false } }
// { dg-final { note-test l1.front() 11011 } }
return 0; // Mark SPOT
}
// { dg-final { gdb-test SPOT {} 1 } }
// { dg-do run }
// { dg-options "-g -O0" }
// Copyright (C) 2014 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 <list>
int
main ()
{
std::list<int> l0, l1;
l1.push_back (123);
l1.push_back (456);
l1.push_back (789);
// { dg-final { note-test l0.empty() true } }
// { dg-final { note-test l1.empty() false } }
// { dg-final { note-test l1.size() 3 } }
// { dg-final { note-test l1.front() 123 } }
// { dg-final { note-test l1.back() 789 } }
return 0; // Mark SPOT
}
// { dg-final { gdb-test SPOT {} 1 } }
......@@ -23,14 +23,65 @@
int
main ()
{
std::vector<int> v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
// { dg-final { note-test v\[0\] 1 } }
// { dg-final { note-test v\[1\] 2 } }
// { dg-final { note-test v\[2\] 3 } }
// { dg-final { note-test v.size() 3 } }
std::vector<int> v0, v1;
std::vector<bool> bv0, bv1, bv2, bv3;
v1.push_back (1);
v1.push_back (2);
v1.push_back (3);
for (int i = 0; i < 15; i++)
bv1.push_back (i % 3);
for (int i = 0; i < 64; i++)
bv2.push_back (i % 2);
for (int i = 0; i < 65; i++)
bv3.push_back (i % 2);
// { dg-final { note-test v1\[0\] 1 } }
// { dg-final { note-test v1\[1\] 2 } }
// { dg-final { note-test v1\[2\] 3 } }
// { dg-final { note-test bv1\[0\] false } }
// { dg-final { note-test bv1\[1\] true } }
// { dg-final { note-test bv1\[14\] true } }
// { dg-final { note-test bv2\[0\] false } }
// { dg-final { note-test bv2\[1\] true } }
// { dg-final { note-test bv2\[63\] true } }
// { dg-final { note-test bv3\[0\] false } }
// { dg-final { note-test bv3\[1\] true } }
// { dg-final { note-test bv3\[63\] true } }
// { dg-final { note-test v0.size() 0 } }
// { dg-final { note-test bv0.size() 0 } }
// { dg-final { note-test v1.size() 3 } }
// { dg-final { note-test bv1.size() 15 } }
// { dg-final { note-test bv2.size() 64 } }
// { dg-final { note-test bv3.size() 65 } }
// { dg-final { note-test v0.empty() true } }
// { dg-final { note-test v1.empty() false } }
// { dg-final { note-test bv0.empty() true } }
// { dg-final { note-test bv1.empty() false } }
// { dg-final { note-test bv2.empty() false } }
// { dg-final { note-test bv3.empty() false } }
// { dg-final { note-test v1.front() 1 } }
// { dg-final { note-test v1.back() 3 } }
// { dg-final { note-test bv1.front() false } }
// { dg-final { note-test bv1.back() true } }
// { dg-final { note-test bv2.front() false } }
// { dg-final { note-test bv2.back() true } }
// { dg-final { note-test bv3.front() false } }
// { dg-final { note-test bv3.back() false } }
// { dg-final { note-test v1.at(1) 2 } }
// { dg-final { note-test bv1.at(0) false } }
// { dg-final { note-test bv1.at(1) true } }
// { dg-final { note-test bv1.at(14) true } }
// { dg-final { note-test bv2.at(0) false } }
// { dg-final { note-test bv2.at(1) true } }
// { dg-final { note-test bv2.at(63) true } }
// { dg-final { note-test bv3.at(0) false } }
// { dg-final { note-test bv3.at(1) true } }
// { dg-final { note-test bv3.at(63) true } }
// { dg-final { note-test bv3.at(64) false } }
return 0; // Mark SPOT
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment