@@ -293,3 +293,41 @@ impl<R: ::std::io::Read, T: sealed::Context> Readable<R> for Features<T> {
293
293
} )
294
294
}
295
295
}
296
+
297
+ #[ cfg( test) ]
298
+ mod tests {
299
+ use super :: { ChannelFeatures , InitFeatures , NodeFeatures } ;
300
+
301
+ #[ test]
302
+ fn sanity_test_our_features ( ) {
303
+ assert ! ( !ChannelFeatures :: supported( ) . requires_unknown_bits( ) ) ;
304
+ assert ! ( !ChannelFeatures :: supported( ) . supports_unknown_bits( ) ) ;
305
+ assert ! ( !InitFeatures :: supported( ) . requires_unknown_bits( ) ) ;
306
+ assert ! ( !InitFeatures :: supported( ) . supports_unknown_bits( ) ) ;
307
+ assert ! ( !NodeFeatures :: supported( ) . requires_unknown_bits( ) ) ;
308
+ assert ! ( !NodeFeatures :: supported( ) . supports_unknown_bits( ) ) ;
309
+
310
+ assert ! ( InitFeatures :: supported( ) . supports_upfront_shutdown_script( ) ) ;
311
+ assert ! ( NodeFeatures :: supported( ) . supports_upfront_shutdown_script( ) ) ;
312
+
313
+ assert ! ( InitFeatures :: supported( ) . supports_data_loss_protect( ) ) ;
314
+ assert ! ( NodeFeatures :: supported( ) . supports_data_loss_protect( ) ) ;
315
+
316
+ assert ! ( InitFeatures :: supported( ) . supports_variable_length_onion( ) ) ;
317
+ assert ! ( NodeFeatures :: supported( ) . supports_variable_length_onion( ) ) ;
318
+
319
+ let mut init_features = InitFeatures :: supported ( ) ;
320
+ init_features. set_initial_routing_sync ( ) ;
321
+ assert ! ( !init_features. requires_unknown_bits( ) ) ;
322
+ assert ! ( !init_features. supports_unknown_bits( ) ) ;
323
+ }
324
+
325
+ #[ test]
326
+ fn sanity_test_unkown_bits_testing ( ) {
327
+ let mut features = ChannelFeatures :: supported ( ) ;
328
+ features. set_require_unknown_bits ( ) ;
329
+ assert ! ( features. requires_unknown_bits( ) ) ;
330
+ features. clear_require_unknown_bits ( ) ;
331
+ assert ! ( !features. requires_unknown_bits( ) ) ;
332
+ }
333
+ }
0 commit comments