attaswift / BTree

Compare 407fda7 ... +0 ... 1913568

Missing base report.

Unable to compare commits because the base of the compare did not upload a coverage report.

Learn more here.


@@ -476,4 +476,22 @@
Loading
476 476
477 477
        assertEqualElements(l1 + l2, 0 ..< 20)
478 478
    }
479 +
480 +
    #if swift(>=4.2)
481 +
    func testCanBeCodedDecoded() {
482 +
        let list: List<Int> = [0, 1, 2, 3, 4]
483 +
        let encoder = PropertyListEncoder()
484 +
        guard let data = try? encoder.encode(list) else {
485 +
            XCTFail("failed encode")
486 +
            return
487 +
        }
488 +
        let decoder = PropertyListDecoder()
489 +
        guard let decodedList = try? decoder.decode(List<Int>.self, from: data) else {
490 +
            XCTFail("failed decode")
491 +
            return
492 +
        }
493 +
        assertEqualElements(IteratorSequence(decodedList.makeIterator()),
494 +
                            IteratorSequence(list.makeIterator()))
495 +
    }
496 +
    #endif
479 497
}

@@ -694,4 +694,23 @@
Loading
694 694
        a.shift(startingAt: 15, by: -5)
695 695
        assertEqualElements(a, [0, 3, 5, 7, 8])
696 696
    }
697 +
698 +
    #if swift(>=4.2)
699 +
    func testCanBeCodedDecoded() {
700 +
        let c = 1_000
701 +
        let set = SortedSet((0 ..< c).reversed())
702 +
        let encoder = PropertyListEncoder()
703 +
        guard let data = try? encoder.encode(set) else {
704 +
            XCTFail("failed encode")
705 +
            return
706 +
        }
707 +
        let decoder = PropertyListDecoder()
708 +
        guard let decodedSet = try? decoder.decode(SortedSet<Int>.self, from: data) else {
709 +
            XCTFail("failed decode")
710 +
            return
711 +
        }
712 +
        assertEqualElements(IteratorSequence(decodedSet.makeIterator()),
713 +
                            IteratorSequence(set.makeIterator()))
714 +
    }
715 +
    #endif
697 716
}

@@ -982,4 +982,23 @@
Loading
982 982
983 983
        assertEqualElements(copy, [0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18])
984 984
    }
985 +
986 +
    #if swift(>=4.2)
987 +
    func testCanBeCodedDecoded() {
988 +
        let c = 100
989 +
        let bag = SortedBag((0 ..< c).map { 2 * $0 }.repeatEach(3))
990 +
        let encoder = PropertyListEncoder()
991 +
        guard let data = try? encoder.encode(bag) else {
992 +
            XCTFail("failed encode")
993 +
            return
994 +
        }
995 +
        let decoder = PropertyListDecoder()
996 +
        guard let decodedBag = try? decoder.decode(SortedBag<Int>.self, from: data) else {
997 +
            XCTFail("failed decode")
998 +
            return
999 +
        }
1000 +
        assertEqualElements(IteratorSequence(decodedBag.makeIterator()),
1001 +
                            IteratorSequence(bag.makeIterator()))
1002 +
    }
1003 +
    #endif
985 1004
}

@@ -492,4 +492,22 @@
Loading
492 492
        node.assertValid()
493 493
        assertEqualElements(node, (0..<100).map { (0, $0) })
494 494
    }
495 +
496 +
    #if swift(>=4.2)
497 +
    func testCanBeCodedDecoded() {
498 +
        let node = maximalNode(depth: 1, order: 5)
499 +
        let encoder = PropertyListEncoder()
500 +
        guard let data = try? encoder.encode(node) else {
501 +
            XCTFail("failed encode")
502 +
            return
503 +
        }
504 +
        let decoder = PropertyListDecoder()
505 +
        guard let decodedNode = try? decoder.decode(Node.self, from: data) else {
506 +
            XCTFail("failed decode")
507 +
            return
508 +
        }
509 +
        assertEqualElements(IteratorSequence(decodedNode.makeIterator()),
510 +
                            IteratorSequence(node.makeIterator()))
511 +
    }
512 +
    #endif
495 513
}

@@ -440,4 +440,22 @@
Loading
440 440
        assertEqualElements(m.excluding([0, 5, 10, 15]), ([1 ..< 5, 6 ..< 10, 11 ..< 15, 16 ..< 20] as [CountableRange<Int>]).joined().map { (k) -> (Int, String) in (k, String(k)) })
441 441
        assertEqualElements(m.excluding(-10 ..< 30), [])
442 442
    }
443 +
444 +
    #if swift(>=4.2)
445 +
    func testCanBeCodedDecoded() {
446 +
        let map = Map<Int, String>(sortedElements: (0..<100).map { ($0, String($0)) })
447 +
        let encoder = PropertyListEncoder()
448 +
        guard let data = try? encoder.encode(map) else {
449 +
            XCTFail("failed encode")
450 +
            return
451 +
        }
452 +
        let decoder = PropertyListDecoder()
453 +
        guard let decodedMap = try? decoder.decode(Map<Int, String>.self, from: data) else {
454 +
            XCTFail("failed decode")
455 +
            return
456 +
        }
457 +
        assertEqualElements(IteratorSequence(decodedMap.makeIterator()),
458 +
                            IteratorSequence(map.makeIterator()))
459 +
    }
460 +
    #endif
443 461
}

Click to load this diff.
Loading diff...

Unable to process changes.

No base report to compare against.

Files Coverage
Tests/BTreeTests 98.56%
Project Totals (18 files) 98.56%
Loading