@@ -200,7 +200,7 @@ test('Safe32 (count non-power of 2 with carry)', (t) => {
200200 t . is ( safe32Id ( ) , '2nNB' )
201201} )
202202
203- test ( 'puid safe32 entropyValues ' , ( t ) => {
203+ test ( 'puid safe32' , ( t ) => {
204204 const valuesBytes = fixedBytes ( [ 0xd2 , 0xe3 , 0xe9 , 0xda , 0x19 , 0x03 , 0xb7 , 0x3c ] )
205205 const entropyValues = ( buf : Uint8Array ) => buf . set ( valuesBytes ( buf . length ) )
206206
@@ -294,6 +294,20 @@ test('puid from AlphaUpper', (t) => {
294294 t . is ( alphaUpperId ( ) , 'AFM' )
295295} )
296296
297+ test ( 'puid from Base16' , ( t ) => {
298+ const base16Bytes = fixedBytes ( [ 0xc7 , 0xc9 , 0x00 , 0x2a , 0x16 , 0x32 ] )
299+ const base16Id = puidGenerator ( {
300+ bits : 12 ,
301+ chars : Chars . Base16 ,
302+ entropyBytes : base16Bytes
303+ } )
304+
305+ t . is ( base16Id ( ) , 'C7C' )
306+ t . is ( base16Id ( ) , '900' )
307+ t . is ( base16Id ( ) , '2A1' )
308+ t . is ( base16Id ( ) , '632' )
309+ } )
310+
297311test ( 'puid from Base32 chars (32 chars, 5 bits)' , ( t ) => {
298312 const base32Bytes = fixedBytes ( [ 0xd2 , 0xe3 , 0xe9 , 0xda , 0x19 , 0x00 , 0x22 ] )
299313 const base32Id = puidGenerator ( { bits : 46 , chars : Chars . Base32 , entropyBytes : base32Bytes } )
@@ -323,6 +337,16 @@ test('puid from Base32HexUpper chars (32 chars, 5 bits)', (t) => {
323337 t . is ( base32HexUpperId ( ) , 'ERJ' )
324338} )
325339
340+ test ( 'puid Crockford32' , ( t ) => {
341+ const valuesBytes = fixedBytes ( [ 0xd2 , 0xe3 , 0xe9 , 0xda , 0x19 , 0x03 , 0xb7 , 0x3c ] )
342+ const entropyValues = ( buf : Uint8Array ) => buf . set ( valuesBytes ( buf . length ) )
343+
344+ const valuesId = puidGenerator ( { bits : 20 , chars : Chars . Crockford32 , entropyValues } )
345+ t . is ( valuesId ( ) , 'TBHY' )
346+ t . is ( valuesId ( ) , 'KPGS' )
347+ t . is ( valuesId ( ) , '0EVK' )
348+ } )
349+
326350test ( 'puid from Decimal (10 chars)' , ( t ) => {
327351 const decimalBytes = fixedBytes ( [ 0xd2 , 0xe3 , 0xe9 , 0xda , 0x19 , 0x03 , 0xb7 , 0x3c , 0xff ] )
328352 const decimalId = puidGenerator ( { bits : 16 , chars : Chars . Decimal , entropyBytes : decimalBytes } )
@@ -439,6 +463,16 @@ test('puid from Symbol', (t) => {
439463 t . is ( symbolId ( ) . length , length )
440464} )
441465
466+ test ( 'puid WordSafe32' , ( t ) => {
467+ const valuesBytes = fixedBytes ( [ 0xd2 , 0xe3 , 0xe9 , 0xda , 0x19 , 0x03 , 0xb7 , 0x3c ] )
468+ const entropyValues = ( buf : Uint8Array ) => buf . set ( valuesBytes ( buf . length ) )
469+
470+ const valuesId = puidGenerator ( { bits : 20 , chars : Chars . WordSafe32 , entropyValues } )
471+ t . is ( valuesId ( ) , 'pHVw' )
472+ t . is ( valuesId ( ) , 'XgRm' )
473+ t . is ( valuesId ( ) , '2PqX' )
474+ } )
475+
442476test ( 'Vowels (10 chars, 4 bits)' , ( t ) => {
443477 const vowelBytes = fixedBytes ( [ 0xa6 , 0x33 , 0xf6 , 0x9e , 0xbd , 0xee , 0xa7 ] )
444478 //
0 commit comments