OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2010 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) | 11 #if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) |
12 #include <math.h> | 12 #include <math.h> |
13 #endif | 13 #endif |
14 | 14 |
15 #include "webrtc/base/gunit.h" | 15 #include "webrtc/base/gunit.h" |
16 #include "webrtc/base/latebindingsymboltable.h" | 16 #include "webrtc/base/latebindingsymboltable.h" |
17 | 17 |
18 namespace rtc { | 18 namespace rtc { |
19 | 19 |
20 #if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) | 20 #if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) |
21 | 21 |
22 #define LIBM_SYMBOLS_CLASS_NAME LibmTestSymbolTable | 22 #define LIBM_SYMBOLS_CLASS_NAME LibmTestSymbolTable |
23 #define LIBM_SYMBOLS_LIST \ | 23 #define LIBM_SYMBOLS_LIST \ |
24 X(acos) \ | 24 X(acosf) \ |
25 X(sin) \ | 25 X(sinf) \ |
26 X(tan) | 26 X(tanf) |
| 27 |
27 | 28 |
28 #define LATE_BINDING_SYMBOL_TABLE_CLASS_NAME LIBM_SYMBOLS_CLASS_NAME | 29 #define LATE_BINDING_SYMBOL_TABLE_CLASS_NAME LIBM_SYMBOLS_CLASS_NAME |
29 #define LATE_BINDING_SYMBOL_TABLE_SYMBOLS_LIST LIBM_SYMBOLS_LIST | 30 #define LATE_BINDING_SYMBOL_TABLE_SYMBOLS_LIST LIBM_SYMBOLS_LIST |
30 #include "webrtc/base/latebindingsymboltable.h.def" | 31 #include "webrtc/base/latebindingsymboltable.h.def" |
31 | 32 |
32 #define LATE_BINDING_SYMBOL_TABLE_CLASS_NAME LIBM_SYMBOLS_CLASS_NAME | 33 #define LATE_BINDING_SYMBOL_TABLE_CLASS_NAME LIBM_SYMBOLS_CLASS_NAME |
33 #define LATE_BINDING_SYMBOL_TABLE_SYMBOLS_LIST LIBM_SYMBOLS_LIST | 34 #define LATE_BINDING_SYMBOL_TABLE_SYMBOLS_LIST LIBM_SYMBOLS_LIST |
34 #define LATE_BINDING_SYMBOL_TABLE_DLL_NAME "libm.so.6" | 35 #define LATE_BINDING_SYMBOL_TABLE_DLL_NAME "libm.so.6" |
35 #include "webrtc/base/latebindingsymboltable.cc.def" | 36 #include "webrtc/base/latebindingsymboltable.cc.def" |
36 | 37 |
37 TEST(LateBindingSymbolTable, libm) { | 38 TEST(LateBindingSymbolTable, libm) { |
38 LibmTestSymbolTable table; | 39 LibmTestSymbolTable table; |
39 EXPECT_FALSE(table.IsLoaded()); | 40 EXPECT_FALSE(table.IsLoaded()); |
40 ASSERT_TRUE(table.Load()); | 41 ASSERT_TRUE(table.Load()); |
41 EXPECT_TRUE(table.IsLoaded()); | 42 EXPECT_TRUE(table.IsLoaded()); |
42 EXPECT_EQ(table.acos()(0.5), acos(0.5)); | 43 EXPECT_EQ(table.acosf()(0.5f), acosf(0.5f)); |
43 EXPECT_EQ(table.sin()(0.5), sin(0.5)); | 44 EXPECT_EQ(table.sinf()(0.5f), sinf(0.5f)); |
44 EXPECT_EQ(table.tan()(0.5), tan(0.5)); | 45 EXPECT_EQ(table.tanf()(0.5f), tanf(0.5f)); |
45 // It would be nice to check that the addresses are the same, but the nature | 46 // It would be nice to check that the addresses are the same, but the nature |
46 // of dynamic linking and relocation makes them actually be different. | 47 // of dynamic linking and relocation makes them actually be different. |
47 table.Unload(); | 48 table.Unload(); |
48 EXPECT_FALSE(table.IsLoaded()); | 49 EXPECT_FALSE(table.IsLoaded()); |
49 } | 50 } |
50 | 51 |
51 #else | 52 #else |
52 #error Not implemented | 53 #error Not implemented |
53 #endif | 54 #endif |
54 | 55 |
55 } // namespace rtc | 56 } // namespace rtc |
OLD | NEW |