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 // STLport regression testsuite component. |
|
19 // To compile as a separate example, please #define MAIN. |
|
20 |
|
21 #include <algorithm> |
|
22 #include <numeric> |
|
23 #include <iostream> |
|
24 |
|
25 #ifdef MAIN |
|
26 #define partsum0_test main |
|
27 #endif |
|
28 |
|
29 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES) |
|
30 using namespace std; |
|
31 #endif |
|
32 int partsum0_test(int, char**) |
|
33 { |
|
34 |
|
35 int failures=0; |
|
36 cout<<"Results of partsum0_test:"<<endl; |
|
37 int numbers[6] = { 1, 2, 3, 4, 5, 6 }; |
|
38 |
|
39 int result[6]; |
|
40 partial_sum((int*)numbers, (int*)numbers + 6, (int*)result); |
|
41 for(int i = 0; i < 6; i ++) |
|
42 cout << result[i] << ' '; |
|
43 cout << endl; |
|
44 |
|
45 if( 1!=result[0]) |
|
46 failures++; |
|
47 else if(3!=result[1]) |
|
48 failures++; |
|
49 else if(6!=result[2]) |
|
50 failures++; |
|
51 else if(10!=result[3]) |
|
52 failures++; |
|
53 else if(15!=result[4]) |
|
54 failures++; |
|
55 else if(21!=result[5]) |
|
56 failures++; |
|
57 |
|
58 if(failures) |
|
59 return 1; |
|
60 else |
|
61 return 0; |
|
62 } |