@@ -183,6 +183,38 @@ describe('String.Format Number Pattern', () => {
183183 expect ( result ) . to . equal ( expectedValue ) ;
184184 } ) ;
185185 } ) ;
186+
187+ describe ( 'hexadecimal' , ( ) => {
188+ it ( 'number should be converted to hex lowercase' , ( ) => {
189+ let result = String . Format ( '{0:x}' , 500 ) ;
190+ expect ( result ) . to . equal ( '1f4' ) ;
191+ } ) ;
192+
193+ it ( 'number should be converted to hex uppercase' , ( ) => {
194+ let result = String . Format ( '{0:X}' , 500 ) ;
195+ expect ( result ) . to . equal ( '1F4' ) ;
196+ } ) ;
197+
198+ it ( 'decimal should be converted to hex lowercase' , ( ) => {
199+ let result = String . Format ( '{0:x}' , 321.124 ) ;
200+ expect ( result ) . to . equal ( '141.1fbe76c8b44' ) ;
201+ } ) ;
202+
203+ it ( 'decimal should be converted to hex uppercase' , ( ) => {
204+ let result = String . Format ( '{0:X}' , 321.124 ) ;
205+ expect ( result ) . to . equal ( '141.1FBE76C8B44' ) ;
206+ } ) ;
207+
208+ it ( 'minus decimal should be converted to hex lowercase' , ( ) => {
209+ let result = String . Format ( '{0:x}' , - 321.124 ) ;
210+ expect ( result ) . to . equal ( '-141.1fbe76c8b44' ) ;
211+ } ) ;
212+
213+ it ( 'minus decimal should be converted to hex uppercase' , ( ) => {
214+ let result = String . Format ( '{0:X}' , - 321.124 ) ;
215+ expect ( result ) . to . equal ( '-141.1FBE76C8B44' ) ;
216+ } ) ;
217+ } ) ;
186218 } ) ;
187219
188220} ) ;
0 commit comments