@@ -284,3 +284,38 @@ impl<R: ::std::io::Read, T: sealed::Context> Readable<R> for Features<T> {
284
284
} )
285
285
}
286
286
}
287
+
288
+ #[ cfg( test) ]
289
+ mod tests {
290
+ use super :: { ChannelFeatures , InitFeatures , NodeFeatures } ;
291
+
292
+ #[ test]
293
+ fn sanity_test_our_features ( ) {
294
+ assert ! ( !ChannelFeatures :: supported( ) . requires_unknown_bits( ) ) ;
295
+ assert ! ( !ChannelFeatures :: supported( ) . supports_unknown_bits( ) ) ;
296
+ assert ! ( !InitFeatures :: supported( ) . requires_unknown_bits( ) ) ;
297
+ assert ! ( !InitFeatures :: supported( ) . supports_unknown_bits( ) ) ;
298
+ assert ! ( !NodeFeatures :: supported( ) . requires_unknown_bits( ) ) ;
299
+ assert ! ( !NodeFeatures :: supported( ) . supports_unknown_bits( ) ) ;
300
+
301
+ assert ! ( InitFeatures :: supported( ) . supports_upfront_shutdown_script( ) ) ;
302
+ assert ! ( NodeFeatures :: supported( ) . supports_upfront_shutdown_script( ) ) ;
303
+
304
+ assert ! ( InitFeatures :: supported( ) . supports_data_loss_protect( ) ) ;
305
+ assert ! ( NodeFeatures :: supported( ) . supports_data_loss_protect( ) ) ;
306
+
307
+ let mut init_features = InitFeatures :: supported ( ) ;
308
+ init_features. set_initial_routing_sync ( ) ;
309
+ assert ! ( !init_features. requires_unknown_bits( ) ) ;
310
+ assert ! ( !init_features. supports_unknown_bits( ) ) ;
311
+ }
312
+
313
+ #[ test]
314
+ fn sanity_test_unkown_bits_testing ( ) {
315
+ let mut features = ChannelFeatures :: supported ( ) ;
316
+ features. set_require_unknown_bits ( ) ;
317
+ assert ! ( features. requires_unknown_bits( ) ) ;
318
+ features. clear_require_unknown_bits ( ) ;
319
+ assert ! ( !features. requires_unknown_bits( ) ) ;
320
+ }
321
+ }
0 commit comments