@@ -2265,6 +2265,154 @@ mod tests {
22652265
22662266 assert_eq ! ( parsed_struct, my_struct, "Converting using Big Endian Reader" ) ;
22672267 }
2268+
2269+ #[ test]
2270+ fn skips ( ) {
2271+ let mut bytes = Vec :: new ( ) ;
2272+ 102u8 . to_ne_bytes ( ) . into_iter ( )
2273+ . for_each ( |x| bytes. push ( x) ) ;
2274+ 122u8 . to_ne_bytes ( ) . into_iter ( )
2275+ . for_each ( |x| bytes. push ( x) ) ;
2276+
2277+ 1345u16 . to_ne_bytes ( ) . into_iter ( )
2278+ . for_each ( |x| bytes. push ( x) ) ;
2279+ 1567u16 . to_ne_bytes ( ) . into_iter ( )
2280+ . for_each ( |x| bytes. push ( x) ) ;
2281+
2282+ 1345445335u32 . to_ne_bytes ( ) . into_iter ( )
2283+ . for_each ( |x| bytes. push ( x) ) ;
2284+ 1561366457u32 . to_ne_bytes ( ) . into_iter ( )
2285+ . for_each ( |x| bytes. push ( x) ) ;
2286+
2287+ 134545847675787u64 . to_ne_bytes ( ) . into_iter ( )
2288+ . for_each ( |x| bytes. push ( x) ) ;
2289+ 156721881824556u64 . to_ne_bytes ( ) . into_iter ( )
2290+ . for_each ( |x| bytes. push ( x) ) ;
2291+
2292+ 1345458476757874858183847456634787169u128 . to_ne_bytes ( ) . into_iter ( )
2293+ . for_each ( |x| bytes. push ( x) ) ;
2294+ 1567218818245541501092162486263847136u128 . to_ne_bytes ( ) . into_iter ( )
2295+ . for_each ( |x| bytes. push ( x) ) ;
2296+
2297+ 134545847675787485usize . to_ne_bytes ( ) . into_iter ( )
2298+ . for_each ( |x| bytes. push ( x) ) ;
2299+ 1567218818245541445usize . to_ne_bytes ( ) . into_iter ( )
2300+ . for_each ( |x| bytes. push ( x) ) ;
2301+
2302+ 102i8 . to_ne_bytes ( ) . into_iter ( )
2303+ . for_each ( |x| bytes. push ( x) ) ;
2304+ 122i8 . to_ne_bytes ( ) . into_iter ( )
2305+ . for_each ( |x| bytes. push ( x) ) ;
2306+
2307+ 1345i16 . to_ne_bytes ( ) . into_iter ( )
2308+ . for_each ( |x| bytes. push ( x) ) ;
2309+ 1567i16 . to_ne_bytes ( ) . into_iter ( )
2310+ . for_each ( |x| bytes. push ( x) ) ;
2311+
2312+ 1345445335i32 . to_ne_bytes ( ) . into_iter ( )
2313+ . for_each ( |x| bytes. push ( x) ) ;
2314+ 1561366457i32 . to_ne_bytes ( ) . into_iter ( )
2315+ . for_each ( |x| bytes. push ( x) ) ;
2316+
2317+ 134545847675787i64 . to_ne_bytes ( ) . into_iter ( )
2318+ . for_each ( |x| bytes. push ( x) ) ;
2319+ 156721881824556i64 . to_ne_bytes ( ) . into_iter ( )
2320+ . for_each ( |x| bytes. push ( x) ) ;
2321+
2322+ 1345458476757874858183847456634787169i128 . to_ne_bytes ( ) . into_iter ( )
2323+ . for_each ( |x| bytes. push ( x) ) ;
2324+ 1567218818245541501092162486263847136i128 . to_ne_bytes ( ) . into_iter ( )
2325+ . for_each ( |x| bytes. push ( x) ) ;
2326+
2327+ 1345458476757874858isize . to_ne_bytes ( ) . into_iter ( )
2328+ . for_each ( |x| bytes. push ( x) ) ;
2329+ 1567218818245541506isize . to_ne_bytes ( ) . into_iter ( )
2330+ . for_each ( |x| bytes. push ( x) ) ;
2331+
2332+ f16:: from_f32 ( 383.0 ) . to_ne_bytes ( ) . into_iter ( )
2333+ . for_each ( |x| bytes. push ( x) ) ;
2334+ f16:: from_f32 ( 323.0 ) . to_ne_bytes ( ) . into_iter ( )
2335+ . for_each ( |x| bytes. push ( x) ) ;
2336+
2337+ 3942.543f32 . to_ne_bytes ( ) . into_iter ( )
2338+ . for_each ( |x| bytes. push ( x) ) ;
2339+ 3956.33f32 . to_ne_bytes ( ) . into_iter ( )
2340+ . for_each ( |x| bytes. push ( x) ) ;
2341+
2342+ 39545342436.5633f64 . to_ne_bytes ( ) . into_iter ( )
2343+ . for_each ( |x| bytes. push ( x) ) ;
2344+ 3954534243436.1834f64 . to_ne_bytes ( ) . into_iter ( )
2345+ . for_each ( |x| bytes. push ( x) ) ;
2346+
2347+ 39545342436.56331f64 . to_ne_bytes ( ) . into_iter ( )
2348+ . for_each ( |x| bytes. push ( x) ) ;
2349+ 39545342436.56332f64 . to_ne_bytes ( ) . into_iter ( )
2350+ . for_each ( |x| bytes. push ( x) ) ;
2351+ 39545342436.56333f64 . to_ne_bytes ( ) . into_iter ( )
2352+ . for_each ( |x| bytes. push ( x) ) ;
2353+ 3954534243436.1834f64 . to_ne_bytes ( ) . into_iter ( )
2354+ . for_each ( |x| bytes. push ( x) ) ;
2355+
2356+ 39545342436.56331f64 . to_ne_bytes ( ) . into_iter ( )
2357+ . for_each ( |x| bytes. push ( x) ) ;
2358+ 39545342436.56332f64 . to_ne_bytes ( ) . into_iter ( )
2359+ . for_each ( |x| bytes. push ( x) ) ;
2360+ 39545342436.56333f64 . to_ne_bytes ( ) . into_iter ( )
2361+ . for_each ( |x| bytes. push ( x) ) ;
2362+ 3954534243436.1834f64 . to_ne_bytes ( ) . into_iter ( )
2363+ . for_each ( |x| bytes. push ( x) ) ;
2364+
2365+ let mut reader = FastByteReader :: new ( & bytes) ;
2366+ reader. skip_u8 ( ) ;
2367+ assert_eq ! ( 122u8 , reader. read_u8_ne( ) ) ;
2368+ reader. skip_u16 ( ) ;
2369+ assert_eq ! ( 1567u16 , reader. read_u16_ne( ) ) ;
2370+ reader. skip_u32 ( ) ;
2371+ assert_eq ! ( 1561366457u32 , reader. read_u32_ne( ) ) ;
2372+ reader. skip_u64 ( ) ;
2373+ assert_eq ! ( 156721881824556u64 , reader. read_u64_ne( ) ) ;
2374+ reader. skip_u128 ( ) ;
2375+ assert_eq ! ( 1567218818245541501092162486263847136u128 , reader. read_u128_ne( ) ) ;
2376+ reader. skip_usize ( ) ;
2377+ assert_eq ! ( 1567218818245541445usize , reader. read_usize_ne( ) ) ;
2378+
2379+ reader. skip_i8 ( ) ;
2380+ assert_eq ! ( 122i8 , reader. read_i8_ne( ) ) ;
2381+ reader. skip_i16 ( ) ;
2382+ assert_eq ! ( 1567i16 , reader. read_i16_ne( ) ) ;
2383+ reader. skip_i32 ( ) ;
2384+ assert_eq ! ( 1561366457i32 , reader. read_i32_ne( ) ) ;
2385+ reader. skip_i64 ( ) ;
2386+ assert_eq ! ( 156721881824556i64 , reader. read_i64_ne( ) ) ;
2387+ reader. skip_i128 ( ) ;
2388+ assert_eq ! ( 1567218818245541501092162486263847136i128 , reader. read_i128_ne( ) ) ;
2389+ reader. skip_isize ( ) ;
2390+ assert_eq ! ( 1567218818245541506isize , reader. read_isize_ne( ) ) ;
2391+
2392+ reader. skip_f16 ( ) ;
2393+ assert_eq ! ( f16:: from_f32( 323.0 ) , reader. read_f16_ne( ) ) ;
2394+ reader. skip_f32 ( ) ;
2395+ assert_eq ! ( 3956.33f32 , reader. read_f32_ne( ) ) ;
2396+ reader. skip_f64 ( ) ;
2397+ assert_eq ! ( 3954534243436.1834f64 , reader. read_f64_ne( ) ) ;
2398+
2399+ reader. skip_n ( 16 ) ;
2400+ assert_eq ! ( 39545342436.56333f64 , reader. read_f64_ne( ) ) ;
2401+ assert_eq ! ( 3954534243436.1834f64 , reader. read_f64_ne( ) ) ;
2402+
2403+
2404+ let mut equate_bytes = Vec :: new ( ) ;
2405+ 39545342436.56331f64 . to_ne_bytes ( ) . into_iter ( )
2406+ . for_each ( |x| equate_bytes. push ( x) ) ;
2407+ 39545342436.56332f64 . to_ne_bytes ( ) . into_iter ( )
2408+ . for_each ( |x| equate_bytes. push ( x) ) ;
2409+ 39545342436.56333f64 . to_ne_bytes ( ) . into_iter ( )
2410+ . for_each ( |x| equate_bytes. push ( x) ) ;
2411+ 3954534243436.1834f64 . to_ne_bytes ( ) . into_iter ( )
2412+ . for_each ( |x| equate_bytes. push ( x) ) ;
2413+
2414+ assert_eq ! ( reader. read_n( 8 * 4 ) , equate_bytes) ;
2415+ }
22682416
22692417 // Has bound checks for every indexing operation
22702418 #[ no_mangle]
0 commit comments