@@ -13,6 +13,8 @@ use crate::utils::test_logger;
1313
1414use std:: ops:: { Deref , DerefMut } ;
1515
16+ /// Check various methods on [`FeatureFlags`] given `v` which should be equal to `feat` and an
17+ /// `old_v` which should be equal to `old_feat`.
1618fn check_eq ( v : & Vec < u8 > , feat : & FeatureFlags , old_v : & mut Vec < u8 > , old_feat : & mut FeatureFlags ) {
1719 assert_eq ! ( v. len( ) , feat. len( ) ) ;
1820 assert_eq ! ( v. deref( ) , feat. deref( ) ) ;
@@ -51,6 +53,8 @@ pub fn do_test(data: &[u8]) {
5153 let mut vec = Vec :: new ( ) ;
5254 let mut features = FeatureFlags :: empty ( ) ;
5355
56+ // For each 3-tuple in the input, interpret the first byte as a "command", the second byte as
57+ // an index within `vec`/`features` to mutate, and the third byte as a value.
5458 for step in data. windows ( 3 ) {
5559 let mut old_vec = vec. clone ( ) ;
5660 let mut old_features = features. clone ( ) ;
@@ -73,6 +77,8 @@ pub fn do_test(data: &[u8]) {
7377 } ,
7478 _ => { } ,
7579 }
80+ // After each mutation, check that `vec` and `features` remain the same, and pass the
81+ // previous state for testing comparisons.
7682 check_eq ( & vec, & features, & mut old_vec, & mut old_features) ;
7783 }
7884
0 commit comments