MCPcopy Create free account
hub / github.com/cruppstahl/upscaledb / testSetComparator

Method testSetComparator

java/unittests/CursorTest.java:337–368  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

335 }
336
337 public void testSetComparator() throws Exception {
338 byte[] k = new byte[5];
339 byte[] r = new byte[5];
340 MyComparator cmp = new MyComparator();
341 Cursor c;
342 Parameter[] params = new Parameter[1];
343 params[0] = new Parameter();
344 params[0].name = Const.UPS_PARAM_KEY_TYPE;
345 params[0].value = Const.UPS_TYPE_CUSTOM;
346
347 try {
348 tearDown();
349 m_env = new Environment();
350 m_env.create("jtest.db");
351 m_db = m_env.createDatabase((short)1, Const.UPS_ENABLE_DUPLICATE_KEYS,
352 params);
353 c = new Cursor(m_db);
354 m_db.setComparator(cmp);
355 c.insert(k, r);
356 k[0] = 1;
357 c.insert(k, r);
358 k[0] = 2;
359 c.insert(k, r);
360 k[0] = 3;
361 c.insert(k, r);
362 k[0] = 4;
363 }
364 catch (DatabaseException err) {
365 fail("Exception " + err);
366 }
367 assertEquals(4, cmp.m_counter);
368 }
369}

Callers

nothing calls this directly

Calls 5

tearDownMethod · 0.95
insertMethod · 0.95
createDatabaseMethod · 0.80
setComparatorMethod · 0.80
createMethod · 0.45

Tested by

no test coverage detected