OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 TEST(Launchd, CFPropertyToLaunchData_FloatingPoint) { | 71 TEST(Launchd, CFPropertyToLaunchData_FloatingPoint) { |
72 @autoreleasepool { | 72 @autoreleasepool { |
73 base::mac::ScopedLaunchData launch_data; | 73 base::mac::ScopedLaunchData launch_data; |
74 | 74 |
75 NSNumber* double_nses[] = { | 75 NSNumber* double_nses[] = { |
76 @0.0, | 76 @0.0, |
77 @1.0, | 77 @1.0, |
78 @-1.0, | 78 @-1.0, |
79 [NSNumber numberWithFloat:std::numeric_limits<float>::min()], | 79 [NSNumber numberWithFloat:std::numeric_limits<float>::min()], |
80 [NSNumber numberWithFloat:std::numeric_limits<float>::max()], | 80 [NSNumber numberWithFloat:std::numeric_limits<float>::max()], |
81 [NSNumber numberWithFloat:std::numeric_limits<double>::min()], | 81 [NSNumber numberWithDouble:std::numeric_limits<double>::min()], |
82 [NSNumber numberWithFloat:std::numeric_limits<double>::max()], | 82 [NSNumber numberWithDouble:std::numeric_limits<double>::max()], |
83 @3.1415926535897932, | 83 @3.1415926535897932, |
84 [NSNumber numberWithFloat:std::numeric_limits<double>::infinity()], | 84 [NSNumber numberWithDouble:std::numeric_limits<double>::infinity()], |
85 [NSNumber numberWithFloat:std::numeric_limits<double>::quiet_NaN()], | 85 [NSNumber numberWithDouble:std::numeric_limits<double>::quiet_NaN()], |
86 [NSNumber numberWithFloat:std::numeric_limits<double>::signaling_NaN()], | 86 [NSNumber numberWithDouble:std::numeric_limits<double>::signaling_NaN()], |
87 }; | 87 }; |
88 | 88 |
89 for (size_t index = 0; index < arraysize(double_nses); ++index) { | 89 for (size_t index = 0; index < arraysize(double_nses); ++index) { |
90 NSNumber* double_ns = double_nses[index]; | 90 NSNumber* double_ns = double_nses[index]; |
91 launch_data.reset(CFPropertyToLaunchData(double_ns)); | 91 launch_data.reset(CFPropertyToLaunchData(double_ns)); |
92 ASSERT_TRUE(launch_data.get()); | 92 ASSERT_TRUE(launch_data.get()); |
93 ASSERT_EQ(LAUNCH_DATA_REAL, LaunchDataGetType(launch_data)); | 93 ASSERT_EQ(LAUNCH_DATA_REAL, LaunchDataGetType(launch_data)); |
94 double expected_double_value = [double_ns doubleValue]; | 94 double expected_double_value = [double_ns doubleValue]; |
95 double observed_double_value = LaunchDataGetReal(launch_data); | 95 double observed_double_value = LaunchDataGetReal(launch_data); |
96 bool expected_is_nan = std::isnan(expected_double_value); | 96 bool expected_is_nan = std::isnan(expected_double_value); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 launch_lookup_data, "com.example.service.rebooter"); | 293 launch_lookup_data, "com.example.service.rebooter"); |
294 ASSERT_TRUE(launch_sublookup_data); | 294 ASSERT_TRUE(launch_sublookup_data); |
295 ASSERT_EQ(LAUNCH_DATA_BOOL, LaunchDataGetType(launch_sublookup_data)); | 295 ASSERT_EQ(LAUNCH_DATA_BOOL, LaunchDataGetType(launch_sublookup_data)); |
296 EXPECT_TRUE(LaunchDataGetBool(launch_sublookup_data)); | 296 EXPECT_TRUE(LaunchDataGetBool(launch_sublookup_data)); |
297 } | 297 } |
298 } | 298 } |
299 | 299 |
300 } // namespace | 300 } // namespace |
301 } // namespace test | 301 } // namespace test |
302 } // namespace crashpad | 302 } // namespace crashpad |
OLD | NEW |