@@ -830,85 +830,85 @@ fn test_from_shared_base64_encodes() {
830
830
831
831
#[ test]
832
832
fn test_value_eq_value ( ) {
833
- type BMV = BinaryMetadataValue ;
834
- type AMV = AsciiMetadataValue ;
833
+ type Bmv = BinaryMetadataValue ;
834
+ type Amv = AsciiMetadataValue ;
835
835
836
- assert_eq ! ( AMV :: from_static( "abc" ) , AMV :: from_static( "abc" ) ) ;
837
- assert_ne ! ( AMV :: from_static( "abc" ) , AMV :: from_static( "ABC" ) ) ;
836
+ assert_eq ! ( Amv :: from_static( "abc" ) , Amv :: from_static( "abc" ) ) ;
837
+ assert_ne ! ( Amv :: from_static( "abc" ) , Amv :: from_static( "ABC" ) ) ;
838
838
839
- assert_eq ! ( BMV :: from_bytes( b"abc" ) , BMV :: from_bytes( b"abc" ) ) ;
840
- assert_ne ! ( BMV :: from_bytes( b"abc" ) , BMV :: from_bytes( b"ABC" ) ) ;
839
+ assert_eq ! ( Bmv :: from_bytes( b"abc" ) , Bmv :: from_bytes( b"abc" ) ) ;
840
+ assert_ne ! ( Bmv :: from_bytes( b"abc" ) , Bmv :: from_bytes( b"ABC" ) ) ;
841
841
842
842
// Padding is ignored.
843
843
assert_eq ! (
844
- BMV :: from_static( "SGVsbG8hIQ==" ) ,
845
- BMV :: from_static( "SGVsbG8hIQ" )
844
+ Bmv :: from_static( "SGVsbG8hIQ==" ) ,
845
+ Bmv :: from_static( "SGVsbG8hIQ" )
846
846
) ;
847
847
// Invalid values are all just invalid from this point of view.
848
848
unsafe {
849
849
assert_eq ! (
850
- BMV :: from_shared_unchecked( Bytes :: from_static( b"..{}" ) ) ,
851
- BMV :: from_shared_unchecked( Bytes :: from_static( b"{}.." ) )
850
+ Bmv :: from_shared_unchecked( Bytes :: from_static( b"..{}" ) ) ,
851
+ Bmv :: from_shared_unchecked( Bytes :: from_static( b"{}.." ) )
852
852
) ;
853
853
}
854
854
}
855
855
856
856
#[ test]
857
857
fn test_value_eq_str ( ) {
858
- type BMV = BinaryMetadataValue ;
859
- type AMV = AsciiMetadataValue ;
858
+ type Bmv = BinaryMetadataValue ;
859
+ type Amv = AsciiMetadataValue ;
860
860
861
- assert_eq ! ( AMV :: from_static( "abc" ) , "abc" ) ;
862
- assert_ne ! ( AMV :: from_static( "abc" ) , "ABC" ) ;
863
- assert_eq ! ( "abc" , AMV :: from_static( "abc" ) ) ;
864
- assert_ne ! ( "ABC" , AMV :: from_static( "abc" ) ) ;
861
+ assert_eq ! ( Amv :: from_static( "abc" ) , "abc" ) ;
862
+ assert_ne ! ( Amv :: from_static( "abc" ) , "ABC" ) ;
863
+ assert_eq ! ( "abc" , Amv :: from_static( "abc" ) ) ;
864
+ assert_ne ! ( "ABC" , Amv :: from_static( "abc" ) ) ;
865
865
866
- assert_eq ! ( BMV :: from_bytes( b"abc" ) , "abc" ) ;
867
- assert_ne ! ( BMV :: from_bytes( b"abc" ) , "ABC" ) ;
868
- assert_eq ! ( "abc" , BMV :: from_bytes( b"abc" ) ) ;
869
- assert_ne ! ( "ABC" , BMV :: from_bytes( b"abc" ) ) ;
866
+ assert_eq ! ( Bmv :: from_bytes( b"abc" ) , "abc" ) ;
867
+ assert_ne ! ( Bmv :: from_bytes( b"abc" ) , "ABC" ) ;
868
+ assert_eq ! ( "abc" , Bmv :: from_bytes( b"abc" ) ) ;
869
+ assert_ne ! ( "ABC" , Bmv :: from_bytes( b"abc" ) ) ;
870
870
871
871
// Padding is ignored.
872
- assert_eq ! ( BMV :: from_static( "SGVsbG8hIQ==" ) , "Hello!!" ) ;
873
- assert_eq ! ( "Hello!!" , BMV :: from_static( "SGVsbG8hIQ==" ) ) ;
872
+ assert_eq ! ( Bmv :: from_static( "SGVsbG8hIQ==" ) , "Hello!!" ) ;
873
+ assert_eq ! ( "Hello!!" , Bmv :: from_static( "SGVsbG8hIQ==" ) ) ;
874
874
}
875
875
876
876
#[ test]
877
877
fn test_value_eq_bytes ( ) {
878
- type BMV = BinaryMetadataValue ;
879
- type AMV = AsciiMetadataValue ;
878
+ type Bmv = BinaryMetadataValue ;
879
+ type Amv = AsciiMetadataValue ;
880
880
881
- assert_eq ! ( AMV :: from_static( "abc" ) , "abc" . as_bytes( ) ) ;
882
- assert_ne ! ( AMV :: from_static( "abc" ) , "ABC" . as_bytes( ) ) ;
883
- assert_eq ! ( * "abc" . as_bytes( ) , AMV :: from_static( "abc" ) ) ;
884
- assert_ne ! ( * "ABC" . as_bytes( ) , AMV :: from_static( "abc" ) ) ;
881
+ assert_eq ! ( Amv :: from_static( "abc" ) , "abc" . as_bytes( ) ) ;
882
+ assert_ne ! ( Amv :: from_static( "abc" ) , "ABC" . as_bytes( ) ) ;
883
+ assert_eq ! ( * "abc" . as_bytes( ) , Amv :: from_static( "abc" ) ) ;
884
+ assert_ne ! ( * "ABC" . as_bytes( ) , Amv :: from_static( "abc" ) ) ;
885
885
886
- assert_eq ! ( * "abc" . as_bytes( ) , BMV :: from_bytes( b"abc" ) ) ;
887
- assert_ne ! ( * "ABC" . as_bytes( ) , BMV :: from_bytes( b"abc" ) ) ;
886
+ assert_eq ! ( * "abc" . as_bytes( ) , Bmv :: from_bytes( b"abc" ) ) ;
887
+ assert_ne ! ( * "ABC" . as_bytes( ) , Bmv :: from_bytes( b"abc" ) ) ;
888
888
889
889
// Padding is ignored.
890
- assert_eq ! ( BMV :: from_static( "SGVsbG8hIQ==" ) , "Hello!!" . as_bytes( ) ) ;
891
- assert_eq ! ( * "Hello!!" . as_bytes( ) , BMV :: from_static( "SGVsbG8hIQ==" ) ) ;
890
+ assert_eq ! ( Bmv :: from_static( "SGVsbG8hIQ==" ) , "Hello!!" . as_bytes( ) ) ;
891
+ assert_eq ! ( * "Hello!!" . as_bytes( ) , Bmv :: from_static( "SGVsbG8hIQ==" ) ) ;
892
892
}
893
893
894
894
#[ test]
895
895
fn test_ascii_value_hash ( ) {
896
896
use std:: collections:: hash_map:: DefaultHasher ;
897
- type AMV = AsciiMetadataValue ;
897
+ type Amv = AsciiMetadataValue ;
898
898
899
- fn hash ( value : AMV ) -> u64 {
899
+ fn hash ( value : Amv ) -> u64 {
900
900
let mut hasher = DefaultHasher :: new ( ) ;
901
901
value. hash ( & mut hasher) ;
902
902
hasher. finish ( )
903
903
}
904
904
905
- let value1 = AMV :: from_static ( "abc" ) ;
906
- let value2 = AMV :: from_static ( "abc" ) ;
905
+ let value1 = Amv :: from_static ( "abc" ) ;
906
+ let value2 = Amv :: from_static ( "abc" ) ;
907
907
assert_eq ! ( value1, value2) ;
908
908
assert_eq ! ( hash( value1) , hash( value2) ) ;
909
909
910
- let value1 = AMV :: from_static ( "abc" ) ;
911
- let value2 = AMV :: from_static ( "xyz" ) ;
910
+ let value1 = Amv :: from_static ( "abc" ) ;
911
+ let value2 = Amv :: from_static ( "xyz" ) ;
912
912
913
913
assert_ne ! ( value1, value2) ;
914
914
assert_ne ! ( hash( value1) , hash( value2) ) ;
@@ -917,46 +917,46 @@ fn test_ascii_value_hash() {
917
917
#[ test]
918
918
fn test_valid_binary_value_hash ( ) {
919
919
use std:: collections:: hash_map:: DefaultHasher ;
920
- type BMV = BinaryMetadataValue ;
920
+ type Bmv = BinaryMetadataValue ;
921
921
922
- fn hash ( value : BMV ) -> u64 {
922
+ fn hash ( value : Bmv ) -> u64 {
923
923
let mut hasher = DefaultHasher :: new ( ) ;
924
924
value. hash ( & mut hasher) ;
925
925
hasher. finish ( )
926
926
}
927
927
928
- let value1 = BMV :: from_bytes ( b"abc" ) ;
929
- let value2 = BMV :: from_bytes ( b"abc" ) ;
928
+ let value1 = Bmv :: from_bytes ( b"abc" ) ;
929
+ let value2 = Bmv :: from_bytes ( b"abc" ) ;
930
930
assert_eq ! ( value1, value2) ;
931
931
assert_eq ! ( hash( value1) , hash( value2) ) ;
932
932
933
- let value1 = BMV :: from_bytes ( b"abc" ) ;
934
- let value2 = BMV :: from_bytes ( b"xyz" ) ;
933
+ let value1 = Bmv :: from_bytes ( b"abc" ) ;
934
+ let value2 = Bmv :: from_bytes ( b"xyz" ) ;
935
935
assert_ne ! ( value1, value2) ;
936
936
assert_ne ! ( hash( value1) , hash( value2) ) ;
937
937
}
938
938
939
939
#[ test]
940
940
fn test_invalid_binary_value_hash ( ) {
941
941
use std:: collections:: hash_map:: DefaultHasher ;
942
- type BMV = BinaryMetadataValue ;
942
+ type Bmv = BinaryMetadataValue ;
943
943
944
- fn hash ( value : BMV ) -> u64 {
944
+ fn hash ( value : Bmv ) -> u64 {
945
945
let mut hasher = DefaultHasher :: new ( ) ;
946
946
value. hash ( & mut hasher) ;
947
947
hasher. finish ( )
948
948
}
949
949
950
950
unsafe {
951
- let value1 = BMV :: from_shared_unchecked ( Bytes :: from_static ( b"..{}" ) ) ;
952
- let value2 = BMV :: from_shared_unchecked ( Bytes :: from_static ( b"{}.." ) ) ;
951
+ let value1 = Bmv :: from_shared_unchecked ( Bytes :: from_static ( b"..{}" ) ) ;
952
+ let value2 = Bmv :: from_shared_unchecked ( Bytes :: from_static ( b"{}.." ) ) ;
953
953
assert_eq ! ( value1, value2) ;
954
954
assert_eq ! ( hash( value1) , hash( value2) ) ;
955
955
}
956
956
957
957
unsafe {
958
- let valid = BMV :: from_bytes ( b"abc" ) ;
959
- let invalid = BMV :: from_shared_unchecked ( Bytes :: from_static ( b"{}.." ) ) ;
958
+ let valid = Bmv :: from_bytes ( b"abc" ) ;
959
+ let invalid = Bmv :: from_shared_unchecked ( Bytes :: from_static ( b"{}.." ) ) ;
960
960
assert_ne ! ( valid, invalid) ;
961
961
assert_ne ! ( hash( valid) , hash( invalid) ) ;
962
962
}
0 commit comments