Move scopeguard into android::base
Test: boot bullhead, bionic unit tests
Change-Id: I223249684867655ecb53713b10da41d3014f96ae
diff --git a/tests/math_test.cpp b/tests/math_test.cpp
index 6c7dffb..b960944 100644
--- a/tests/math_test.cpp
+++ b/tests/math_test.cpp
@@ -57,7 +57,7 @@
#include <limits.h>
#include <stdint.h>
-#include <private/ScopeGuard.h>
+#include <android-base/scopeguard.h>
float float_subnormal() {
union {
@@ -775,9 +775,7 @@
}
TEST(math, lrint) {
- auto guard = make_scope_guard([]() {
- fesetenv(FE_DFL_ENV);
- });
+ auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
fesetround(FE_UPWARD); // lrint/lrintf/lrintl obey the rounding mode.
ASSERT_EQ(1235, lrint(1234.01));
@@ -799,9 +797,7 @@
}
TEST(math, rint) {
- auto guard = make_scope_guard([]() {
- fesetenv(FE_DFL_ENV);
- });
+ auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
fesetround(FE_UPWARD); // rint/rintf/rintl obey the rounding mode.
feclearexcept(FE_ALL_EXCEPT); // rint/rintf/rintl do set the FE_INEXACT flag.
@@ -829,9 +825,7 @@
}
TEST(math, nearbyint) {
- auto guard = make_scope_guard([]() {
- fesetenv(FE_DFL_ENV);
- });
+ auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
fesetround(FE_UPWARD); // nearbyint/nearbyintf/nearbyintl obey the rounding mode.
feclearexcept(FE_ALL_EXCEPT); // nearbyint/nearbyintf/nearbyintl don't set the FE_INEXACT flag.
ASSERT_EQ(1234.0, nearbyint(1234.0));
@@ -858,9 +852,7 @@
}
TEST(math, lround) {
- auto guard = make_scope_guard([]() {
- fesetenv(FE_DFL_ENV);
- });
+ auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
fesetround(FE_UPWARD); // lround ignores the rounding mode.
ASSERT_EQ(1234, lround(1234.01));
ASSERT_EQ(1234, lroundf(1234.01f));
@@ -868,9 +860,7 @@
}
TEST(math, llround) {
- auto guard = make_scope_guard([]() {
- fesetenv(FE_DFL_ENV);
- });
+ auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
fesetround(FE_UPWARD); // llround ignores the rounding mode.
ASSERT_EQ(1234L, llround(1234.01));
ASSERT_EQ(1234L, llroundf(1234.01f));
@@ -965,9 +955,7 @@
}
TEST(math, round) {
- auto guard = make_scope_guard([]() {
- fesetenv(FE_DFL_ENV);
- });
+ auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
fesetround(FE_TOWARDZERO); // round ignores the rounding mode and always rounds away from zero.
ASSERT_DOUBLE_EQ(1.0, round(0.5));
ASSERT_DOUBLE_EQ(-1.0, round(-0.5));
@@ -978,9 +966,7 @@
}
TEST(math, roundf) {
- auto guard = make_scope_guard([]() {
- fesetenv(FE_DFL_ENV);
- });
+ auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
fesetround(FE_TOWARDZERO); // roundf ignores the rounding mode and always rounds away from zero.
ASSERT_FLOAT_EQ(1.0f, roundf(0.5f));
ASSERT_FLOAT_EQ(-1.0f, roundf(-0.5f));
@@ -991,9 +977,7 @@
}
TEST(math, roundl) {
- auto guard = make_scope_guard([]() {
- fesetenv(FE_DFL_ENV);
- });
+ auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
fesetround(FE_TOWARDZERO); // roundl ignores the rounding mode and always rounds away from zero.
ASSERT_DOUBLE_EQ(1.0L, roundl(0.5L));
ASSERT_DOUBLE_EQ(-1.0L, roundl(-0.5L));
@@ -1004,9 +988,7 @@
}
TEST(math, trunc) {
- auto guard = make_scope_guard([]() {
- fesetenv(FE_DFL_ENV);
- });
+ auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
fesetround(FE_UPWARD); // trunc ignores the rounding mode and always rounds toward zero.
ASSERT_DOUBLE_EQ(1.0, trunc(1.5));
ASSERT_DOUBLE_EQ(-1.0, trunc(-1.5));
@@ -1017,9 +999,7 @@
}
TEST(math, truncf) {
- auto guard = make_scope_guard([]() {
- fesetenv(FE_DFL_ENV);
- });
+ auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
fesetround(FE_UPWARD); // truncf ignores the rounding mode and always rounds toward zero.
ASSERT_FLOAT_EQ(1.0f, truncf(1.5f));
ASSERT_FLOAT_EQ(-1.0f, truncf(-1.5f));
@@ -1030,9 +1010,7 @@
}
TEST(math, truncl) {
- auto guard = make_scope_guard([]() {
- fesetenv(FE_DFL_ENV);
- });
+ auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
fesetround(FE_UPWARD); // truncl ignores the rounding mode and always rounds toward zero.
ASSERT_DOUBLE_EQ(1.0L, truncl(1.5L));
ASSERT_DOUBLE_EQ(-1.0L, truncl(-1.5L));