@@ -1879,33 +1879,40 @@ mod test {
1879
1879
) ;
1880
1880
}
1881
1881
1882
- #[ tokio:: test]
1883
- async fn end_of_data_versions ( ) {
1884
- for ( version, raw) in [
1885
- ( 0 ,
1886
- vec ! [ 0 , 7 , 0x12 , 0x34 , 0 , 0 , 0 , 12 , 0xde , 0xad , 0xbe , 0xef ]
1887
- ) ,
1888
- ( 1 ,
1889
- vec ! [ 0x01 , 0x07 , 0x8e , 0xef , 0x00 , 0x00 , 0x00 , 0x18 ,
1890
- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x01 , 0x8f ,
1891
- 0x00 , 0x00 , 0x02 , 0x58 , 0x00 , 0x00 , 0x1c , 0x20
1892
- ]
1893
- ) ,
1894
- ( 2 ,
1895
- vec ! [ 0x02 , 0x07 , 0x8e , 0xef , 0x00 , 0x00 , 0x00 , 0x18 ,
1896
- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x01 , 0x8f ,
1897
- 0x00 , 0x00 , 0x02 , 0x58 , 0x00 , 0x00 , 0x1c , 0x20
1898
- ]
1899
- )
1900
- ] {
1901
- if let Err ( eod) = Payload :: read ( & mut raw. as_slice ( ) ) . await . unwrap ( ) {
1902
- assert_eq ! ( version, eod. version( ) ) ;
1882
+ macro_rules! test_eod_pdu_version {
1883
+ ( $version: expr, $raw: expr) => {
1884
+ if let Err ( eod) = Payload :: read( & mut $raw. as_slice( ) ) . await . unwrap( ) {
1885
+ assert_eq!( $version, eod. version( ) ) ;
1903
1886
} else {
1904
1887
panic!( "expected End of Data PDU" ) ;
1905
1888
}
1906
1889
}
1907
1890
}
1908
1891
1892
+ #[ tokio:: test]
1893
+ async fn end_of_data_versions ( ) {
1894
+ test_eod_pdu_version ! (
1895
+ 0 ,
1896
+ vec![ 0 , 7 , 0x12 , 0x34 , 0 , 0 , 0 , 12 , 0xde , 0xad , 0xbe , 0xef ]
1897
+ ) ;
1898
+ test_eod_pdu_version ! (
1899
+ 1 ,
1900
+ vec![
1901
+ 0x01 , 0x07 , 0x8e , 0xef , 0x00 , 0x00 , 0x00 , 0x18 ,
1902
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x01 , 0x8f ,
1903
+ 0x00 , 0x00 , 0x02 , 0x58 , 0x00 , 0x00 , 0x1c , 0x20
1904
+ ]
1905
+ ) ;
1906
+ test_eod_pdu_version ! (
1907
+ 2 ,
1908
+ vec![
1909
+ 0x02 , 0x07 , 0x8e , 0xef , 0x00 , 0x00 , 0x00 , 0x18 ,
1910
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x01 , 0x8f ,
1911
+ 0x00 , 0x00 , 0x02 , 0x58 , 0x00 , 0x00 , 0x1c , 0x20
1912
+ ]
1913
+ ) ;
1914
+ }
1915
+
1909
1916
#[ tokio:: test]
1910
1917
async fn read_write_cache_reset ( ) {
1911
1918
read_write ! (
0 commit comments