tglman / persy
Showing 1 of 1 files from the diff.

@@ -322,7 +322,7 @@
Loading
322 322
323 323
#[test]
324 324
fn test_multiple_put_same_value_intervalled_get() {
325 -
    create_and_drop_index("multiple_put same_value_gut", |persy, index_name| {
325 +
    create_and_drop_index("multiple_put same_value_intervalled_get", |persy, index_name| {
326 326
        let mut tx = persy.begin().expect("begin transaction works");
327 327
        tx.put::<u8, u8>(index_name, 10, 12).expect("put works correctly");
328 328
        let prep = tx.prepare().expect("prepare with index works");
@@ -357,33 +357,78 @@
Loading
357 357
}
358 358
359 359
#[test]
360 -
fn test_multiple_put_same_value_intervalled_get_same_tx() {
361 -
    create_and_drop_index("multiple_put same_value_gut", |persy, index_name| {
362 -
        let mut tx = persy.begin().expect("begin transaction works");
363 -
        tx.put::<u8, u8>(index_name, 10, 12).expect("put works correctly");
364 -
        tx.put::<u8, u8>(index_name, 10, 13).expect("put works correctly");
365 -
        tx.put::<u8, u8>(index_name, 10, 14).expect("put works correctly");
366 -
        tx.put::<u8, u8>(index_name, 10, 12).expect("put works correctly");
360 +
fn test_multiple_put_remove_same_value_intervalled_get() {
361 +
    create_and_drop_index(
362 +
        "multiple_put remove_same_value_interrvalled_get",
363 +
        |persy, index_name| {
364 +
            let mut tx = persy.begin().expect("begin transaction works");
365 +
            tx.put::<u8, u8>(index_name, 10, 12).expect("put works correctly");
366 +
            tx.put::<u8, u8>(index_name, 10, 13).expect("put works correctly");
367 +
            tx.put::<u8, u8>(index_name, 10, 14).expect("put works correctly");
368 +
            tx.put::<u8, u8>(index_name, 10, 12).expect("put works correctly");
367 369
368 -
        let mut res = tx.get::<u8, u8>(index_name, &10).expect("get works correctly");
369 -
        assert_eq!(res.next(), Some(12));
370 -
        assert_eq!(res.next(), Some(13));
371 -
        assert_eq!(res.next(), Some(14));
372 -
        assert_eq!(res.next(), None);
373 -
        let prep = tx.prepare().expect("prepare with index works");
374 -
        prep.commit().expect("commit with index works");
370 +
            let prep = tx.prepare().expect("prepare with index works");
371 +
            prep.commit().expect("commit with index works");
372 +
            let mut res = persy.get::<u8, u8>(index_name, &10).expect("get works correctly");
373 +
            assert_eq!(res.next(), Some(12));
374 +
            assert_eq!(res.next(), Some(13));
375 +
            assert_eq!(res.next(), Some(14));
376 +
            assert_eq!(res.next(), None);
375 377
376 -
        let mut res = persy.get::<u8, u8>(index_name, &10).expect("get works correctly");
377 -
        assert_eq!(res.next(), Some(12));
378 -
        assert_eq!(res.next(), Some(13));
379 -
        assert_eq!(res.next(), Some(14));
380 -
        assert_eq!(res.next(), None);
381 -
    });
378 +
            let mut tx = persy.begin().expect("begin transaction works");
379 +
            tx.remove::<u8, u8>(index_name, 10, Some(12))
380 +
                .expect("put works correctly");
381 +
            tx.remove::<u8, u8>(index_name, 10, Some(11))
382 +
                .expect("put works correctly");
383 +
            tx.remove::<u8, u8>(index_name, 10, Some(13))
384 +
                .expect("put works correctly");
385 +
            tx.remove::<u8, u8>(index_name, 10, Some(12))
386 +
                .expect("put works correctly");
387 +
            tx.remove::<u8, u8>(index_name, 10, Some(13))
388 +
                .expect("put works correctly");
389 +
            let mut res = tx.get::<u8, u8>(index_name, &10).expect("get works correctly");
390 +
            assert_eq!(res.next(), Some(14));
391 +
            assert_eq!(res.next(), None);
392 +
            let prep = tx.prepare().expect("prepare with index works");
393 +
            prep.commit().expect("commit with index works");
394 +
395 +
            let mut res = persy.get::<u8, u8>(index_name, &10).expect("get works correctly");
396 +
            assert_eq!(res.next(), Some(14));
397 +
            assert_eq!(res.next(), None);
398 +
        },
399 +
    );
400 +
}
401 +
#[test]
402 +
fn test_multiple_put_same_value_intervalled_get_same_tx() {
403 +
    create_and_drop_index(
404 +
        "multiple_put same_value_intervalled_get_same_tx",
405 +
        |persy, index_name| {
406 +
            let mut tx = persy.begin().expect("begin transaction works");
407 +
            tx.put::<u8, u8>(index_name, 10, 12).expect("put works correctly");
408 +
            tx.put::<u8, u8>(index_name, 10, 13).expect("put works correctly");
409 +
            tx.put::<u8, u8>(index_name, 10, 14).expect("put works correctly");
410 +
            tx.put::<u8, u8>(index_name, 10, 12).expect("put works correctly");
411 +
412 +
            let mut res = tx.get::<u8, u8>(index_name, &10).expect("get works correctly");
413 +
            assert_eq!(res.next(), Some(12));
414 +
            assert_eq!(res.next(), Some(13));
415 +
            assert_eq!(res.next(), Some(14));
416 +
            assert_eq!(res.next(), None);
417 +
            let prep = tx.prepare().expect("prepare with index works");
418 +
            prep.commit().expect("commit with index works");
419 +
420 +
            let mut res = persy.get::<u8, u8>(index_name, &10).expect("get works correctly");
421 +
            assert_eq!(res.next(), Some(12));
422 +
            assert_eq!(res.next(), Some(13));
423 +
            assert_eq!(res.next(), Some(14));
424 +
            assert_eq!(res.next(), None);
425 +
        },
426 +
    );
382 427
}
383 428
384 429
#[test]
385 430
fn test_multiple_put_same_value_inverted_order_get_same_tx() {
386 -
    create_and_drop_index("multiple_put same_value_gut", |persy, index_name| {
431 +
    create_and_drop_index("multiple_put same_value_inverted_get_same_tx", |persy, index_name| {
387 432
        let mut tx = persy.begin().expect("begin transaction works");
388 433
        tx.put::<u8, u8>(index_name, 10, 12).expect("put works correctly");
389 434
        tx.put::<u8, u8>(index_name, 10, 11).expect("put works correctly");
@@ -407,6 +452,44 @@
Loading
407 452
    });
408 453
}
409 454
455 +
#[test]
456 +
fn test_multiple_put_remove_same_value_inverted_order_get_same_tx() {
457 +
    create_and_drop_index(
458 +
        "multiple_put_remove_same_value_inverted_order_get_same_tx",
459 +
        |persy, index_name| {
460 +
            let mut tx = persy.begin().expect("begin transaction works");
461 +
            tx.put::<u8, u8>(index_name, 10, 12).expect("put works correctly");
462 +
            tx.put::<u8, u8>(index_name, 10, 11).expect("put works correctly");
463 +
            tx.put::<u8, u8>(index_name, 10, 13).expect("put works correctly");
464 +
            tx.put::<u8, u8>(index_name, 10, 12).expect("put works correctly");
465 +
            tx.put::<u8, u8>(index_name, 10, 13).expect("put works correctly");
466 +
467 +
            let mut res = tx.get::<u8, u8>(index_name, &10).expect("get works correctly");
468 +
            assert_eq!(res.next(), Some(11));
469 +
            assert_eq!(res.next(), Some(12));
470 +
            assert_eq!(res.next(), Some(13));
471 +
            assert_eq!(res.next(), None);
472 +
            tx.remove::<u8, u8>(index_name, 10, Some(12))
473 +
                .expect("put works correctly");
474 +
            tx.remove::<u8, u8>(index_name, 10, Some(11))
475 +
                .expect("put works correctly");
476 +
            tx.remove::<u8, u8>(index_name, 10, Some(13))
477 +
                .expect("put works correctly");
478 +
            tx.remove::<u8, u8>(index_name, 10, Some(12))
479 +
                .expect("put works correctly");
480 +
            tx.remove::<u8, u8>(index_name, 10, Some(13))
481 +
                .expect("put works correctly");
482 +
            let mut res = tx.get::<u8, u8>(index_name, &10).expect("get works correctly");
483 +
            assert_eq!(res.next(), None);
484 +
            let prep = tx.prepare().expect("prepare with index works");
485 +
            prep.commit().expect("commit with index works");
486 +
487 +
            let mut res = persy.get::<u8, u8>(index_name, &10).expect("get works correctly");
488 +
            assert_eq!(res.next(), None);
489 +
        },
490 +
    );
491 +
}
492 +
410 493
#[test]
411 494
fn test_index_browse() {
412 495
    create_and_drop_index("test_index_browse", |persy, index_name| {
Files Coverage
src 91.59%
tests 98.69%
Project Totals (37 files) 92.96%
Notifications are pending CI completion. Waiting for GitLab's status webhook to queue notifications. Push notifications now.
1
coverage:
2
  status:
3
    project:
4
      default:
5
        target: 80%
6
        threshold: 1.0%
7
    patch: off
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading