\ir ./begin.sql

SELECT expect(
  $$ SELECT microsharding_fmt_('sh%04d', 1) $$,
  'sh0001',
  'zero-padding'
) \gset

SELECT expect(
  $$ SELECT microsharding_fmt_('my_%d', 1) $$,
  'my_1',
  'non zero-padding'
) \gset

SELECT expect(
  $$ SELECT microsharding_fmt_('my_%05d_sfx', 1) $$,
  'my_00001_sfx',
  'with suffix'
) \gset

SELECT expect_raise(
  $$ SELECT microsharding_fmt_('sh%s', 1) $$,
  'Invalid format specifier%',
  'error'
) \gset

SELECT expect_raise(
  $$ SELECT microsharding_fmt_('sh%2d', 1) $$,
  'Invalid format specifier%',
  'error'
) \gset

\ir ./rollback.sql
