-- Start transaction and plan the tests. BEGIN; SELECT plan(11); -- Run the tests. SELECT is(evergreen.lpad_number_substrings( 'Appendix','0',5), 'Appendix','Non-numeric string'); SELECT is(evergreen.lpad_number_substrings( 'DISC 11','0',5), 'DISC 00011','Prefix, 1 number'); SELECT is(evergreen.lpad_number_substrings( 'DISC 14.1','0',5), 'DISC 00014.00001','Prefix, 2 numbers'); SELECT is(evergreen.lpad_number_substrings( 'DISC 12.12.13','0',5), 'DISC 00012.00012.00013','Prefix, 3 numbers'); SELECT is(evergreen.lpad_number_substrings( 'Vol 5a-15','0',5), 'Vol 00005a-00015','Mixed format'); SELECT isnt(evergreen.lpad_number_substrings( '2015 01 Jan','0',5),'02000015 00001 Jan','Matching Substring Error 1'); SELECT isnt(evergreen.lpad_number_substrings( '2015 02 Feb','0',5),'00002015 00002 Feb','Matching Substring Error 2'); SELECT is(evergreen.lpad_number_substrings( '2015 01 Jan','0',5),'02015 00001 Jan','Matching Substrings 1'); SELECT is(evergreen.lpad_number_substrings( '2015 02 Feb','0',5),'02015 00002 Feb','Matching Substrings 2'); SELECT is(evergreen.lpad_number_substrings( '0001 001 1 01','0',5),'00001 00001 00001 00001','Matching Substrings 3'); SELECT is(evergreen.lpad_number_substrings( '123456','0',5),'123456','Longer than Padding Length'); -- Finish the tests and clean up. SELECT * FROM finish(); ROLLBACK;