dburgess | 82c46ff | 2011-10-07 02:40:51 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2008 Free Software Foundation, Inc. |
| 3 | * |
| 4 | * |
| 5 | * This software is distributed under the terms of the GNU Affero Public License. |
| 6 | * See the COPYING file in the main directory for details. |
| 7 | * |
| 8 | * This use of this software may be subject to additional restrictions. |
| 9 | * See the LEGAL file in the main directory for details. |
| 10 | |
| 11 | This program is free software: you can redistribute it and/or modify |
| 12 | it under the terms of the GNU Affero General Public License as published by |
| 13 | the Free Software Foundation, either version 3 of the License, or |
| 14 | (at your option) any later version. |
| 15 | |
| 16 | This program is distributed in the hope that it will be useful, |
| 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | GNU Affero General Public License for more details. |
| 20 | |
| 21 | You should have received a copy of the GNU Affero General Public License |
| 22 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 23 | |
| 24 | */ |
| 25 | |
| 26 | |
| 27 | |
| 28 | #include "Vector.h" |
| 29 | #include <iostream> |
| 30 | |
| 31 | using namespace std; |
| 32 | |
| 33 | typedef Vector<int> TestVector; |
| 34 | |
| 35 | int main(int argc, char *argv[]) |
| 36 | { |
| 37 | TestVector test1(5); |
| 38 | for (int i=0; i<5; i++) test1[i]=i; |
| 39 | TestVector test2(5); |
| 40 | for (int i=0; i<5; i++) test2[i]=10+i; |
| 41 | |
| 42 | cout << test1 << endl; |
| 43 | cout << test2 << endl; |
| 44 | |
| 45 | { |
| 46 | TestVector testC(test1,test2); |
| 47 | cout << testC << endl; |
| 48 | cout << testC.head(3) << endl; |
| 49 | cout << testC.tail(3) << endl; |
| 50 | testC.fill(8); |
| 51 | cout << testC << endl; |
| 52 | test1.copyToSegment(testC,3); |
| 53 | cout << testC << endl; |
| 54 | |
| 55 | TestVector testD(testC.segment(4,3)); |
| 56 | cout << testD << endl; |
| 57 | testD.fill(9); |
| 58 | cout << testC << endl; |
| 59 | cout << testD << endl; |
| 60 | } |
| 61 | |
| 62 | return 0; |
| 63 | } |