|
9 | 9 | * sentinel (e.g. float -> -1e9, uint8_t -> 0xff). A value is "invalid" only |
10 | 10 | * when it equals that sentinel. A default-constructed Nullable holds T{} (0), |
11 | 11 | * which is therefore VALID for types whose sentinel differs from 0 (int, |
12 | | - * float, uint8_t) and INVALID only for bool, whose sentinel is false. |
| 12 | + * float, uint8_t). Nullable<bool> is unsupported and fails to compile (bool |
| 13 | + * has no spare sentinel value); see #883. |
13 | 14 | */ |
14 | 15 |
|
15 | 16 | #include <Arduino.h> |
@@ -57,20 +58,6 @@ void test_nullable_default_float_is_valid_zero() { |
57 | 58 | TEST_ASSERT_FLOAT_WITHIN(0.0001f, 0.0f, n.value()); |
58 | 59 | } |
59 | 60 |
|
60 | | -void test_nullable_bool_sentinel_is_false() { |
61 | | - // bool's invalid sentinel is `false`, so a default/false Nullable<bool> is |
62 | | - // invalid and a value of `false` is indistinguishable from invalid. |
63 | | - NullableBool d; |
64 | | - TEST_ASSERT_FALSE(d.is_valid()); |
65 | | - |
66 | | - NullableBool t = true; |
67 | | - TEST_ASSERT_TRUE(t.is_valid()); |
68 | | - TEST_ASSERT_TRUE(static_cast<bool>(t)); |
69 | | - |
70 | | - NullableBool f = false; |
71 | | - TEST_ASSERT_FALSE(f.is_valid()); |
72 | | -} |
73 | | - |
74 | 61 | // --------------------------------------------------------------------------- |
75 | 62 | // ptr() exposes the underlying storage |
76 | 63 | // --------------------------------------------------------------------------- |
@@ -140,7 +127,6 @@ void setup() { |
140 | 127 | RUN_TEST(test_nullable_invalid_sentinel_is_not_valid); |
141 | 128 | RUN_TEST(test_nullable_value_is_valid); |
142 | 129 | RUN_TEST(test_nullable_default_float_is_valid_zero); |
143 | | - RUN_TEST(test_nullable_bool_sentinel_is_false); |
144 | 130 | RUN_TEST(test_nullable_ptr_mutates_value); |
145 | 131 | RUN_TEST(test_nullable_copy_assignment); |
146 | 132 | RUN_TEST(test_nullable_to_json_invalid_is_null); |
|
0 commit comments