OSDN Git Service

original
[gb-231r1-is01/Gingerbread_2.3.3_r1_IS01.git] / ndk / tests / device / test-gnustl-full / unit / resolve_name.cpp
1 #define _STLP_DO_IMPORT_CSTD_FUNCTIONS
2 #include <cmath>
3
4 #if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
5
6 namespace NS1 {
7
8 bool f()
9 {
10   double d( 1.0 );
11
12   d = sqrt( d );
13   d = ::sqrt( d );
14   d = std::sqrt( d );
15   return d == 1.0;
16 }
17
18 }
19
20 namespace {
21
22 bool g()
23 {
24   double d( 1.0 );
25
26   d = sqrt( d );
27   d = ::sqrt( d );
28   d = std::sqrt( d );
29   return d == 1.0;
30 }
31
32 }
33
34 // VC6 consider call to sqrt ambiguous as soon as using namespace std has
35 // been invoked.
36 #if !defined (STLPORT) || !defined (_STLP_MSVC) || (_STLP_MSVC >= 1300)
37 using namespace std;
38 #endif
39
40 bool h()
41 {
42   double d( 1.0 );
43
44   d = sqrt( d );
45   d = ::sqrt( d );
46   d = std::sqrt( d );
47   return d == 1.0;
48 }
49
50 struct sq
51 {
52   sq() {}
53
54   double sqroot( double x ) {
55     using std::sqrt;
56     return sqrt(x);
57   }
58 };
59
60 #endif
61
62
63 #if 0 // Do nothing, this should be compiled only
64
65 #include "cppunit/cppunit_proxy.h"
66
67 class ResolveNameTest : public CPPUNIT_NS::TestCase
68 {
69   CPPUNIT_TEST_SUITE(ResolveNameTest);
70   CPPUNIT_TEST(cstyle);
71   CPPUNIT_TEST_SUITE_END();
72
73 protected:
74   void cstyle();
75 };
76
77 CPPUNIT_TEST_SUITE_REGISTRATION(ResolveNameTest);
78
79 void ResolveNameTest::cstyle()
80 {
81 }
82
83 #endif