public void AssocNOutOfRangeHighThrowsException()
        {
            Range            r  = new Range(2, 5);
            PersistentVector v1 = PersistentVector.create((ISeq)r);

            v1.assocN(4, 10);
        }
        public void AssocNOutOfRangeHighThrowsException()
        {
            ISeq             r  = LongRange.create(2, 5);
            PersistentVector v1 = PersistentVector.create(r);

            v1.assocN(4, 10);
        }
Esempio n. 3
0
        public void AssocNOutOfRangeLowThrowsException()
        {
            Range            r  = new Range(2, 5);
            PersistentVector v1 = PersistentVector.create(r);

            v1.assocN(-4, 10);
        }
        public void AssocNAddsAtEndForEmpty()
        {
            PersistentVector  v1 = PersistentVector.create();
            IPersistentVector v2 = v1.assocN(0, "abc");

            Expect(v1.count(), EqualTo(0));
            Expect(v2.count(), EqualTo(1));
            Expect(v2.nth(0), EqualTo("abc"));
        }
        public void AssocNReplacesInRangeForSmall()
        {
            Range             r  = new Range(2, 5);
            PersistentVector  v1 = PersistentVector.create((ISeq)r);
            IPersistentVector v2 = v1.assocN(1, 10);

            Expect(v1.nth(0), EqualTo(2));
            Expect(v1.nth(1), EqualTo(3));
            Expect(v1.nth(2), EqualTo(4));
            Expect(v1.count(), EqualTo(3));
            Expect(v2.nth(0), EqualTo(2));
            Expect(v2.nth(1), EqualTo(10));
            Expect(v2.nth(2), EqualTo(4));
            Expect(v2.count(), EqualTo(3));
        }
        public void AssocNReplacesInRangeForSmall()
        {
            ISeq              r  = LongRange.create(2, 5);
            PersistentVector  v1 = PersistentVector.create(r);
            IPersistentVector v2 = v1.assocN(1, 10L);

            Expect((long)v1.nth(0)).To.Equal(2);
            Expect((long)v1.nth(1)).To.Equal(3);
            Expect((long)v1.nth(2)).To.Equal(4);
            Expect((long)v1.count()).To.Equal(3);
            Expect((long)v2.nth(0)).To.Equal(2);
            Expect((long)v2.nth(1)).To.Equal(10);
            Expect((long)v2.nth(2)).To.Equal(4);
            Expect((long)v2.count()).To.Equal(3);
        }
        public void AssocNAddsAtEndForSmall()
        {
            ISeq              r  = LongRange.create(2, 5);
            PersistentVector  v1 = PersistentVector.create(r);
            IPersistentVector v2 = v1.assocN(3, 10);

            Expect(v1.nth(0), EqualTo(2));
            Expect(v1.nth(1), EqualTo(3));
            Expect(v1.nth(2), EqualTo(4));
            Expect(v1.count(), EqualTo(3));
            Expect(v2.nth(0), EqualTo(2));
            Expect(v2.nth(1), EqualTo(3));
            Expect(v2.nth(2), EqualTo(4));
            Expect(v2.nth(3), EqualTo(10));
            Expect(v2.count(), EqualTo(4));
        }