ReactOS  0.4.13-dev-52-g0efcfec
valarray_test.cpp
Go to the documentation of this file.
1 #include <valarray>
2 
4 
5 #if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
6 using namespace std;
7 #endif
8 
9 //
10 // TestCase class
11 //
12 class ValarrayTest : public CPPUNIT_NS::TestCase
13 {
15  CPPUNIT_TEST(transcendentals);
17 
18 protected:
19  void transcendentals();
20 };
21 
23 
24 //
25 // tests implementation
26 //
27 // For the moment this test is just a complitation test
28 // everyone is welcome to do a real good unit test for
29 // valarray functionality.
31 {
32 #ifdef __SUNPRO_CC
33  using std::abs;
34 #endif
35  {
36  valarray<double> darray;
37  valarray<double> tmp;
38  tmp = abs(darray);
39  tmp = acos(darray);
40  tmp = asin(darray);
41  tmp = atan(darray);
42  tmp = atan2(darray, tmp);
43  tmp = atan2(1.0, darray);
44  tmp = atan2(darray, 1.0);
45  tmp = cos(darray);
46  tmp = cosh(darray);
47  tmp = sin(darray);
48  tmp = sinh(darray);
49  tmp = tan(darray);
50 #if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_M_AMD64)
51  tmp = tanh(darray);
52 #endif
53  tmp = exp(darray);
54  tmp = log(darray);
55  tmp = log10(darray);
56  tmp = pow(darray, tmp);
57  tmp = pow(1.0, darray);
58  tmp = pow(darray, 1.0);
59  tmp = sqrt(darray);
60  }
61  {
62  valarray<float> farray;
63  valarray<float> tmp;
64  tmp = abs(farray);
65  tmp = acos(farray);
66  tmp = asin(farray);
67  tmp = atan(farray);
68  tmp = atan2(farray, tmp);
69  tmp = atan2(1.0f, farray);
70  tmp = atan2(farray, 1.0f);
71  tmp = cos(farray);
72  tmp = cosh(farray);
73  tmp = sin(farray);
74  tmp = sinh(farray);
75  tmp = tan(farray);
76 #if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_M_AMD64)
77  tmp = tanh(farray);
78 #endif
79  tmp = exp(farray);
80  tmp = log(farray);
81  tmp = log10(farray);
82  tmp = pow(farray, tmp);
83  tmp = pow(1.0f, farray);
84  tmp = pow(farray, 1.0f);
85  tmp = sqrt(farray);
86  }
87 #if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE)
88  {
89  valarray<long double> ldarray;
91  tmp = abs(ldarray);
92  tmp = acos(ldarray);
93  tmp = asin(ldarray);
94  tmp = atan(ldarray);
95  tmp = atan2(ldarray, tmp);
96  tmp = atan2(1.0l, ldarray);
97  tmp = atan2(ldarray, 1.0l);
98  tmp = cos(ldarray);
99  tmp = cosh(ldarray);
100  tmp = sin(ldarray);
101  tmp = sinh(ldarray);
102  tmp = tan(ldarray);
103 # if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_M_AMD64)
104  tmp = tanh(ldarray);
105 # endif
106  tmp = exp(ldarray);
107  tmp = log(ldarray);
108  tmp = log10(ldarray);
109  tmp = pow(ldarray, tmp);
110  tmp = pow(1.0l, ldarray);
111  tmp = pow(ldarray, 1.0l);
112  tmp = sqrt(ldarray);
113  }
114 #endif
115  valarray<double> v0(2, 10);
116  valarray<double> v1(v0[slice(0, 1, 5)]);
117  v0[slice(0, 1, 5)] = 5;
119  //valarray<double> v3(v0[valarray<bool>()]);
121 }
_STLP_DECLSPEC complex< float > _STLP_CALL sqrt(const complex< float > &)
Definition: complex.cpp:188
_STLP_DECLSPEC complex< float > _STLP_CALL sinh(const complex< float > &)
#define abs(i)
Definition: fconv.c:206
CPPUNIT_TEST_SUITE_REGISTRATION(ValarrayTest)
valarray< _Tp > atan2(const valarray< _Tp > &__x, const valarray< _Tp > &__y)
Definition: _valarray.h:928
_STLP_DECLSPEC complex< float > _STLP_CALL cosh(const complex< float > &)
void transcendentals()
GLfloat v0
Definition: glext.h:6061
#define CPPUNIT_TEST_SUITE(X)
Definition: cppunit_mini.h:142
#define CPPUNIT_TEST(X)
Definition: cppunit_mini.h:182
Definition: features.h:417
valarray< _Tp > asin(const valarray< _Tp > &__x)
Definition: _valarray.h:910
valarray< _Tp > acos(const valarray< _Tp > &__x)
Definition: _valarray.h:901
_STLP_DECLSPEC complex< float > _STLP_CALL tanh(const complex< float > &)
float pow(float __x, int __y)
Definition: _cmath.h:458
_STLP_DECLSPEC complex< float > _STLP_CALL cos(const complex< float > &)
#define CPPUNIT_TEST_SUITE_END()
Definition: cppunit_mini.h:191
r l[0]
Definition: byte_order.h:167
GLfloat f
Definition: glext.h:7540
_STLP_DECLSPEC complex< float > _STLP_CALL log10(const complex< float > &)
Definition: complex.cpp:230
valarray< _Tp > atan(const valarray< _Tp > &__x)
Definition: _valarray.h:919
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
DWORD exp
Definition: msg.c:15681
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)
_STLP_DECLSPEC complex< float > _STLP_CALL tan(const complex< float > &)
GLfloat GLfloat v1
Definition: glext.h:6062
#define log(outFile, fmt,...)
Definition: util.h:15