File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -80,10 +80,17 @@ mod tests {
80
80
}
81
81
}
82
82
83
+ fn check_invariants ( storage : Storage ) -> bool {
84
+ match storage {
85
+ Storage :: Inline ( len, _) => len as usize <= MAX_INLINE ,
86
+ Storage :: Heap ( arc) => arc. len ( ) > MAX_INLINE ,
87
+ }
88
+ }
89
+
83
90
quickcheck ! {
84
91
fn roundtrip_check( data: Vec <u8 >) -> bool {
85
92
let storage = Storage :: from_slice( & data) ;
86
- storage. bytes( ) == data. as_slice( )
93
+ storage. bytes( ) == data. as_slice( ) && check_invariants ( storage )
87
94
}
88
95
89
96
fn from_slices_roundtrip_check( data: Vec <Vec <u8 >>) -> bool {
@@ -94,7 +101,7 @@ mod tests {
94
101
expected. extend_from_slice( & v) ;
95
102
}
96
103
let storage = Storage :: from_slices( & slices) ;
97
- storage. bytes( ) == expected. as_slice( )
104
+ storage. bytes( ) == expected. as_slice( ) && check_invariants ( storage )
98
105
}
99
106
}
100
107
}
You can’t perform that action at this time.
0 commit comments