@@ -26,42 +26,42 @@ TEST(Scale, encodeOptional) {
2626 // most simple case
2727 {
2828 ScaleEncoderStream s;
29- ASSERT_NO_THROW ((s << boost ::optional<uint8_t >{boost::none }));
29+ ASSERT_NO_THROW ((s << std ::optional<uint8_t >{std:: nullopt }));
3030 ASSERT_EQ (s.data (), (ByteArray{0 }));
3131 }
3232
3333 // encode existing uint8_t
3434 {
3535 ScaleEncoderStream s;
36- ASSERT_NO_THROW ((s << boost ::optional<uint8_t >{1 }));
36+ ASSERT_NO_THROW ((s << std ::optional<uint8_t >{1 }));
3737 ASSERT_EQ (s.data (), (ByteArray{1 , 1 }));
3838 }
3939
4040 // encode negative int8_t
4141 {
4242 ScaleEncoderStream s;
43- ASSERT_NO_THROW ((s << boost ::optional<int8_t >{-1 }));
43+ ASSERT_NO_THROW ((s << std ::optional<int8_t >{-1 }));
4444 ASSERT_EQ (s.data (), (ByteArray{1 , 255 }));
4545 }
4646
4747 // encode non-existing uint16_t
4848 {
4949 ScaleEncoderStream s;
50- ASSERT_NO_THROW ((s << boost ::optional<uint16_t >{boost::none }));
50+ ASSERT_NO_THROW ((s << std ::optional<uint16_t >{std:: nullopt }));
5151 ASSERT_EQ (s.data (), (ByteArray{0 }));
5252 }
5353
5454 // encode existing uint16_t
5555 {
5656 ScaleEncoderStream s;
57- ASSERT_NO_THROW ((s << boost ::optional<uint16_t >{511 }));
57+ ASSERT_NO_THROW ((s << std ::optional<uint16_t >{511 }));
5858 ASSERT_EQ (s.data (), (ByteArray{1 , 255 , 1 }));
5959 }
6060
6161 // encode existing uint32_t
6262 {
6363 ScaleEncoderStream s;
64- ASSERT_NO_THROW ((s << boost ::optional<uint32_t >{67305985 }));
64+ ASSERT_NO_THROW ((s << std ::optional<uint32_t >{67305985 }));
6565 ASSERT_EQ (s.data (), (ByteArray{1 , 1 , 2 , 3 , 4 }));
6666 }
6767}
@@ -86,22 +86,22 @@ TEST(ScaleTest, DecodeOptionalSuccess) {
8686
8787 // decode nullopt uint8_t
8888 {
89- boost ::optional<uint8_t > opt;
89+ std ::optional<uint8_t > opt;
9090 ASSERT_NO_THROW ((stream >> opt));
9191 ASSERT_FALSE (opt.has_value ());
9292 }
9393
9494 // decode optional uint8_t
9595 {
96- boost ::optional<uint8_t > opt;
96+ std ::optional<uint8_t > opt;
9797 ASSERT_NO_THROW ((stream >> opt));
9898 ASSERT_TRUE (opt.has_value ());
9999 ASSERT_EQ (*opt, 1 );
100100 }
101101
102102 // decode optional negative int8_t
103103 {
104- boost ::optional<int8_t > opt;
104+ std ::optional<int8_t > opt;
105105 ASSERT_NO_THROW ((stream >> opt));
106106 ASSERT_TRUE (opt.has_value ());
107107 ASSERT_EQ (*opt, -1 );
@@ -110,22 +110,22 @@ TEST(ScaleTest, DecodeOptionalSuccess) {
110110 // decode nullopt uint16_t
111111 // it requires 1 zero byte just like any other nullopt
112112 {
113- boost ::optional<uint16_t > opt;
113+ std ::optional<uint16_t > opt;
114114 ASSERT_NO_THROW ((stream >> opt));
115115 ASSERT_FALSE (opt.has_value ());
116116 }
117117
118118 // decode optional uint16_t
119119 {
120- boost ::optional<uint16_t > opt;
120+ std ::optional<uint16_t > opt;
121121 ASSERT_NO_THROW ((stream >> opt));
122122 ASSERT_TRUE (opt.has_value ());
123123 ASSERT_EQ (*opt, 511 );
124124 }
125125
126126 // decode optional uint32_t
127127 {
128- boost ::optional<uint32_t > opt;
128+ std ::optional<uint32_t > opt;
129129 ASSERT_NO_THROW ((stream >> opt));
130130 ASSERT_TRUE (opt.has_value ());
131131 ASSERT_EQ (*opt, 67305985 );
@@ -142,7 +142,7 @@ TEST(ScaleTest, DecodeOptionalSuccess) {
142142 * @then expected result obtained
143143 */
144144TEST (ScaleTest, EncodeOptionalBoolSuccess) {
145- std::vector<boost ::optional<bool >> values = {true , false , boost::none };
145+ std::vector<std ::optional<bool >> values = {true , false , std:: nullopt };
146146 ScaleEncoderStream s;
147147 for (auto &&v : values) {
148148 ASSERT_NO_THROW ((s << v));
@@ -154,10 +154,10 @@ TEST(ScaleTest, EncodeOptionalBoolSuccess) {
154154 * @brief helper struct for testing decode optional bool
155155 */
156156struct FourOptBools {
157- boost ::optional<bool > b1;
158- boost ::optional<bool > b2;
159- boost ::optional<bool > b3;
160- boost ::optional<bool > b4;
157+ std ::optional<bool > b1;
158+ std ::optional<bool > b2;
159+ std ::optional<bool > b3;
160+ std ::optional<bool > b4;
161161};
162162
163163template <class Stream , typename = std::enable_if_t <Stream::is_decoder_stream>>
@@ -185,10 +185,10 @@ TEST(Scale, DecodeOptionalBoolFail) {
185185 */
186186TEST (Scale, DecodeOptionalBoolSuccess) {
187187 auto bytes = ByteArray{0 , 1 , 2 , 1 };
188- using optbool = boost ::optional<bool >;
188+ using optbool = std ::optional<bool >;
189189
190190 EXPECT_OUTCOME_TRUE (res, decode<FourOptBools>(bytes))
191- ASSERT_EQ (res.b1 , boost::none );
191+ ASSERT_EQ (res.b1 , std:: nullopt );
192192 ASSERT_EQ (res.b2 , optbool (true ));
193193 ASSERT_EQ (res.b3 , optbool (false ));
194194 ASSERT_EQ (res.b4 , optbool (true ));
0 commit comments