Skip to content

Commit 320e312

Browse files
test: use portable NaN in C++ tests
1 parent a9df506 commit 320e312

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

packages/react-native-nitro-storage/cpp/bindings/HybridStorageTest.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <algorithm>
44
#include <cassert>
55
#include <iostream>
6+
#include <limits>
67
#include <map>
78
#include <memory>
89
#include <optional>
@@ -533,13 +534,14 @@ void testClearNotifiesScope() {
533534
void testInvalidInputsAndMissingAdapter() {
534535
auto adapter = std::make_shared<MockAdapter>();
535536
HybridStorage storage(adapter);
537+
const auto nan = std::numeric_limits<double>::quiet_NaN();
536538

537539
expectThrows([&]() { storage.set("bad", "value", -1.0); });
538540
expectThrows([&]() { storage.set("bad", "value", 1.5); });
539-
expectThrows([&]() { storage.set("bad", "value", std::nan("")); });
540-
expectThrows([&]() { storage.setSecureAccessControl(std::nan("")); });
541+
expectThrows([&]() { storage.set("bad", "value", nan); });
542+
expectThrows([&]() { storage.setSecureAccessControl(nan); });
541543
expectThrows([&]() { storage.setSecureAccessControl(5.0); });
542-
expectThrows([&]() { storage.setSecureBiometricWithLevel("bad", "value", std::nan("")); });
544+
expectThrows([&]() { storage.setSecureBiometricWithLevel("bad", "value", nan); });
543545
expectThrows([&]() { storage.setSecureBiometricWithLevel("bad", "value", 3.0); });
544546

545547
HybridStorage missingAdapter(nullptr);

0 commit comments

Comments
 (0)