@@ -13,6 +13,8 @@ use crate::utils::test_logger;
13
13
14
14
use std:: ops:: { Deref , DerefMut } ;
15
15
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`.
16
18
fn check_eq ( v : & Vec < u8 > , feat : & FeatureFlags , old_v : & mut Vec < u8 > , old_feat : & mut FeatureFlags ) {
17
19
assert_eq ! ( v. len( ) , feat. len( ) ) ;
18
20
assert_eq ! ( v. deref( ) , feat. deref( ) ) ;
@@ -51,6 +53,8 @@ pub fn do_test(data: &[u8]) {
51
53
let mut vec = Vec :: new ( ) ;
52
54
let mut features = FeatureFlags :: empty ( ) ;
53
55
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.
54
58
for step in data. windows ( 3 ) {
55
59
let mut old_vec = vec. clone ( ) ;
56
60
let mut old_features = features. clone ( ) ;
@@ -73,6 +77,8 @@ pub fn do_test(data: &[u8]) {
73
77
} ,
74
78
_ => { } ,
75
79
}
80
+ // After each mutation, check that `vec` and `features` remain the same, and pass the
81
+ // previous state for testing comparisons.
76
82
check_eq ( & vec, & features, & mut old_vec, & mut old_features) ;
77
83
}
78
84
0 commit comments