equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // STLport regression testsuite component. |
|
20 // To compile as a separate example, please #define MAIN. |
|
21 |
|
22 #include <algorithm> |
|
23 #include <iostream> |
|
24 |
|
25 #ifdef MAIN |
|
26 #define copyb0_test main |
|
27 #endif |
|
28 |
|
29 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES) |
|
30 using namespace std; |
|
31 #endif |
|
32 int copyb0_test(int, char**) |
|
33 { |
|
34 |
|
35 cout<<"Results of copyb0_test:"<<endl; |
|
36 int numbers[5] = { 1, 2, 3, 4, 5 }; |
|
37 |
|
38 int failures = 0; |
|
39 int result[5]; |
|
40 copy_backward(numbers, numbers + 5, (int*)result + 5); |
|
41 int i; |
|
42 for(i = 0; i < 5; i++) |
|
43 cout << numbers[i] << ' '; |
|
44 cout << endl; |
|
45 for(i = 0; i < 5; i++) |
|
46 cout << result[i] << ' '; |
|
47 cout << endl; |
|
48 |
|
49 for(int i = 0; i < 5; i++) |
|
50 { |
|
51 if (result[i] != numbers[i]) |
|
52 failures++; |
|
53 } |
|
54 |
|
55 if(!failures) |
|
56 return 0; |
|
57 else |
|
58 return 1; |
|
59 |
|
60 } |