Ejemplo n.º 1
0
        public void AssocNInRangeModifies()
        {
            MapEntry me = new MapEntry(1, "abc");
            IPersistentVector v1 = me.assocN(0, 2);
            IPersistentVector v2 = me.assocN(1, "def");
            IPersistentVector v3 = me.assocN(2, "ghi");

            Expect(me.count(), EqualTo(2));
            Expect(me.key(), EqualTo(1));
            Expect(me.val(), EqualTo("abc"));

            Expect(v1.count(), EqualTo(2));
            Expect(v1.nth(0), EqualTo(2));
            Expect(v1.nth(1), EqualTo("abc"));

            Expect(v2.count(), EqualTo(2));
            Expect(v2.nth(0), EqualTo(1));
            Expect(v2.nth(1), EqualTo("def"));

            Expect(v3.count(), EqualTo(3));
            Expect(v3.nth(0), EqualTo(1));
            Expect(v3.nth(1), EqualTo("abc"));
            Expect(v3.nth(2), EqualTo("ghi"));
        }
Ejemplo n.º 2
0
 public void AssocNOutOfRangeHighThrows()
 {
     MapEntry me = new MapEntry(1, "abc");
     me.assocN(4, 2);
 }
Ejemplo n.º 3
0
 public void AssocNOutOfRangeLowThrows()
 {
     MapEntry me = new MapEntry(1, "abc");
     IPersistentVector v1 = me.assocN(-4, 2);
 }