|
| 1 | +create or replace package test_betwnstr as |
| 2 | + |
| 3 | + -- %suite(Between string function) |
| 4 | + |
| 5 | + -- %test(Returns substring from start position to end position) |
| 6 | + procedure normal_case; |
| 7 | + |
| 8 | + -- %test(Returns substring when start position is zero) |
| 9 | + procedure zero_start_position; |
| 10 | + |
| 11 | + -- %test(Returns string until end if end position is greater than string length) |
| 12 | + procedure big_end_position; |
| 13 | + |
| 14 | + -- %test(Returns null for null input string value) |
| 15 | + procedure null_string; |
| 16 | + |
| 17 | + -- %test(Demo of a disabled test) |
| 18 | + -- %disabled |
| 19 | + procedure disabled_test; |
| 20 | + |
| 21 | +end; |
| 22 | +/ |
| 23 | +create or replace package body test_betwnstr as |
| 24 | + |
| 25 | + procedure normal_case is |
| 26 | + begin |
| 27 | + ut.expect( betwnstr( '1234567', 2, 5 ) ).to_equal('2345'); |
| 28 | + end; |
| 29 | + |
| 30 | + procedure zero_start_position is |
| 31 | + begin |
| 32 | + ut.expect( betwnstr( '1234567', 0, 5 ) ).to_equal('12345'); |
| 33 | + end; |
| 34 | + |
| 35 | + procedure big_end_position is |
| 36 | + begin |
| 37 | + ut.expect( betwnstr( '1234567', 0, 500 ) ).to_equal('1234567'); |
| 38 | + end; |
| 39 | + |
| 40 | + procedure null_string is |
| 41 | + begin |
| 42 | + ut.expect( betwnstr( null, 2, 5 ) ).to_be_null; |
| 43 | + end; |
| 44 | + |
| 45 | + procedure disabled_test is |
| 46 | + begin |
| 47 | + ut.expect( betwnstr( null, null, null) ).not_to_be_null; |
| 48 | + end; |
| 49 | + |
| 50 | +end; |
| 51 | +/ |
0 commit comments