@@ -259,68 +259,7 @@ mod tests {
259259 } ) ;
260260
261261 println ! ( "Roundtripped value: {:?}" , roundtripped_value) ;
262- // Compare values
263- match ( & original_value, & roundtripped_value) {
264- ( value:: Value :: Basic ( orig) , value:: Value :: Basic ( round) ) => {
265- assert_eq ! ( orig, round, "BasicValue mismatch" ) ;
266- }
267- ( value:: Value :: Struct ( orig) , value:: Value :: Struct ( round) ) => {
268- assert_eq ! (
269- orig. fields. len( ) ,
270- round. fields. len( ) ,
271- "Struct field count mismatch"
272- ) ;
273- for ( o, r) in orig. fields . iter ( ) . zip ( round. fields . iter ( ) ) {
274- assert_eq ! ( o, r, "Struct field value mismatch" ) ;
275- }
276- }
277- ( value:: Value :: UTable ( orig) , value:: Value :: UTable ( round) ) => {
278- assert_eq ! ( orig. len( ) , round. len( ) , "UTable row count mismatch" ) ;
279- for ( o, r) in orig. iter ( ) . zip ( round. iter ( ) ) {
280- assert_eq ! (
281- o. fields. len( ) ,
282- r. fields. len( ) ,
283- "UTable field count mismatch"
284- ) ;
285- for ( of, rf) in o. fields . iter ( ) . zip ( r. fields . iter ( ) ) {
286- assert_eq ! ( of, rf, "UTable field value mismatch" ) ;
287- }
288- }
289- }
290- ( value:: Value :: LTable ( orig) , value:: Value :: LTable ( round) ) => {
291- assert_eq ! ( orig. len( ) , round. len( ) , "LTable row count mismatch" ) ;
292- for ( o, r) in orig. iter ( ) . zip ( round. iter ( ) ) {
293- assert_eq ! (
294- o. fields. len( ) ,
295- r. fields. len( ) ,
296- "LTable field count mismatch"
297- ) ;
298- for ( of, rf) in o. fields . iter ( ) . zip ( r. fields . iter ( ) ) {
299- assert_eq ! ( of, rf, "LTable field value mismatch" ) ;
300- }
301- }
302- }
303- ( value:: Value :: KTable ( orig) , value:: Value :: KTable ( round) ) => {
304- assert_eq ! ( orig. len( ) , round. len( ) , "KTable entry count mismatch" ) ;
305- for ( ok, ov) in orig. iter ( ) {
306- let rv = round
307- . get ( ok)
308- . unwrap_or_else ( || panic ! ( "Missing key in KTable roundtrip: {:?}" , ok) ) ;
309- assert_eq ! (
310- ov. fields. len( ) ,
311- rv. fields. len( ) ,
312- "KTable field count mismatch"
313- ) ;
314- for ( of, rf) in ov. fields . iter ( ) . zip ( rv. fields . iter ( ) ) {
315- assert_eq ! ( of, rf, "KTable field value mismatch" ) ;
316- }
317- }
318- }
319- _ => panic ! (
320- "Value type mismatch: expected {:?}, got {:?}" ,
321- original_value, roundtripped_value
322- ) ,
323- }
262+ assert_eq ! ( original_value, & roundtripped_value, "Value mismatch after roundtrip" ) ;
324263 } ) ;
325264 }
326265
0 commit comments