()
| 238 | } |
| 239 | |
| 240 | public void testBulkApproxMatching() { |
| 241 | byte[] k1 = new byte[] {0x11}; |
| 242 | byte[] r1 = new byte[] {0x11}; |
| 243 | |
| 244 | byte[] k2 = new byte[] {0x22}; |
| 245 | byte[] r2 = new byte[] {0x22}; |
| 246 | |
| 247 | byte[] k3 = new byte[] {0x33}; |
| 248 | byte[] r3 = new byte[] {0x33}; |
| 249 | |
| 250 | byte[] r4 = null; |
| 251 | byte[] r5 = null; |
| 252 | |
| 253 | Operation[] operations = new Operation[] { |
| 254 | new Operation(Const.UPS_OP_INSERT, k1, r1, 0), |
| 255 | new Operation(Const.UPS_OP_INSERT, k2, r2, 0), |
| 256 | new Operation(Const.UPS_OP_INSERT, k3, r3, 0), |
| 257 | new Operation(Const.UPS_OP_FIND, k2, r4, Const.UPS_FIND_LT_MATCH), |
| 258 | new Operation(Const.UPS_OP_FIND, k2, r5, Const.UPS_FIND_GT_MATCH), |
| 259 | }; |
| 260 | |
| 261 | Database db; |
| 262 | Environment env = new Environment(); |
| 263 | try { |
| 264 | env.create("jtest.db"); |
| 265 | db = env.createDatabase((short)1); |
| 266 | assertEquals(0, db.getCount()); |
| 267 | db.bulkOperations(null, operations); |
| 268 | assertByteArrayEquals(operations[3].record, r1); |
| 269 | assertByteArrayEquals(operations[4].record, r3); |
| 270 | assertEquals(0, operations[3].result); |
| 271 | assertEquals(0, operations[4].result); |
| 272 | assertEquals(3, db.getCount()); |
| 273 | db.close(); |
| 274 | } |
| 275 | catch (DatabaseException err) { |
| 276 | fail("Exception "+err); |
| 277 | } |
| 278 | env.close(); |
| 279 | } |
| 280 | } |
nothing calls this directly
no test coverage detected