|
| 1 | +create or replace package demo_expectations is |
| 2 | + |
| 3 | + -- %suite(Demoing asserts) |
| 4 | + |
| 5 | + -- %test(success of equal varchar) |
| 6 | + procedure test1; |
| 7 | + |
| 8 | + -- %test(failure of different varchar) |
| 9 | + procedure test2; |
| 10 | + |
| 11 | + -- %test(success of equal number) |
| 12 | + procedure test3; |
| 13 | + |
| 14 | + -- %test(failure of different number) |
| 15 | + procedure test4; |
| 16 | + |
| 17 | + -- %test(success of equal clob) |
| 18 | + procedure test5; |
| 19 | + |
| 20 | + -- %test(failure of different clob) |
| 21 | + procedure test6; |
| 22 | + |
| 23 | + -- %test(failure varchar with clob) |
| 24 | + procedure test7; |
| 25 | + |
| 26 | + -- %test(failure of clob with varchar) |
| 27 | + procedure test8; |
| 28 | + |
| 29 | + -- %test(failure varchar with number) |
| 30 | + procedure test9; |
| 31 | + |
| 32 | + -- %test(failure of number with varchar) |
| 33 | + procedure test10; |
| 34 | + |
| 35 | + -- %test(failure number with clob) |
| 36 | + procedure test11; |
| 37 | + |
| 38 | + |
| 39 | + -- %test(failure of clob with number) |
| 40 | + procedure test12; |
| 41 | + |
| 42 | + -- %test(success of equal blob) |
| 43 | + procedure test13; |
| 44 | + |
| 45 | + -- %test(failure of different blob) |
| 46 | + procedure test14; |
| 47 | + |
| 48 | + -- %test(failure of clob with blob) |
| 49 | + procedure test15; |
| 50 | + |
| 51 | + -- %test(failure of blob with clob) |
| 52 | + procedure test16; |
| 53 | + |
| 54 | +end; |
| 55 | +/ |
| 56 | + |
| 57 | + |
| 58 | +create or replace package body demo_expectations is |
| 59 | + |
| 60 | + -- %test(success of equal varchar) |
| 61 | + procedure test1 is |
| 62 | + begin |
| 63 | + ut.expect( 'a varchar2 value' ).to_be_equal('a varchar2 value'); |
| 64 | + end; |
| 65 | + |
| 66 | + -- %test(failure of different varchar) |
| 67 | + procedure test2 is |
| 68 | + begin |
| 69 | + ut.expect('a varchar2 value').to_be_equal('a differernt varchar2 value'); |
| 70 | + end; |
| 71 | + |
| 72 | + |
| 73 | + -- %test(success of equal number) |
| 74 | + procedure test3 is |
| 75 | + begin |
| 76 | + ut.expect(12345).to_be_equal(12345); |
| 77 | + end; |
| 78 | + |
| 79 | + |
| 80 | + -- %test(failure of different number) |
| 81 | + procedure test4 is |
| 82 | + begin |
| 83 | + ut.expect(.0987654321).to_be_equal(.09876543210987654321); |
| 84 | + end; |
| 85 | + |
| 86 | + |
| 87 | + -- %test(success of equal clob) |
| 88 | + procedure test5 is |
| 89 | + a clob := 'a3'; |
| 90 | + b clob := 'a3'; |
| 91 | + begin |
| 92 | + ut.expect(a).to_be_equal(b); |
| 93 | + end; |
| 94 | + |
| 95 | + -- %test(failure of different clob) |
| 96 | + procedure test6 is |
| 97 | + a clob := 'a3'; |
| 98 | + b clob := 'a4'; |
| 99 | + begin |
| 100 | + ut.expect(a).to_be_equal(b); |
| 101 | + end; |
| 102 | + |
| 103 | + -- %test(failure varchar with clob) |
| 104 | + procedure test7 is |
| 105 | + a clob := 'a3'; |
| 106 | + begin |
| 107 | + ut.expect(a).to_be_equal('a3'); |
| 108 | + end; |
| 109 | + |
| 110 | + |
| 111 | + -- %test(failure of clob with varchar) |
| 112 | + procedure test8 is |
| 113 | + a clob := 'a3'; |
| 114 | + begin |
| 115 | + ut.expect('a3').to_be_equal(a); |
| 116 | + end; |
| 117 | + |
| 118 | + -- %test(failure varchar with number) |
| 119 | + procedure test9 is |
| 120 | + begin |
| 121 | + ut.expect('12345').to_be_equal(12345); |
| 122 | + end; |
| 123 | + |
| 124 | + -- %test(failure of number with varchar) |
| 125 | + procedure test10 is |
| 126 | + begin |
| 127 | + ut.expect(12345).to_be_equal('12345'); |
| 128 | + end; |
| 129 | + |
| 130 | + -- %test(failure number with clob) |
| 131 | + procedure test11 is |
| 132 | + a clob := '3'; |
| 133 | + begin |
| 134 | + ut.expect(a).to_be_equal(3); |
| 135 | + end; |
| 136 | + |
| 137 | + |
| 138 | + -- %test(failure of clob with number) |
| 139 | + procedure test12 is |
| 140 | + a clob := '3'; |
| 141 | + begin |
| 142 | + ut.expect(3).to_be_equal(a); |
| 143 | + end; |
| 144 | + |
| 145 | + -- %test(success of equal blob) |
| 146 | + procedure test13 is |
| 147 | + a blob := utl_raw.cast_to_raw('a3'); |
| 148 | + b blob := utl_raw.cast_to_raw('a3'); |
| 149 | + begin |
| 150 | + ut.expect(a).to_be_equal(b); |
| 151 | + end; |
| 152 | + |
| 153 | + -- %test(failure of different blob) |
| 154 | + procedure test14 is |
| 155 | + a blob := utl_raw.cast_to_raw('a3'); |
| 156 | + b blob := utl_raw.cast_to_raw('a4'); |
| 157 | + begin |
| 158 | + ut.expect(a).to_be_equal(b); |
| 159 | + end; |
| 160 | + |
| 161 | + -- %test(failure of clob with blob) |
| 162 | + procedure test15 is |
| 163 | + a clob := 'a3'; |
| 164 | + b blob := utl_raw.cast_to_raw('a3'); |
| 165 | + begin |
| 166 | + ut.expect(a).to_be_equal(b); |
| 167 | + end; |
| 168 | + |
| 169 | + -- %test(failure of blob with clob) |
| 170 | + procedure test16 is |
| 171 | + a blob := utl_raw.cast_to_raw('a3'); |
| 172 | + b clob := 'a3'; |
| 173 | + begin |
| 174 | + ut.expect(a).to_be_equal(b); |
| 175 | + end; |
| 176 | + |
| 177 | + |
| 178 | +end; |
| 179 | +/ |
0 commit comments